summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape
diff options
context:
space:
mode:
authorcfu <cfu@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2009-08-26 00:43:35 +0000
committercfu <cfu@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2009-08-26 00:43:35 +0000
commitf729d07c3e7b5f5ef6ef9ee8580dfeac29800155 (patch)
treee66dde622d4b248959edb234655ade472e2b96e8 /pki/base/util/src/netscape
parent57dde40ba0b2d6ef9616b77db090ec58512d78e4 (diff)
downloadpki-f729d07c3e7b5f5ef6ef9ee8580dfeac29800155.tar.gz
pki-f729d07c3e7b5f5ef6ef9ee8580dfeac29800155.tar.xz
pki-f729d07c3e7b5f5ef6ef9ee8580dfeac29800155.zip
Bugzilla Bug #465507 - Enhancement: Support SHA2 + EC signature algorithms
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@777 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/util/src/netscape')
-rw-r--r--pki/base/util/src/netscape/security/pkcs/PKCS10.java6
-rw-r--r--pki/base/util/src/netscape/security/x509/AlgorithmId.java37
2 files changed, 41 insertions, 2 deletions
diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS10.java b/pki/base/util/src/netscape/security/pkcs/PKCS10.java
index 52725dd16..c07edbc2e 100644
--- a/pki/base/util/src/netscape/security/pkcs/PKCS10.java
+++ b/pki/base/util/src/netscape/security/pkcs/PKCS10.java
@@ -186,6 +186,12 @@ public class PKCS10
idName = "SHA1/DSA";
else if(idName.equals("SHA1withEC"))
idName = "SHA1/EC";
+ else if(idName.equals("SHA256withEC"))
+ idName = "SHA256/EC";
+ else if(idName.equals("SHA384withEC"))
+ idName = "SHA384/EC";
+ else if(idName.equals("SHA512withEC"))
+ idName = "SHA512/EC";
if (sigver) {
sig = Signature.getInstance(idName,"Mozilla-JSS");
diff --git a/pki/base/util/src/netscape/security/x509/AlgorithmId.java b/pki/base/util/src/netscape/security/x509/AlgorithmId.java
index 28f6fa494..e01049e73 100644
--- a/pki/base/util/src/netscape/security/x509/AlgorithmId.java
+++ b/pki/base/util/src/netscape/security/x509/AlgorithmId.java
@@ -311,6 +311,15 @@ public class AlgorithmId implements Serializable, DerEncoder {
if (name.equals ("SHA1withEC") || name.equals("SHA1/EC")
|| name.equals("1.2.840.10045.4.1"))
return AlgorithmId.sha1WithEC_oid;
+ if (name.equals ("SHA256withEC") || name.equals("SHA256/EC")
+ || name.equals("1.2.840.10045.4.3.2"))
+ return AlgorithmId.sha256WithEC_oid;
+ if (name.equals ("SHA384withEC") || name.equals("SHA384/EC")
+ || name.equals("1.2.840.10045.4.3.3"))
+ return AlgorithmId.sha384WithEC_oid;
+ if (name.equals ("SHA512withEC") || name.equals("SHA512/EC")
+ || name.equals("1.2.840.10045.4.3.4"))
+ return AlgorithmId.sha512WithEC_oid;
if (name.equals ("SHA1withRSA") || name.equals("SHA1/RSA")
|| name.equals("1.2.840.113549.1.1.5"))
return AlgorithmId.sha1WithRSAEncryption_oid;
@@ -374,6 +383,12 @@ public class AlgorithmId implements Serializable, DerEncoder {
if (algid.equals (AlgorithmId.sha1WithEC_oid))
return "SHA1withEC";
+ if (algid.equals (AlgorithmId.sha256WithEC_oid))
+ return "SHA256withEC";
+ if (algid.equals (AlgorithmId.sha384WithEC_oid))
+ return "SHA384withEC";
+ if (algid.equals (AlgorithmId.sha512WithEC_oid))
+ return "SHA512withEC";
if (algid.equals (AlgorithmId.md5WithRSAEncryption_oid))
return "MD5withRSA";
if (algid.equals (AlgorithmId.md2WithRSAEncryption_oid))
@@ -630,6 +645,12 @@ public class AlgorithmId implements Serializable, DerEncoder {
*/
private static final int sha1WithEC_data[] =
{ 1, 2, 840, 10045, 4, 1 };
+ private static final int sha256WithEC_data[] =
+ { 1, 2, 840, 10045, 4, 3, 2 };
+ private static final int sha384WithEC_data[] =
+ { 1, 2, 840, 10045, 4, 3, 3 };
+ private static final int sha512WithEC_data[] =
+ { 1, 2, 840, 10045, 4, 3, 4 };
private static final int md2WithRSAEncryption_data[] =
{ 1, 2, 840, 113549, 1, 1, 2 };
private static final int md5WithRSAEncryption_data[] =
@@ -653,6 +674,18 @@ public class AlgorithmId implements Serializable, DerEncoder {
sha1WithEC_oid = new
ObjectIdentifier(sha1WithEC_data);
+ public static final ObjectIdentifier
+ sha256WithEC_oid = new
+ ObjectIdentifier(sha256WithEC_data);
+
+ public static final ObjectIdentifier
+ sha384WithEC_oid = new
+ ObjectIdentifier(sha384WithEC_data);
+
+ public static final ObjectIdentifier
+ sha512WithEC_oid = new
+ ObjectIdentifier(sha512WithEC_data);
+
/**
* Identifies a signing algorithm where an MD2 digest is encrypted
* using an RSA private key; defined in PKCS #1. Use of this
@@ -740,12 +773,12 @@ public class AlgorithmId implements Serializable, DerEncoder {
{ "SHA1withRSA", "SHA256withRSA", "SHA512withRSA", "MD5withRSA", "MD2withRSA" };
public static final String[] EC_SIGNING_ALGORITHMS = new String[]
- { "SHA1withEC" };
+ { "SHA1withEC", "SHA256withEC", "SHA384withEC", "SHA512withEC" };
/**
* All supported signing algorithms.
*/
public static final String[] ALL_SIGNING_ALGORITHMS = new String[]
- { "SHA1withRSA", "MD5withRSA", "MD2withRSA", "SHA1withDSA", "SHA256withRSA", "SHA512withRSA", "SHA1withEC" };
+ { "SHA1withRSA", "MD5withRSA", "MD2withRSA", "SHA1withDSA", "SHA256withRSA", "SHA512withRSA", "SHA1withEC", "SHA256withEC", "SHA384withEC", "SHA512withEC" };
}