Skip to content

Agile Decryption Spec Compliance Question #99

@Jack0O7

Description

@Jack0O7

In ecma376_agile.py, the tool defines the DataIntegrity generation as the following.

@staticmethod
    def generate_integrity_parameter(
        encrypted_data, params: ECMA376AgileCipherParams, secret_key, salt_value
    ):
        """
        Returns the encrypted HmacKey and HmacValue.
        """
        salt = _random_buffer(params.hashSize) # <------- NOTE THIS

        iv1 = _generate_iv(params, blkKey_dataIntegrity1, salt_value)
        iv2 = _generate_iv(params, blkKey_dataIntegrity2, salt_value)

        encryptedHmacKey = _encrypt_aes_cbc(salt, secret_key, iv1)

        msg_hmac = hmac.new(salt, encrypted_data, _get_hash_func(params.hashName))
        hmacValue = msg_hmac.digest()

        encryptedHmacValue = _encrypt_aes_cbc(hmacValue, secret_key, iv2)

        return encryptedHmacKey, encryptedHmacValue

In the spec (section 2.3.4.14 step 2), it says that the random array of bytes should be the same length as the KeyData.saltSize attribute.

I have played around with Microsoft Official Products and it looks like they don't use saltSize either. I would appreciate if someone could explain whether the spec is wrong.

I have accidentally closed the previous issue - that is why I am raising this one.
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions