2003/06/16 08:03:14
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:01:14 +0000 (07:01 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:01:14 +0000 (07:01 +0000)
darcs-hash:20040130070114-2ba56-708a2dc0f9255d6237c89e2a00ce16a34eec559c.gz

13 files changed:
src/org/bouncycastle/asn1/cms/Attribute.java
src/org/bouncycastle/asn1/pkcs/PKCSObjectIdentifiers.java
src/org/bouncycastle/asn1/x509/AlgorithmIdentifier.java
src/org/bouncycastle/asn1/x509/AuthorityKeyIdentifier.java
src/org/bouncycastle/asn1/x509/BasicConstraints.java
src/org/bouncycastle/asn1/x509/CRLDistPoint.java
src/org/bouncycastle/asn1/x509/GeneralName.java
src/org/bouncycastle/asn1/x509/SubjectKeyIdentifier.java
src/org/bouncycastle/asn1/x509/V2TBSCertListGenerator.java
src/org/bouncycastle/asn1/x509/X509CertificateStructure.java
src/org/bouncycastle/asn1/x509/X509Name.java
src/org/bouncycastle/asn1/x509/X509ObjectIdentifiers.java
src/org/bouncycastle/crypto/Digest.java

index 0763ea2..899ced2 100644 (file)
@@ -5,8 +5,8 @@ import org.bouncycastle.asn1.*;
 public class Attribute
     implements DEREncodable
 {
-       private DERObjectIdentifier attrType;
-       private ASN1Set             attrValues;
+        private DERObjectIdentifier attrType;
+        private ASN1Set             attrValues;
 
     /**
      * return an Attribute object from the given object.
@@ -14,62 +14,62 @@ public class Attribute
      * @param o the object we want converted.
      * @exception IllegalArgumentException if the object cannot be converted.
      */
-       public static Attribute getInstance(
+        public static Attribute getInstance(
         Object o)
     {
-               if (o == null || o instanceof Attribute)
+                if (o == null || o instanceof Attribute)
         {
-                       return (Attribute)o;
-               }
-               
-               if (o instanceof ASN1Sequence)
+                        return (Attribute)o;
+                }
+                
+                if (o instanceof ASN1Sequence)
         {
-                       return new Attribute((ASN1Sequence)o);
-               }
+                        return new Attribute((ASN1Sequence)o);
+                }
 
         throw new IllegalArgumentException("unknown object in factory");
-       }
-       
-       public Attribute(
+        }
+        
+        public Attribute(
         ASN1Sequence seq)
     {
-               attrType = (DERObjectIdentifier)seq.getObjectAt(0);
-               attrValues = (ASN1Set)seq.getObjectAt(1);
-       }
+                attrType = (DERObjectIdentifier)seq.getObjectAt(0);
+                attrValues = (ASN1Set)seq.getObjectAt(1);
+        }
 
-       public Attribute(
-           DERObjectIdentifier attrType,
-           ASN1Set             attrValues)
+        public Attribute(
+            DERObjectIdentifier attrType,
+            ASN1Set             attrValues)
     {
-               this.attrType = attrType;
-               this.attrValues = attrValues;
-       }
+                this.attrType = attrType;
+                this.attrValues = attrValues;
+        }
 
-       public DERObjectIdentifier getAttrType()
+        public DERObjectIdentifier getAttrType()
     {
-               return attrType;
-       }
-       
-       public ASN1Set getAttrValues()
+                return attrType;
+        }
+        
+        public ASN1Set getAttrValues()
     {
-               return attrValues;
-       }
+                return attrValues;
+        }
 
     /** 
      * <pre>
      * Attribute ::= SEQUENCE {
-     *         attrType OBJECT IDENTIFIER,
-     *         attrValues SET OF AttributeValue
+     *  attrType OBJECT IDENTIFIER,
+     *  attrValues SET OF AttributeValue
      * }
      * </pre>
      */
-       public DERObject getDERObject()
+        public DERObject getDERObject()
     {
-               DEREncodableVector v = new DEREncodableVector();
+                DEREncodableVector v = new DEREncodableVector();
 
-               v.add(attrType);
-               v.add(attrValues);
+                v.add(attrType);
+                v.add(attrValues);
 
-               return new DERSequence(v);
-       }
+                return new DERSequence(v);
+        }
 }
index 3977e9f..1898cd4 100644 (file)
@@ -109,17 +109,17 @@ public interface PKCSObjectIdentifiers
     // other SMIME attributes
     //
 
-       //
-       // id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
-       // rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}
-       //
-       static String id_aa = "1.2.840.113549.1.9.16.2";
-       
-       /*
-        * id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
-        * 
-        */
-       static DERObjectIdentifier id_aa_encrypKeyPref = new DERObjectIdentifier(id_aa + ".11");
+        //
+        // id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
+        // rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}
+        //
+        static String id_aa = "1.2.840.113549.1.9.16.2";
+        
+        /*
+         * id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
+         * 
+         */
+        static DERObjectIdentifier id_aa_encrypKeyPref = new DERObjectIdentifier(id_aa + ".11");
 
     //
     // pkcs-12 OBJECT IDENTIFIER ::= {
index 945f948..645858f 100644 (file)
@@ -11,7 +11,7 @@ public class AlgorithmIdentifier
     private DERObjectIdentifier objectId;
     private DEREncodable        parameters;
     private boolean             parametersDefined = false;
-       
+        
     public static AlgorithmIdentifier getInstance(
         ASN1TaggedObject obj,
         boolean          explicit)
index d15309d..9708e7d 100644 (file)
@@ -49,7 +49,7 @@ public class AuthorityKeyIdentifier
 
         throw new IllegalArgumentException("unknown object in factory");
     }
-       
+        
     public AuthorityKeyIdentifier(
         ASN1Sequence   seq)
     {
index b798ea8..7c32256 100644 (file)
@@ -31,7 +31,7 @@ public class BasicConstraints
 
         throw new IllegalArgumentException("unknown object in factory");
     }
-       
+        
     public BasicConstraints(
         ASN1Sequence   seq)
     {
index 11b347a..181a76c 100644 (file)
@@ -28,7 +28,7 @@ public class CRLDistPoint
 
         throw new IllegalArgumentException("unknown object in factory");
     }
