diff options
author | Henrik Nord <[email protected]> | 2011-09-20 11:19:21 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-09-20 11:19:21 +0200 |
commit | ec36499d7e329b4dc69a1a3be3422eac7907c260 (patch) | |
tree | 3fae5bd47f85aa8a3ac40519b2328c4451a00c18 /lib/public_key/src | |
parent | 532c72b3ffeb9219bdb7e6a7f5d21fe26f0f0629 (diff) | |
parent | 53cf0b70c705e0bf6c09f83f2ce2709d79593ce6 (diff) | |
download | otp-ec36499d7e329b4dc69a1a3be3422eac7907c260.tar.gz otp-ec36499d7e329b4dc69a1a3be3422eac7907c260.tar.bz2 otp-ec36499d7e329b4dc69a1a3be3422eac7907c260.zip |
Merge branch 'dev' into major
Conflicts:
erts/aclocal.m4
erts/include/internal/ethread_header_config.h.in
Diffstat (limited to 'lib/public_key/src')
-rw-r--r-- | lib/public_key/src/pubkey_cert.erl | 4 | ||||
-rw-r--r-- | lib/public_key/src/public_key.erl | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/public_key/src/pubkey_cert.erl b/lib/public_key/src/pubkey_cert.erl index 5ab9642279..61082a1ec5 100644 --- a/lib/public_key/src/pubkey_cert.erl +++ b/lib/public_key/src/pubkey_cert.erl @@ -38,7 +38,7 @@ %%==================================================================== %%-------------------------------------------------------------------- --spec verify_data(DER::binary()) -> {md5 | sha, binary(), binary()}. +-spec verify_data(DER::binary()) -> {md2 | md5 | sha, binary(), binary()}. %% %% Description: Extracts data from DerCert needed to call public_key:verify/4. %%-------------------------------------------------------------------- @@ -378,6 +378,8 @@ digest_type(?sha1WithRSAEncryption) -> sha; digest_type(?md5WithRSAEncryption) -> md5; +digest_type(?md2WithRSAEncryption) -> + md2; digest_type(?'id-dsa-with-sha1') -> sha. diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl index 33fcce2c44..940efffcd0 100644 --- a/lib/public_key/src/public_key.erl +++ b/lib/public_key/src/public_key.erl @@ -55,7 +55,7 @@ -type rsa_padding() :: 'rsa_pkcs1_padding' | 'rsa_pkcs1_oaep_padding' | 'rsa_no_padding'. -type public_crypt_options() :: [{rsa_pad, rsa_padding()}]. --type rsa_digest_type() :: 'md5' | 'sha'. +-type rsa_digest_type() :: 'md2' | 'md5' | 'sha'. -type dss_digest_type() :: 'none' | 'sha'. -define(UINT32(X), X:32/unsigned-big-integer). @@ -307,7 +307,8 @@ encrypt_private(PlainText, #'RSAPrivateKey'{modulus = N, sign(PlainText, DigestType, #'RSAPrivateKey'{modulus = N, publicExponent = E, privateExponent = D}) when is_binary(PlainText), - (DigestType == md5 orelse + (DigestType == md2 orelse + DigestType == md5 orelse DigestType == sha) -> crypto:rsa_sign(DigestType, sized_binary(PlainText), [crypto:mpint(E), @@ -335,7 +336,10 @@ sign(PlainText, sha, #'DSAPrivateKey'{p = P, q = Q, g = G, x = X}) %%-------------------------------------------------------------------- verify(PlainText, DigestType, Signature, #'RSAPublicKey'{modulus = Mod, publicExponent = Exp}) - when is_binary (PlainText), DigestType == sha; DigestType == md5 -> + when is_binary(PlainText), + (DigestType == md2 orelse + DigestType == md5 orelse + DigestType == sha) -> crypto:rsa_verify(DigestType, sized_binary(PlainText), sized_binary(Signature), |