<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 6/20/19 8:00 PM, Stefan Rasmusson
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACdgyciBbZ6_PtGdbB1F8nFF_zT+mnXQgnZFeB4dxnvL7jCtpw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Im trying to encrypt a key to be used in a holder
        of key subject confirmation. This EncryptedKey will be contained
        in a key info element inside the subject confirmation data. All
        my research only turns up how to create a keyinfo with encrypted
        key when encrypting another element.
        <div><br>
        </div>
        <div>Any ideas on how this could be done?</div>
      </div>
      <br>
    </blockquote>
    <p><br>
    </p>
    <p>org.opensaml.xmlsec.encryption.support.Encrypter contains a
      couple of public encryptKey(java.security.Key, ...) methods, which
      support encrypting any Java Key to an OpenSAML EncryptedKey.  Then
      you would just build a KeyInfo as usual with its builder and add
      the EncryptedKey via the KeyInfo#getEncrypedKeys().<br>
    </p>
  </body>
</html>