diff options
author | Ingela Anderton Andin <[email protected]> | 2013-04-24 09:24:02 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2013-05-08 10:39:20 +0200 |
commit | 8537e256d5bb250f6e798d521deef16907a4e526 (patch) | |
tree | abe3c8eb549152a8c6d3a3251f31151e45bd3135 /lib | |
parent | e05c31eaa6b4f09ac220bf88d78376d7ef8722d7 (diff) | |
download | otp-8537e256d5bb250f6e798d521deef16907a4e526.tar.gz otp-8537e256d5bb250f6e798d521deef16907a4e526.tar.bz2 otp-8537e256d5bb250f6e798d521deef16907a4e526.zip |
public_key: use new crypto
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public_key/src/public_key.erl | 12 | ||||
-rw-r--r-- | lib/ssl/test/erl_make_certs.erl | 2 |
2 files changed, 4 insertions, 10 deletions
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl index b11a225761..ee5c5e8552 100644 --- a/lib/public_key/src/public_key.erl +++ b/lib/public_key/src/public_key.erl @@ -331,7 +331,7 @@ encrypt_private(PlainText, %%-------------------------------------------------------------------- generate_key({curve, Name}) -> Term = crypto:ecdh_generate_key(Name), - ec_key(Term); + ec_key(Term, Name); generate_key(#'DHParameter'{prime = P, base = G}) -> crypto:dh_generate_key([crypto:mpint(P), crypto:mpint(G)]); @@ -916,19 +916,13 @@ ec_curve_spec( #'OTPECParameters'{fieldID = FieldId, curve = PCurve, base = Base ec_curve_spec({namedCurve, OID}) -> pubkey_cert_records:namedCurves(OID). -ec_key({Curve, PrivateKey, PubKey}) when is_atom(Curve) -> - #'ECPrivateKey'{version = 1, - privateKey = int2list(PrivateKey), - parameters = {namedCurve, pubkey_cert_records:namedCurves(Curve)}, - publicKey = {0, PubKey}}. - -ec_key({Curve, PrivateKey, PubKey}, _Params) when is_atom(Curve) -> +ec_key({PrivateKey, PubKey}, Curve) when is_atom(Curve) -> #'ECPrivateKey'{version = 1, privateKey = int2list(PrivateKey), parameters = {namedCurve, pubkey_cert_records:namedCurves(Curve)}, publicKey = {0, PubKey}}; -ec_key({_Curve, PrivateKey, PubKey}, Params) -> +ec_key({PrivateKey, PubKey}, Params) -> #'ECPrivateKey'{version = 1, privateKey = int2list(PrivateKey), parameters = Params, diff --git a/lib/ssl/test/erl_make_certs.erl b/lib/ssl/test/erl_make_certs.erl index c0cf5005ed..8743cb13fa 100644 --- a/lib/ssl/test/erl_make_certs.erl +++ b/lib/ssl/test/erl_make_certs.erl @@ -409,7 +409,7 @@ int2list(I) -> binary_to_list(<<I:(L*8)>>). gen_ec2(CurveId) -> - {_Curve, PrivKey, PubKey} = crypto:ecdh_generate_key(CurveId), + {PrivKey, PubKey} = crypto:ecdh_generate_key(CurveId), #'ECPrivateKey'{version = 1, privateKey = int2list(PrivKey), |