From cf5b798714e89923c9068720fcf5a0e31af72b2c Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Thu, 6 Jul 2017 14:38:41 +0200 Subject: crypto: doc sign/5 and verify/6 --- lib/crypto/doc/src/crypto.xml | 19 +++++++++++++++++-- 1 file changed, 17 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 ecc33aafc3..5b2c46a004 100644 --- a/lib/crypto/doc/src/crypto.xml +++ b/lib/crypto/doc/src/crypto.xml @@ -159,6 +159,17 @@ digest_type() = md5 | sha | sha224 | sha256 | sha384 | sha512 + rsa_digest_type() = md5 | ripemd160 | sha | sha224 | sha256 | sha384 | sha512 + + dss_digest_type() = sha | sha224 | sha256 | sha384 | sha512

Note that the actual supported + dss_digest_type depends on the underlying crypto library. In OpenSSL version >= 1.0.1 the listed digest are supported, while in 1.0.0 only sha, sha224 and sha256 are supported. In version 0.9.8 only sha is supported.

+ + ecdsa_digest_type() = sha | sha224 | sha256 | sha384 | sha512 + + sign_options() = [{rsa_pad, rsa_sign_padding()} | {rsa_pss_saltlen, integer()}] + + rsa_sign_padding() = rsa_pkcs1_padding | rsa_pkcs1_pss_padding + hash_algorithms() = md5 | ripemd160 | sha | sha224 | sha256 | sha384 | sha512

md4 is also supported for hash_init/1 and hash/2. Note that both md4 and md5 are recommended only for compatibility with existing applications.

@@ -682,6 +693,7 @@ sign(Algorithm, DigestType, Msg, Key) -> binary() + sign(Algorithm, DigestType, Msg, Key, Options) -> binary() Create digital signature. Algorithm = rsa | dss | ecdsa @@ -689,8 +701,9 @@ The msg is either the binary "cleartext" data to be signed or it is the hashed value of "cleartext" i.e. the digest (plaintext). - DigestType = digest_type() + DigestType = rsa_digest_type() | dss_digest_type() | ecdsa_digest_type() Key = rsa_private() | dss_private() | [ecdh_private(),ecdh_params()] + Options = sign_options()

Creates a digital signature.

@@ -871,15 +884,17 @@ _FloatValue = rand:uniform(). % [0.0; 1.0[ verify(Algorithm, DigestType, Msg, Signature, Key) -> boolean() + verify(Algorithm, DigestType, Msg, Signature, Key, Options) -> boolean() Verifies a digital signature. Algorithm = rsa | dss | ecdsa Msg = binary() | {digest,binary()} The msg is either the binary "cleartext" data or it is the hashed value of "cleartext" i.e. the digest (plaintext). - DigestType = digest_type() + DigestType = rsa_digest_type() | dss_digest_type() | ecdsa_digest_type() Signature = binary() Key = rsa_public() | dss_public() | [ecdh_public(),ecdh_params()] + Options = sign_options()

Verifies a digital signature

-- cgit v1.2.3