diff options
author | Ingela Anderton Andin <[email protected]> | 2014-08-21 12:58:09 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2014-08-25 09:04:46 +0200 |
commit | 34fa6383ea9e065a4555d2d263149893b8d7b1ad (patch) | |
tree | 152d1dbd66588983ff50ff4d4f8fad380c456d5c /lib/public_key/src/public_key.erl | |
parent | f993ce5f68f875f95c24f085773e4a0916568e9d (diff) | |
download | otp-34fa6383ea9e065a4555d2d263149893b8d7b1ad.tar.gz otp-34fa6383ea9e065a4555d2d263149893b8d7b1ad.tar.bz2 otp-34fa6383ea9e065a4555d2d263149893b8d7b1ad.zip |
public_key: Add encodeing functionality for PBES1 and PBES2
Diffstat (limited to 'lib/public_key/src/public_key.erl')
-rw-r--r-- | lib/public_key/src/public_key.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl index c70053d2d9..bbe54ad4e1 100644 --- a/lib/public_key/src/public_key.erl +++ b/lib/public_key/src/public_key.erl @@ -173,13 +173,19 @@ pem_entry_encode(Asn1Type, Entity, {{Cipher, #'PBES2-params'{}} = CipherInfo, is_list(Password) andalso is_list(Cipher) -> do_pem_entry_encode(Asn1Type, Entity, CipherInfo, Password); - +pem_entry_encode(Asn1Type, Entity, {{Cipher, + {#'PBEParameter'{}, _}} = CipherInfo, + Password}) when is_atom(Asn1Type) andalso + is_list(Password) andalso + is_list(Cipher) -> + do_pem_entry_encode(Asn1Type, Entity, CipherInfo, Password); pem_entry_encode(Asn1Type, Entity, {{Cipher, Salt} = CipherInfo, Password}) when is_atom(Asn1Type) andalso is_list(Password) andalso is_list(Cipher) andalso is_binary(Salt) andalso - erlang:byte_size(Salt) == 8 -> + ((erlang:byte_size(Salt) == 8) or + (erlang:byte_size(Salt) == 16)) -> do_pem_entry_encode(Asn1Type, Entity, CipherInfo, Password). %%-------------------------------------------------------------------- |