aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/src/public_key.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2014-08-21 12:58:09 +0200
committerIngela Anderton Andin <[email protected]>2014-08-25 09:04:46 +0200
commit34fa6383ea9e065a4555d2d263149893b8d7b1ad (patch)
tree152d1dbd66588983ff50ff4d4f8fad380c456d5c /lib/public_key/src/public_key.erl
parentf993ce5f68f875f95c24f085773e4a0916568e9d (diff)
downloadotp-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.erl10
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).
%%--------------------------------------------------------------------