-       
+        
     public CRLDistPoint(
         ASN1Sequence seq)
     {
index 1246f15..eee7e17 100644 (file)
@@ -27,9 +27,9 @@ import org.bouncycastle.asn1.*;
 public class GeneralName
     implements DEREncodable
 {
-    DEREncodable       obj;
-    int                tag;
-       boolean                 isInsideImplicit = false;               // if we are in an implicitly tagged object
+    DEREncodable        obj;
+    int                 tag;
+        boolean                 isInsideImplicit = false;               // if we are in an implicitly tagged object
 
     public GeneralName(
         X509Name  directoryName)
@@ -77,11 +77,11 @@ public class GeneralName
      * object.
      * @deprecated
      */
-       public void markInsideImplicit(
-               boolean         isInsideImplicit)
-       {
-               this.isInsideImplicit = isInsideImplicit;
-       }
+        public void markInsideImplicit(
+                boolean         isInsideImplicit)
+        {
+                this.isInsideImplicit = isInsideImplicit;
+        }
 
     public DERObject getDERObject()
     {
index 5d6ffd8..f12f9c2 100644 (file)
@@ -12,7 +12,7 @@ import org.bouncycastle.asn1.*;
 public class SubjectKeyIdentifier
     implements DEREncodable
 {
-       private byte[] keyidentifier;
+        private byte[] keyidentifier;
 
     public static SubjectKeyIdentifier getInstance(
         ASN1TaggedObject obj,
@@ -41,7 +41,7 @@ public class SubjectKeyIdentifier
         
         throw new IllegalArgumentException("Invalid SubjectKeyIdentifier: " + obj.getClass().getName());
     }
-       
+        
     public SubjectKeyIdentifier(
         byte[] keyid)
     {
@@ -51,27 +51,27 @@ public class SubjectKeyIdentifier
     public SubjectKeyIdentifier(
         ASN1OctetString  keyid)
     {
-               this.keyidentifier=keyid.getOctets();
+                this.keyidentifier=keyid.getOctets();
 
     }
 
-       /**
-        *
-        * Calulates the keyidentifier using a SHA1 hash over the BIT STRING
-        * from SubjectPublicKeyInfo as defined in RFC2459.
-        *
-        **/
-       public SubjectKeyIdentifier(
-               SubjectPublicKeyInfo    spki)
-       {
-               Digest  digest = new SHA1Digest();
-               byte[]  resBuf = new byte[digest.getDigestSize()];
+        /**
+         *
+         * Calulates the keyidentifier using a SHA1 hash over the BIT STRING
+         * from SubjectPublicKeyInfo as defined in RFC2459.
+         *
+         **/
+        public SubjectKeyIdentifier(
+                SubjectPublicKeyInfo    spki)
+        {
+                Digest  digest = new SHA1Digest();
+                byte[]  resBuf = new byte[digest.getDigestSize()];
 
-               byte[] bytes = spki.getPublicKeyData().getBytes();
-               digest.update(bytes, 0, bytes.length);
-               digest.doFinal(resBuf, 0);
-               this.keyidentifier=resBuf;
-       }
+                byte[] bytes = spki.getPublicKeyData().getBytes();
+                digest.update(bytes, 0, bytes.length);
+                digest.doFinal(resBuf, 0);
+                this.keyidentifier=resBuf;
+        }
 
     public byte[] getKeyIdentifier()
     {
index ab8f7b4..1260b2b 100644 (file)
@@ -98,7 +98,7 @@ public class V2TBSCertListGenerator
         DERConstructedSequence seq = new DERConstructedSequence();
         seq.addObject(userCertificate);
         seq.addObject(revocationDate);
-       
+        
         if (reason != 0)
         {
             CRLReason rf = new CRLReason(reason);
@@ -112,12 +112,12 @@ public class V2TBSCertListGenerator
             {
                 throw new IllegalArgumentException("error encoding value: " + e);
             }
-           byte[] value = bOut.toByteArray();
+            byte[] value = bOut.toByteArray();
             DERConstructedSequence eseq = new DERConstructedSequence();
             DERConstructedSequence eseq1 = new DERConstructedSequence();
             eseq1.addObject(X509Extensions.ReasonCode);
             eseq1.addObject(new DEROctetString(value));
-           eseq.addObject(eseq1);
+            eseq.addObject(eseq1);
             X509Extensions ex = new X509Extensions(eseq);
             seq.addObject(ex);
         }
index 54fc803..ed55485 100644 (file)
@@ -27,7 +27,7 @@ public class X509CertificateStructure
     {
         return getInstance(ASN1Sequence.getInstance(obj, explicit));
     }
-       
+        
     public static X509CertificateStructure getInstance(
         Object  obj)
     {
index 139bf09..359434c 100644 (file)
@@ -55,12 +55,12 @@ public class X509Name
      * note: if you're trying to be ultra orthodox, don't use this! It shouldn't be in here.
      */
     public static final DERObjectIdentifier EmailAddress = new DERObjectIdentifier("1.2.840.113549.1.9.1");
-       
-       /**
-        * email address in Verisign certificates
-        */
-       public static final DERObjectIdentifier E = EmailAddress;
-       
+        
+        /**
+         * email address in Verisign certificates
+         */
+        public static final DERObjectIdentifier E = EmailAddress;
+        
     /*
      * others...
      */
@@ -363,46 +363,46 @@ public class X509Name
 
         if (_orderingSize != _oxn.ordering.size()) 
         {
-                       return false;
-               }
-               
-               boolean[] _indexes = new boolean[_orderingSize];
-
-               for(int i = 0; i < _orderingSize; i++) 
-               {
-                       boolean _found = false;
-                       String  _oid   = ((DERObjectIdentifier)ordering.elementAt(i)).getId();
-                       String  _val   = (String)values.elementAt(i);
-                       
-                       for(int j = 0; j < _orderingSize; j++) 
-                       {
-                               if(_indexes[j] == true)
-                               {
-                                       continue;
-                               }
-                               
-                               String _oOID = ((DERObjectIdentifier)_oxn.ordering.elementAt(j)).getId();
-                               String _oVal = (String)_oxn.values.elementAt(j);
+                        return false;
+                }
+                
+                boolean[] _indexes = new boolean[_orderingSize];
+
+                for(int i = 0; i < _orderingSize; i++) 
+                {
+                        boolean _found = false;
+                        String  _oid   = ((DERObjectIdentifier)ordering.elementAt(i)).getId();
+                        String  _val   = (String)values.elementAt(i);
+                        
+                        for(int j = 0; j < _orderingSize; j++) 
+                        {
+                                if(_indexes[j] == true)
+                                {
+                                        continue;
+                                }
+                                
+                                String _oOID = ((DERObjectIdentifier)_oxn.ordering.elementAt(j)).getId();
+                                String _oVal = (String)_oxn.values.elementAt(j);
 
                 // was equalsIgnoreCase but MIDP doesn't like that.
-                               if(_oid.equals(_oOID) && _val.toLowerCase().equals(_oVal.toLowerCase()))
-                               {
-                                       _indexes[j] = true;
-                                       _found      = true;
-                                       break;
-                               }
-
-                       }
-
-                       if(!_found)
-                       {
-                               return false;
-                       }
-               }
-               
-               return true;
-       }
-       
+                                if(_oid.equals(_oOID) && _val.toLowerCase().equals(_oVal.toLowerCase()))
+                                {
+                                        _indexes[j] = true;
+                                        _found      = true;
+                                        break;
+                                }
+
+                        }
+
+                        if(!_found)
+                        {
+                                return false;
+                        }
+                }
+                
+                return true;
+        }
+        
     public int hashCode()
     {
         ASN1Sequence  seq = (ASN1Sequence)this.getDERObject();
index 18ce5c1..4424320 100644 (file)
@@ -33,6 +33,6 @@ public interface X509ObjectIdentifiers
     static final DERObjectIdentifier    ripemd160WithRSAEncryption = new DERObjectIdentifier("1.3.36.3.3.1.2");
 
 
-       static final DERObjectIdentifier        id_ea_rsa = new DERObjectIdentifier("2.5.8.1.1");
+        static final DERObjectIdentifier        id_ea_rsa = new DERObjectIdentifier("2.5.8.1.1");
 }
 
index 844c28b..8f062b7 100644 (file)
@@ -17,14 +17,14 @@ public interface Digest
      *
      * @return the size, in bytes, of the digest produced by this message digest.
      */
-       public int getDigestSize();
+        public int getDigestSize();
 
     /**
      * update the message digest with a single byte.
      *
      * @param in the input byte to be entered.
      */
-       public void update(byte in);
+        public void update(byte in);
 
     /**
      * update the message digest with a block of bytes.
@@ -33,7 +33,7 @@ public interface Digest
      * @param inOff the offset into the byte array where the data starts.
      * @param len the length of the data.
      */
-       public void update(byte[] in, int inOff, int len);
+        public void update(byte[] in, int inOff, int len);
 
     /**
      * close the digest, producing the final digest value. The doFinal
@@ -42,7 +42,7 @@ public interface Digest
      * @param out the array the digest is to be copied into.
      * @param outOff the offset into the out array the digest is to start at.
      */
-       public int doFinal(byte[] out, int outOff);
+        public int doFinal(byte[] out, int outOff);
 
     /**
      * reset the digest back to it's initial state.