【问题标题】:How to provide an initialization vector with XML Encryption Syntax如何使用 XML 加密语法提供初始化向量
【发布时间】:2014-10-25 18:01:21
【问题描述】:

我使用带有密钥和随机 IV 的 AES 加密我的数据。我使用 RSA 加密此密钥并将其包含在我的 EncryptedData 中,如下所示。我也需要包含 IV,但是由于 KeyInfo 元素已经被 EncryptedKey 元素占用,我该如何将它包含在 XML 加密语法中?

<?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>

【问题讨论】:

    标签: xml encryption cryptography public-key-encryption xml-encryption


    【解决方案1】:

    根据XMLEnc(参见 5.2.2),IV 位于加密数据的前面,并且不包含在密钥中。 XMLEnc 规范都没有说明在 KeyTransport 或 KeyWrap 过程中将 IV 包含在密钥中。

    【讨论】:

    • 是的,那段让我很困惑,尤其是“IV,如果有的话,可以被指定为与密码数据、算法内容元素或其他地方。”部分。所以我只是将 IV 添加到由空格分隔的 CipherValue 元素内容之前?
    • @4485670 用于用户定义的算法。对于规范定义的算法,IV 位于加密数据之前,如下一段所述。所以很清楚。
    猜你喜欢
    • 2011-07-03
    • 2016-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-15
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    相关资源
    最近更新 更多