diff options
author | Sverker Eriksson <[email protected]> | 2013-05-16 20:08:50 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2013-05-24 23:30:37 +0200 |
commit | 6518a54dbbbadb01f546e0e8c3dd3c3dfdf93e13 (patch) | |
tree | a2c907a2418edd6dce73d77834589c5c1da3dc87 /lib/public_key/test/erl_make_certs.erl | |
parent | ee2d14442698039cfd1a98c7a8ce4a9331166c16 (diff) | |
download | otp-6518a54dbbbadb01f546e0e8c3dd3c3dfdf93e13.tar.gz otp-6518a54dbbbadb01f546e0e8c3dd3c3dfdf93e13.tar.bz2 otp-6518a54dbbbadb01f546e0e8c3dd3c3dfdf93e13.zip |
crypto, public_key & ssl: Make more functions accept integer keys
Diffstat (limited to 'lib/public_key/test/erl_make_certs.erl')
-rw-r--r-- | lib/public_key/test/erl_make_certs.erl | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/public_key/test/erl_make_certs.erl b/lib/public_key/test/erl_make_certs.erl index b153046015..5926794ca8 100644 --- a/lib/public_key/test/erl_make_certs.erl +++ b/lib/public_key/test/erl_make_certs.erl @@ -403,22 +403,18 @@ gen_dsa2(LSize, NSize) -> Y = crypto:mod_pow(G, X, P), %% Calculate y = g^x mod p. #'DSAPrivateKey'{version=0, p = P, q = Q, - g = crypto:binary_to_integer(G), y = crypto:binary_to_integer(Y), x = X} + g = crypto:bytes_to_integer(G), y = crypto:bytes_to_integer(Y), x = X} end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EC key generation (OBS: for testing only) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -int2list(I) -> - L = (length(integer_to_list(I, 16)) + 1) div 2, - binary_to_list(<<I:(L*8)>>). - gen_ec2(CurveId) -> - {PrivKey, PubKey} = crypto:generate_key(ecdh, CurveId), + {PubKey, PrivKey} = crypto:generate_key(ecdh, CurveId), #'ECPrivateKey'{version = 1, - privateKey = int2list(PrivKey), + privateKey = binary_to_list(PrivKey), parameters = {namedCurve, pubkey_cert_records:namedCurves(CurveId)}, publicKey = {0, PubKey}}. @@ -451,7 +447,7 @@ is_prime(_, 0) -> true; is_prime(Candidate, Test) -> CoPrime = odd_rand(10000, Candidate), Result = crypto:mod_pow(CoPrime, Candidate, Candidate) , - is_prime(CoPrime, crypto:binary_to_integer(Result), Candidate, Test). + is_prime(CoPrime, crypto:bytes_to_integer(Result), Candidate, Test). is_prime(CoPrime, CoPrime, Candidate, Test) -> is_prime(Candidate, Test-1); |