I encrypt my data with AES with a key and a random IV. This key I encrypt with RSA and include it in my EncryptedData
as seen below. I need to include the IV too but how do I include it with XML Encryption Syntax as the KeyInfo
element is already occupied by the EncryptedKey
element?
<?xml version='1.0' encoding='UTF-8'?>
<EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element"
xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbf" />
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#">
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">
<KeySize>256</KeySize>
<OAEPparams>AA==</OAEPparams>
<DigestMethod xmlns="http://www.w3.org/2000/09/xmldsig#"
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
</EncryptionMethod>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>client provided public key</KeyName>
</KeyInfo>
<CipherData>
<CipherValue>...</CipherValue>
</CipherData>
</EncryptedKey>
</KeyInfo>
<CipherData>
<CipherValue>...</CipherValue>
</CipherData>
</EncryptedData>
As per XMLEnc (see 5.2.2) the IV is placed in front of the encrypted data and is not included as a part of the key. Neither XMLEnc specification says anything about including the IV with the key during KeyTransport or KeyWrap procedure.