harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r448816 [2/2] - in /incubator/harmony/enhanced/classlib/trunk/modules: security/src/main/java/common/org/apache/harmony/security/x509/ security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/ tools/src/main/java/org/apac...
Date Fri, 22 Sep 2006 05:13:08 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CRLImplTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CRLImplTest.java?view=diff&rev=448816&r1=448815&r2=448816
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CRLImplTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CRLImplTest.java
Thu Sep 21 22:13:07 2006
@@ -48,11 +48,14 @@
 import org.apache.harmony.security.x509.AlgorithmIdentifier;
 import org.apache.harmony.security.x509.AuthorityKeyIdentifier;
 import org.apache.harmony.security.x509.Certificate;
+import org.apache.harmony.security.x509.CertificateIssuer;
 import org.apache.harmony.security.x509.CertificateList;
 import org.apache.harmony.security.x509.Extension;
 import org.apache.harmony.security.x509.Extensions;
 import org.apache.harmony.security.x509.GeneralName;
 import org.apache.harmony.security.x509.GeneralNames;
+import org.apache.harmony.security.x509.InvalidityDate;
+import org.apache.harmony.security.x509.ReasonCode;
 import org.apache.harmony.security.x509.SubjectPublicKeyInfo;
 import org.apache.harmony.security.x509.TBSCertList;
 import org.apache.harmony.security.x509.TBSCertificate;
@@ -90,11 +93,13 @@
     private static Extensions crlEntryExtensions = new Extensions();
     static {
         // Reason Code
-        crlEntryExtensions.addExtension(new Extension.ReasonCode(1));
+        crlEntryExtensions.addExtension(
+                new Extension("2.5.29.21", Extension.NON_CRITICAL,
+                    new ReasonCode(ReasonCode.KEY_COMPROMISE)));
         // Invalidity Date Extension
         crlEntryExtensions.addExtension(
-                new Extension.InvalidityDate(new Date())
-                );
+                new Extension("2.5.29.24", Extension.NON_CRITICAL,
+                    new InvalidityDate(new Date())));
         // add the Certificate Issuer Extension to check if implementation
         // support indirect CRLs. As says rfc 3280 (p.62):
         // "If used by conforming CRL issuers, this extension MUST always be
@@ -103,9 +108,10 @@
         // RECOMMENDS that implementations recognize this extension."
         try {
             crlEntryExtensions.addExtension(
-                        new Extension.CertificateIssuer(
+                    new Extension("2.5.29.29", true,
+                        new CertificateIssuer(
                             new GeneralName(new Name(certIssuerName))
-                            )
+                            ))
             );
         } catch (Exception e) {
             e.printStackTrace();
@@ -132,14 +138,17 @@
                             ASN1Integer.getInstance().encode(
                                 BigInteger.valueOf(4444).toByteArray())),
                     // Authority Key Identifier
-                    new Extension.AuthKeyId(
+                    new Extension("2.5.29.35", false, 
                         new AuthorityKeyIdentifier(
-                            new byte[] {1, 2, 3, 4, 5}, // keyIdentifier (random value)
-                            new GeneralNames(Arrays.asList(new GeneralName[] {
-                                new GeneralName(new Name(certIssuerName))
-                            })), // authorityCertIssuer
-                            certSerialNumber2 // authorityCertSerialNumber
-                            ))
+                            // keyIdentifier (random value)
+                            new byte[] {1, 2, 3, 4, 5},
+                            // authorityCertIssuer
+                            new GeneralNames(
+                                Arrays.asList(new GeneralName[] {
+                                    new GeneralName(new Name(certIssuerName))
+                            })), 
+                            // authorityCertSerialNumber
+                            certSerialNumber2)),
                 }));
         } catch (Exception e) {
             e.printStackTrace();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CertFactoryPerfTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CertFactoryPerfTest.java?view=diff&rev=448816&r1=448815&r2=448816
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CertFactoryPerfTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CertFactoryPerfTest.java
Thu Sep 21 22:13:07 2006
@@ -153,31 +153,23 @@
                 ASN1BitString.getInstance()
                 .encode(new BitString(extnKeyUsage))),  
         // Basic Constraints    
-        new Extension("2.5.29.19", true, 
-                Extension.BasicConstraints.ASN1.encode(
-                    new Object[] 
-                    {Boolean.TRUE, BigInteger.valueOf(extnBCLen)})),
+        new Extension("2.5.29.19", true, new BasicConstraints(true, extnBCLen)),
         // Certificate Policies with ANY policy
         new Extension("2.5.29.32", true, 
-                new CertificatePolicies(Arrays.asList(new Object[] {
-                    new PolicyInformation("2.5.29.32.0")}))
-                .getEncoded()),//extValEncoding),
+                new CertificatePolicies()
+                .addPolicyInformation(new PolicyInformation("2.5.29.32.0"))),
         // Subject Alternative Name
         new Extension("2.5.29.17", true, 
-                GeneralNames.ASN1.encode(extnSANames)),
+                new AlternativeName(AlternativeName.SUBJECT, extnSANames)),
         // Name Constraints
         new Extension("2.5.29.30", true, 
                 new NameConstraints().getEncoded()),
         // Policy Constraints
-        new Extension("2.5.29.36", true, 
-                new PolicyConstraints().getEncoded()),
+        new Extension("2.5.29.36", true, new PolicyConstraints(1, 2)),
         // Extended Key Usage
-        new Extension("2.5.29.37", true, 
-                Extension.ExtendedKeyUsage.ASN1.encode(
-                    extnExtendedKeyUsage)),             
+        new Extension("2.5.29.37", true, new ExtendedKeyUsage(extnExtendedKeyUsage)),
         // Inhibit Any-Policy
-        new Extension("2.5.29.54", true,
-                ASN1Integer.getInstance().encode(ASN1Integer.fromIntValue(1))),
+        new Extension("2.5.29.54", true, new InhibitAnyPolicy(1)),
 
         // Unsupported critical extensions:
         new Extension("1.2.77.777", true, extValEncoding),
@@ -187,7 +179,7 @@
  
         // Issuer Alternative Name
         new Extension("2.5.29.18", false, 
-                GeneralNames.ASN1.encode(extnSANames)),
+                new AlternativeName(AlternativeName.ISSUER, extnSANames)),
         // CRL Distribution Points
         new Extension("2.5.29.31", false, 
                 new ASN1Sequence(new ASN1Type[] {}) {
@@ -195,9 +187,14 @@
                     }
                 }.encode(null)),
         // Authority Key Identifier
-        new Extension("2.5.29.35", false, extValEncoding),
+        new Extension("2.5.29.35", false, 
+                new AuthorityKeyIdentifier(
+                    // random value for key identifier
+                    new byte[] {1, 2, 3, 4, 5}, extnSANames, serialNumber)),
         // Subject Key Identifier
-        new Extension("2.5.29.14", false, extValEncoding),
+        new Extension("2.5.29.14", false,
+                // random value for key identifier
+                new SubjectKeyIdentifier(new byte[] {1, 2, 3, 4, 5})),
         // Policy Mappings
         new Extension("2.5.29.33", false, extValEncoding),
     };

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CertImplTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CertImplTest.java?view=diff&rev=448816&r1=448815&r2=448816
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CertImplTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/test/impl/java/org/apache/harmony/security/tests/provider/cert/X509CertImplTest.java
Thu Sep 21 22:13:07 2006
@@ -150,35 +150,25 @@
         // Supported critical extensions (as specified in rfc 3280
         // http://www.ietf.org/rfc/rfc3280.txt):
         // Key Usage
-        new Extension("2.5.29.15", true, 
-                ASN1BitString.getInstance()
-                .encode(new BitString(extnKeyUsage))),  
+        new Extension("2.5.29.15", true, new KeyUsage(extnKeyUsage)),
         // Basic Constraints    
-        new Extension("2.5.29.19", true, 
-                Extension.BasicConstraints.ASN1.encode(
-                    new Object[] 
-                    {Boolean.TRUE, BigInteger.valueOf(extnBCLen)})),
+        new Extension("2.5.29.19", true, new BasicConstraints(true, extnBCLen)),
         // Certificate Policies with ANY policy
         new Extension("2.5.29.32", true, 
-                new CertificatePolicies(Arrays.asList(new Object[] {
-                    new PolicyInformation("2.5.29.32.0")}))
-                .getEncoded()),//extValEncoding),
+                new CertificatePolicies()
+                .addPolicyInformation(new PolicyInformation("2.5.29.32.0"))),
         // Subject Alternative Name
         new Extension("2.5.29.17", true, 
-                GeneralNames.ASN1.encode(extnSANames)),
+                new AlternativeName(AlternativeName.SUBJECT, extnSANames)),
         // Name Constraints
         new Extension("2.5.29.30", true, 
                 new NameConstraints().getEncoded()),
         // Policy Constraints
