Skip to content

Symmetric encryption and decryption do not precondition on the correct key size #132

@BrianSipos

Description

@BrianSipos

Neither the algorithm class nor the EncCommon class verify that the given symmetric key value k is of the size required by the algorithm. This allows 'failures' in decrypting which are really failures in providing a matching key. This is more of an error mode / message issue than a security issue, since the operation will still fail either way. It would be helpful to compare and raise a ValueError if the len(self.key.k) is different than alg.get_key_length().

return alg.decrypt(key=self.key, ciphertext=self.payload, aad=self._enc_structure, nonce=nonce)

return alg.encrypt(key=self.key, data=self.payload, aad=self._enc_structure, nonce=nonce)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions