提交 12084778 编写于 作者: V valeriep

7169496: Problem with the SHA-224 support for SunMSCAPI provider

Summary: Remove SHA224withRSA signature from SunMSCAPI provider due to lack of windows support.
Reviewed-by: vinnie
上级 d35d3692
......@@ -47,7 +47,6 @@ import sun.security.rsa.RSAKeyFactory;
*
* . "NONEwithRSA"
* . "SHA1withRSA"
* . "SHA224withRSA"
* . "SHA256withRSA"
* . "SHA384withRSA"
* . "SHA512withRSA"
......@@ -58,7 +57,7 @@ import sun.security.rsa.RSAKeyFactory;
*
* NOTE: NONEwithRSA must be supplied with a pre-computed message digest.
* Only the following digest algorithms are supported: MD5, SHA-1,
* SHA-224, SHA-256, SHA-384, SHA-512 and a special-purpose digest
* SHA-256, SHA-384, SHA-512 and a special-purpose digest
* algorithm which is a concatenation of SHA-1 and MD5 digests.
*
* @since 1.6
......@@ -181,8 +180,6 @@ abstract class RSASignature extends java.security.SignatureSpi
setDigestName("SHA-512");
} else if (offset == 16) {
setDigestName("MD5");
} else if (offset == 28) {
setDigestName("SHA-224");
} else {
throw new SignatureException(
"Message digest length is not supported");
......@@ -202,12 +199,6 @@ abstract class RSASignature extends java.security.SignatureSpi
}
}
public static final class SHA224 extends RSASignature {
public SHA224() {
super("SHA-224");
}
}
public static final class SHA256 extends RSASignature {
public SHA256() {
super("SHA-256");
......
......@@ -81,16 +81,12 @@ public final class SunMSCAPI extends Provider {
*/
// NONEwithRSA must be supplied with a pre-computed message digest.
// Only the following digest algorithms are supported: MD5, SHA-1,
// SHA-224, SHA-256, SHA-384, SHA-512 and a special-purpose digest
// SHA-256, SHA-384, SHA-512 and a special-purpose digest
// algorithm which is a concatenation of SHA-1 and MD5 digests.
map.put("Signature.NONEwithRSA",
"sun.security.mscapi.RSASignature$Raw");
map.put("Signature.SHA1withRSA",
"sun.security.mscapi.RSASignature$SHA1");
map.put("Signature.SHA224withRSA",
"sun.security.mscapi.RSASignature$SHA224");
map.put("Alg.Alias.Signature.1.2.840.113549.1.1.14", "SHA224withRSA");
map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.14", "SHA224withRSA");
map.put("Signature.SHA256withRSA",
"sun.security.mscapi.RSASignature$SHA256");
map.put("Alg.Alias.Signature.1.2.840.113549.1.1.11", "SHA256withRSA");
......@@ -115,8 +111,6 @@ public final class SunMSCAPI extends Provider {
"sun.security.mscapi.Key");
map.put("Signature.SHA1withRSA SupportedKeyClasses",
"sun.security.mscapi.Key");
map.put("Signature.SHA224withRSA SupportedKeyClasses",
"sun.security.mscapi.Key");
map.put("Signature.SHA256withRSA SupportedKeyClasses",
"sun.security.mscapi.Key");
map.put("Signature.SHA384withRSA SupportedKeyClasses",
......
......@@ -48,12 +48,6 @@ public class SignUsingNONEwithRSA {
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30,
0x31, 0x32, 0x33, 0x34, 0x35, 0x36
},
// A SHA-224 hash
new byte[] {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10,
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x20,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28
},
// A SHA-256 hash
new byte[] {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10,
......
......@@ -78,16 +78,12 @@ public class SignUsingSHA2withRSA {
generatedSignatures.add(signUsing("SHA256withRSA", privateKey));
generatedSignatures.add(signUsing("SHA384withRSA", privateKey));
generatedSignatures.add(signUsing("SHA512withRSA", privateKey));
generatedSignatures.add(signUsing("SHA224withRSA", privateKey));
System.out.println("-------------------------------------------------");
verifyUsing("SHA256withRSA", publicKey, generatedSignatures.get(0));
verifyUsing("SHA384withRSA", publicKey, generatedSignatures.get(1));
verifyUsing("SHA512withRSA", publicKey, generatedSignatures.get(2));
verifyUsing("SHA224withRSA", publicKey, generatedSignatures.get(3));
System.out.println("-------------------------------------------------");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册