aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/test
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2011-09-20 10:32:59 +0200
committerHenrik Nord <[email protected]>2011-09-20 10:33:04 +0200
commit4b18ef90369c52a9344b851025519f397ccb8543 (patch)
tree59190f15bee6d38bcd9ca54974a429129c51aa1c /lib/crypto/test
parent5b3f4c143cf7c9cd32437bfc9882f6ceb960648e (diff)
parent6cd2fa9346d51ab936873d96b5c96bf5c15ddcf0 (diff)
downloadotp-4b18ef90369c52a9344b851025519f397ccb8543.tar.gz
otp-4b18ef90369c52a9344b851025519f397ccb8543.tar.bz2
otp-4b18ef90369c52a9344b851025519f397ccb8543.zip
Merge branch 'cr/md2-With-RSA-Encryption' into dev
* cr/md2-With-RSA-Encryption: Document crypto:sha_mac_96/2 to compute an SHA MAC, not MD5 Support md2WithRSAEncryption certificates in public_key Support 'md2' hash in crypto:rsa_sign/3 and crypto:rsa_verify/4 OTP-9554
Diffstat (limited to 'lib/crypto/test')
-rw-r--r--lib/crypto/test/crypto_SUITE.erl30
1 files changed, 22 insertions, 8 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 8d2f42469b..2fa058c852 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -1082,16 +1082,30 @@ rsa_sign_test(Config) when is_list(Config) ->
PrivKey = [crypto:mpint(PubEx), crypto:mpint(Mod), crypto:mpint(PrivEx)],
PubKey = [crypto:mpint(PubEx), crypto:mpint(Mod)],
- ?line Sig1 = crypto:rsa_sign(sized_binary(Msg), PrivKey),
- ?line m(crypto:rsa_verify(sized_binary(Msg), sized_binary(Sig1),PubKey), true),
+ ?line Sig = crypto:rsa_sign(sized_binary(Msg), PrivKey),
+ ?line m(crypto:rsa_verify(sized_binary(Msg), sized_binary(Sig),PubKey), true),
- ?line Sig2 = crypto:rsa_sign(md5, sized_binary(Msg), PrivKey),
- ?line m(crypto:rsa_verify(md5, sized_binary(Msg), sized_binary(Sig2),PubKey), true),
-
- ?line m(Sig1 =:= Sig2, false),
- ?line m(crypto:rsa_verify(md5, sized_binary(Msg), sized_binary(Sig1),PubKey), false),
- ?line m(crypto:rsa_verify(sha, sized_binary(Msg), sized_binary(Sig1),PubKey), true),
+ ?line Sig_md2 = crypto:rsa_sign(md2, sized_binary(Msg), PrivKey),
+ ?line Sig_md5 = crypto:rsa_sign(md5, sized_binary(Msg), PrivKey),
+ ?line Sig_sha = crypto:rsa_sign(sha, sized_binary(Msg), PrivKey),
+
+ ?line m(Sig =:= Sig_sha, true),
+ ?line m(Sig_md2 =:= Sig_md5, false),
+ ?line m(Sig_md2 =:= Sig_sha, false),
+ ?line m(Sig_md5 =:= Sig_sha, false),
+ ?line m(crypto:rsa_verify(md2, sized_binary(Msg), sized_binary(Sig_md2),PubKey), true),
+ ?line m(crypto:rsa_verify(md2, sized_binary(Msg), sized_binary(Sig_md5),PubKey), false),
+ ?line m(crypto:rsa_verify(md2, sized_binary(Msg), sized_binary(Sig_sha),PubKey), false),
+
+ ?line m(crypto:rsa_verify(md5, sized_binary(Msg), sized_binary(Sig_md2),PubKey), false),
+ ?line m(crypto:rsa_verify(md5, sized_binary(Msg), sized_binary(Sig_md5),PubKey), true),
+ ?line m(crypto:rsa_verify(md5, sized_binary(Msg), sized_binary(Sig_sha),PubKey), false),
+
+ ?line m(crypto:rsa_verify(sha, sized_binary(Msg), sized_binary(Sig_md2),PubKey), false),
+ ?line m(crypto:rsa_verify(sha, sized_binary(Msg), sized_binary(Sig_md5),PubKey), false),
+ ?line m(crypto:rsa_verify(sha, sized_binary(Msg), sized_binary(Sig_sha),PubKey), true),
+
ok.
dsa_sign_test(doc) ->