diff options
author | Christian von Roques <[email protected]> | 2011-09-06 19:28:21 +0200 |
---|---|---|
committer | Christian von Roques <[email protected]> | 2011-09-06 19:45:11 +0200 |
commit | c7e5f7576e213060cbb332be64a7c3798f6a2cc2 (patch) | |
tree | aefc9a5754b468d12c8ed01d653ef0a5807c22bb /lib/public_key/src/public_key.erl | |
parent | 82897cc8f399fab832148711b586215c9a3f7af1 (diff) | |
download | otp-c7e5f7576e213060cbb332be64a7c3798f6a2cc2.tar.gz otp-c7e5f7576e213060cbb332be64a7c3798f6a2cc2.tar.bz2 otp-c7e5f7576e213060cbb332be64a7c3798f6a2cc2.zip |
Support md2WithRSAEncryption certificates in public_key
Diffstat (limited to 'lib/public_key/src/public_key.erl')
-rw-r--r-- | lib/public_key/src/public_key.erl | 10 |
1 files changed, 7 insertions, 3 deletions
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), |