diff options
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r-- | src/lib/pubkey/pbes2/pbes2.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/pubkey/pbes2/pbes2.cpp b/src/lib/pubkey/pbes2/pbes2.cpp index d68bf184b..66c621644 100644 --- a/src/lib/pubkey/pbes2/pbes2.cpp +++ b/src/lib/pubkey/pbes2/pbes2.cpp @@ -239,16 +239,14 @@ pbes2_encrypt_shared(const secure_vector<uint8_t>& key_bits, secure_vector<uint8_t> ctext = key_bits; enc->finish(ctext); - std::vector<uint8_t> pbes2_params; + std::vector<uint8_t> encoded_iv; + DER_Encoder(encoded_iv).encode(iv, OCTET_STRING); + std::vector<uint8_t> pbes2_params; DER_Encoder(pbes2_params) .start_cons(SEQUENCE) .encode(kdf_algo) - .encode( - AlgorithmIdentifier(cipher, - DER_Encoder().encode(iv, OCTET_STRING).get_contents_unlocked() - ) - ) + .encode(AlgorithmIdentifier(cipher, encoded_iv)) .end_cons(); AlgorithmIdentifier id(OID::from_string("PBE-PKCS5v20"), pbes2_params); @@ -256,7 +254,6 @@ pbes2_encrypt_shared(const secure_vector<uint8_t>& key_bits, return std::make_pair(id, unlock(ctext)); } - } std::pair<AlgorithmIdentifier, std::vector<uint8_t>> |