diff options
author | Maxim Fedorov <[email protected]> | 2018-05-21 16:43:36 -0700 |
---|---|---|
committer | Maxim Fedorov <[email protected]> | 2018-05-21 16:46:56 -0700 |
commit | 8125494dc169d86e6266842e2e1bfa712ee9ffa8 (patch) | |
tree | a2fc3a2d4484f8e27bec8dd760959ec4ca3dae08 /lib/public_key/test | |
parent | 26c3c3b6496c40f28b59fdbb11351c1830d090b9 (diff) | |
download | otp-8125494dc169d86e6266842e2e1bfa712ee9ffa8.tar.gz otp-8125494dc169d86e6266842e2e1bfa712ee9ffa8.tar.bz2 otp-8125494dc169d86e6266842e2e1bfa712ee9ffa8.zip |
PKCS8 encoder must be symmetrical to PKCS8 decoder, thus it has to be in der_encode, and not pem_encode as it was in original implementation
Diffstat (limited to 'lib/public_key/test')
-rw-r--r-- | lib/public_key/test/pbe_SUITE.erl | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/public_key/test/pbe_SUITE.erl b/lib/public_key/test/pbe_SUITE.erl index 44caf479e5..8a5db4efec 100644 --- a/lib/public_key/test/pbe_SUITE.erl +++ b/lib/public_key/test/pbe_SUITE.erl @@ -226,11 +226,6 @@ pbes2(Config) when is_list(Config) -> ok end. -check_key_info(#'PrivateKeyInfo'{privateKeyAlgorithm = - #'PrivateKeyInfo_privateKeyAlgorithm'{algorithm = ?rsaEncryption}, - privateKey = Key}) -> - #'RSAPrivateKey'{} = public_key:der_decode('RSAPrivateKey', iolist_to_binary(Key)). - decode_encode_key_file(File, Password, Cipher, Config) -> Datadir = proplists:get_value(data_dir, Config), {ok, PemKey} = file:read_file(filename:join(Datadir, File)), @@ -238,11 +233,10 @@ decode_encode_key_file(File, Password, Cipher, Config) -> PemEntry = public_key:pem_decode(PemKey), ct:print("Pem entry: ~p" , [PemEntry]), [{Asn1Type, _, {Cipher,_} = CipherInfo} = PubEntry] = PemEntry, - KeyInfo = public_key:pem_entry_decode(PubEntry, Password), + #'RSAPrivateKey'{} = KeyInfo = public_key:pem_entry_decode(PubEntry, Password), PemKey1 = public_key:pem_encode([public_key:pem_entry_encode(Asn1Type, KeyInfo, {CipherInfo, Password})]), Pem = strip_ending_newlines(PemKey), - Pem = strip_ending_newlines(PemKey1), - check_key_info(KeyInfo). + Pem = strip_ending_newlines(PemKey1). strip_ending_newlines(Bin) -> string:strip(binary_to_list(Bin), right, 10). |