aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/src
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-11-28 12:15:05 +0100
committerHans Nilsson <[email protected]>2017-12-01 14:47:34 +0100
commitbd4fc9ce5e7fc0feab83e0452511dfdd17ae4ec8 (patch)
tree587eaa8a1e2cbe61ac65691a871d70e68925cb66 /lib/crypto/src
parenta3af8c0cfbe88579c1bd2779860fa7980e219c0c (diff)
downloadotp-bd4fc9ce5e7fc0feab83e0452511dfdd17ae4ec8.tar.gz
otp-bd4fc9ce5e7fc0feab83e0452511dfdd17ae4ec8.tar.bz2
otp-bd4fc9ce5e7fc0feab83e0452511dfdd17ae4ec8.zip
crypto: fix pubkey_to_privkey
Diffstat (limited to 'lib/crypto/src')
-rw-r--r--lib/crypto/src/crypto.erl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index 8e3d41c1e9..641e526537 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -1061,9 +1061,17 @@ ec_curve(X) ->
privkey_to_pubkey(Alg, EngineMap) when Alg == rsa; Alg == dss; Alg == ecdsa ->
- case notsup_to_error(privkey_to_pubkey_nif(Alg, format_pkey(Alg,EngineMap))) of
+ try privkey_to_pubkey_nif(Alg, format_pkey(Alg,EngineMap))
+ of
[_|_]=L -> map_ensure_bin_as_int(L);
X -> X
+ catch
+ error:badarg when Alg==ecdsa ->
+ {error, notsup};
+ error:badarg ->
+ {error, not_found};
+ error:notsup ->
+ {error, notsup}
end.
privkey_to_pubkey_nif(_Alg, _EngineMap) -> ?nif_stub.