From 24af5238589a2b0c4a153ead9e2f37506870f94c Mon Sep 17 00:00:00 2001 From: Wim Lewis Date: Sun, 8 Jan 2017 18:40:32 -0800 Subject: Add RSA key generation Support RSA key generation using generate_key(rsa, {bits, e}). This depends on the currently-experimental "dirty scheduler" support because key generation is a potentially lengthy process. --- lib/crypto/doc/src/crypto.xml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/crypto/doc') diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index cbf141b3b0..102db8984a 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -298,22 +298,25 @@ generate_key(Type, Params) -> {PublicKey, PrivKeyOut} generate_key(Type, Params, PrivKeyIn) -> {PublicKey, PrivKeyOut} - Generates a public keys of type Type + Generates a public key of type Type - Type = dh | ecdh | srp - Params = dh_params() | ecdh_params() | SrpUserParams | SrpHostParams + Type = dh | ecdh | rsa | srp + Params = dh_params() | ecdh_params() | RsaParams | SrpUserParams | SrpHostParams + RsaParams = {ModulusSizeInBits::integer(), PublicExponent::key_value()} SrpUserParams = {user, [Generator::binary(), Prime::binary(), Version::atom()]} SrpHostParams = {host, [Verifier::binary(), Generator::binary(), Prime::binary(), Version::atom()]} - PublicKey = dh_public() | ecdh_public() | srp_public() + PublicKey = dh_public() | ecdh_public() | rsa_public() | srp_public() PrivKeyIn = undefined | dh_private() | ecdh_private() | srp_private() - PrivKeyOut = dh_private() | ecdh_private() | srp_private() + PrivKeyOut = dh_private() | ecdh_private() | rsa_private() | srp_private() -

Generates public keys of type Type. +

Generates a public key of type Type. See also public_key:generate_key/1 May throw exception low_entropy in case the random generator failed due to lack of secure "randomness".

+

RSA key generation is only available if the runtime was built with the + experimental dirty scheduler feature.

-- cgit v1.2.3 From a00ff322e4cbe72c698eff22e4a4d5f6bb33e067 Mon Sep 17 00:00:00 2001 From: Wim Lewis Date: Wed, 18 Jan 2017 21:41:50 -0800 Subject: Update the documentation for RSA key generation to reflect that dirty schedulers are no longer considered "experimental", per a comment from sverker. --- lib/crypto/doc/src/crypto.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/crypto/doc') diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index 102db8984a..32144613e0 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -315,8 +315,11 @@ May throw exception low_entropy in case the random generator failed due to lack of secure "randomness".

-

RSA key generation is only available if the runtime was built with the - experimental dirty scheduler feature.

+ +

RSA key generation is only available if the runtime was + built with dirty scheduler support. Otherwise, attempting to + generate an RSA key will throw exception notsup.

+
-- cgit v1.2.3 From fcbcc330e733e62ae75c7748ae254e368ce97033 Mon Sep 17 00:00:00 2001 From: Wim Lewis Date: Wed, 18 Jan 2017 21:43:27 -0800 Subject: Minor punctuation fixes in the crypto documentation. --- lib/crypto/doc/src/crypto.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/crypto/doc') diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index 32144613e0..440c5bd204 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -77,7 +77,7 @@ rsa_private() = [key_value()] = [E, N, D] | [E, N, D, P1, P2, E1, E2, C]

Where E is the public exponent, N is public modulus and D is - the private exponent.The longer key format contains redundant + the private exponent. The longer key format contains redundant information that will make the calculation faster. P1,P2 are first and second prime factors. E1,E2 are first and second exponents. C is the CRT coefficient. Terminology is taken from RFC 3447.

@@ -311,7 +311,7 @@

Generates a public key of type Type. - See also public_key:generate_key/1 + See also public_key:generate_key/1. May throw exception low_entropy in case the random generator failed due to lack of secure "randomness".

-- cgit v1.2.3 From c6270678e0c4297440c2b191ad500b33ed18af5f Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Thu, 9 Mar 2017 15:25:21 +0100 Subject: crypto: Document exceptions thrown in crypto:generate_key --- lib/crypto/doc/src/crypto.xml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/crypto/doc') diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml index 440c5bd204..3192ec0de8 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -312,13 +312,17 @@

Generates a public key of type Type. See also public_key:generate_key/1. - May throw exception low_entropy in case the random generator - failed due to lack of secure "randomness". -

+ May throw exception an exception of class error: +

+ + badarg: an argument is of wrong type or has an illegal value, + low_entropy: the random generator failed due to lack of secure "randomness", + computation_failed: the computation fails of another reason than low_entropy. +

RSA key generation is only available if the runtime was built with dirty scheduler support. Otherwise, attempting to - generate an RSA key will throw exception notsup.

+ generate an RSA key will throw exception error:notsup.

-- cgit v1.2.3