-        new Extension("2.5.29.36", true, 
-                new PolicyConstraints().getEncoded()),
+        new Extension("2.5.29.36", true, new PolicyConstraints(1, 2)),
         // Extended Key Usage
-        new Extension("2.5.29.37", true, 
-                Extension.ExtendedKeyUsage.ASN1.encode(
-                    extnExtendedKeyUsage)),             
+        new Extension("2.5.29.37", true, new ExtendedKeyUsage(extnExtendedKeyUsage)),
         // Inhibit Any-Policy
-        new Extension("2.5.29.54", true,
-                ASN1Integer.getInstance().encode(ASN1Integer.fromIntValue(1))),
+        new Extension("2.5.29.54", true, new InhibitAnyPolicy(1)),
 
 
         // Unsupported critical extensions:
@@ -190,7 +180,7 @@
  
         // Issuer Alternative Name
         new Extension("2.5.29.18", false, 
-                GeneralNames.ASN1.encode(extnSANames)),
+                new AlternativeName(AlternativeName.ISSUER, extnSANames)),
         // CRL Distribution Points
         new Extension("2.5.29.31", false, 
                 new ASN1Sequence(new ASN1Type[] {}) {
@@ -198,9 +188,14 @@
                     }
                 }.encode(null)),
         // Authority Key Identifier
-        new Extension("2.5.29.35", false, extValEncoding),
+        new Extension("2.5.29.35", false, 
+                new AuthorityKeyIdentifier(
+                    // random value for key identifier
+                    new byte[] {1, 2, 3, 4, 5}, extnSANames, serialNumber)),
         // Subject Key Identifier
-        new Extension("2.5.29.14", false, extValEncoding),
+        new Extension("2.5.29.14", false,
+                // random value for key identifier
+                new SubjectKeyIdentifier(new byte[] {1, 2, 3, 4, 5})),
         // Policy Mappings
         new Extension("2.5.29.33", false, extValEncoding),
     };
@@ -237,7 +232,7 @@
         keyEncoding = subjectPublicKeyInfo.getEncoded();
 
         Extensions exts = new Extensions(Arrays.asList(extensions));
-        
+       
         TBSCertificate tbsCertificate = 
             new TBSCertificate(version, serialNumber, 
                 signature, issuer, validity, subject, subjectPublicKeyInfo, 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/keytool/KeyCertGenerator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/keytool/KeyCertGenerator.java?view=diff&rev=448816&r1=448815&r2=448816
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/keytool/KeyCertGenerator.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/tools/src/main/java/org/apache/harmony/tools/keytool/KeyCertGenerator.java
Thu Sep 21 22:13:07 2006
@@ -46,6 +46,7 @@
 import org.apache.harmony.security.provider.cert.X509CertImpl;
 import org.apache.harmony.security.x501.Name;
 import org.apache.harmony.security.x509.AlgorithmIdentifier;
+import org.apache.harmony.security.x509.BasicConstraints;
 import org.apache.harmony.security.x509.Extension;
 import org.apache.harmony.security.x509.Extensions;
 import org.apache.harmony.security.x509.SubjectPublicKeyInfo;
@@ -434,12 +435,9 @@
         
         if (version == 1 || version == 2) {
             // generate extensions
-            ArrayList<Object> basicConstraints = new ArrayList<Object>(2);
-            basicConstraints.add(new Boolean(isCA));
-            basicConstraints.add(BigInteger.valueOf(Integer.MAX_VALUE));
             extensions = new Extensions(Collections
-                    .singletonList(new Extension.BasicConstraints(
-                            basicConstraints, false)));
+                    .singletonList(new Extension("2.5.29.19", false,
+                            new BasicConstraints(isCA, Integer.MAX_VALUE))));
         }       
         // generate the TBSCertificate to put it into the X.509 cert
         TBSCertificate tbsCertificate = new TBSCertificate(



Mime
View raw message