geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r617610 [7/13] - in /geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto: ./ asn1/ asn1/cryptopro/ asn1/misc/ asn1/oiw/ asn1/pkcs/ asn1/sec/ asn1/util/ asn1/x509/ asn1/x9/ crypto/ crypto/digests/...
Date Fri, 01 Feb 2008 19:02:36 GMT
Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ExtendedKeyUsage.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ExtendedKeyUsage.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ExtendedKeyUsage.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ExtendedKeyUsage.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,121 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+
+/**
+ * The extendedKeyUsage object.
+ * <pre>
+ *      extendedKeyUsage ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
+ * </pre>
+ */
+public class ExtendedKeyUsage
+    extends ASN1Encodable
+{
+    Hashtable     usageTable = new Hashtable();
+    ASN1Sequence  seq;
+
+    public static ExtendedKeyUsage getInstance(
+        ASN1TaggedObject obj,
+        boolean          explicit)
+    {
+        return getInstance(ASN1Sequence.getInstance(obj, explicit));
+    }
+
+    public static ExtendedKeyUsage getInstance(
+        Object obj)
+    {
+        if(obj == null || obj instanceof ExtendedKeyUsage)
+        {
+            return (ExtendedKeyUsage)obj;
+        }
+
+        if(obj instanceof ASN1Sequence)
+        {
+            return new ExtendedKeyUsage((ASN1Sequence)obj);
+        }
+
+        throw new IllegalArgumentException("Invalid ExtendedKeyUsage: " + obj.getClass().getName());
+    }
+
+    public ExtendedKeyUsage(
+        KeyPurposeId  usage)
+    {
+        this.seq = new DERSequence(usage);
+
+        this.usageTable.put(usage, usage);
+    }
+
+    public ExtendedKeyUsage(
+        ASN1Sequence  seq)
+    {
+        this.seq = seq;
+
+        Enumeration e = seq.getObjects();
+
+        while (e.hasMoreElements())
+        {
+            Object  o = e.nextElement();
+
+            this.usageTable.put(o, o);
+        }
+    }
+
+    public ExtendedKeyUsage(
+        Vector  usages)
+    {
+        ASN1EncodableVector v = new ASN1EncodableVector();
+        Enumeration         e = usages.elements();
+
+        while (e.hasMoreElements())
+        {
+            DERObject  o = (DERObject)e.nextElement();
+
+            v.add(o);
+            this.usageTable.put(o, o);
+        }
+
+        this.seq = new DERSequence(v);
+    }
+
+    public boolean hasKeyPurposeId(
+        KeyPurposeId keyPurposeId)
+    {
+        return (usageTable.get(keyPurposeId) != null);
+    }
+
+    public int size()
+    {
+        return usageTable.size();
+    }
+
+    public DERObject toASN1Object()
+    {
+        return seq;
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ExtendedKeyUsage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ExtendedKeyUsage.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ExtendedKeyUsage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralName.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralName.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralName.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralName.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,218 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.ASN1Choice;
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1OctetString;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DEREncodable;
+import org.apache.geronimo.crypto.asn1.DERIA5String;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERObjectIdentifier;
+import org.apache.geronimo.crypto.asn1.DERTaggedObject;
+
+/**
+ * The GeneralName object.
+ * <pre>
+ * GeneralName ::= CHOICE {
+ *      otherName                       [0]     OtherName,
+ *      rfc822Name                      [1]     IA5String,
+ *      dNSName                         [2]     IA5String,
+ *      x400Address                     [3]     ORAddress,
+ *      directoryName                   [4]     Name,
+ *      ediPartyName                    [5]     EDIPartyName,
+ *      uniformResourceIdentifier       [6]     IA5String,
+ *      iPAddress                       [7]     OCTET STRING,
+ *      registeredID                    [8]     OBJECT IDENTIFIER}
+ *
+ * OtherName ::= SEQUENCE {
+ *      type-id    OBJECT IDENTIFIER,
+ *      value      [0] EXPLICIT ANY DEFINED BY type-id }
+ *
+ * EDIPartyName ::= SEQUENCE {
+ *      nameAssigner            [0]     DirectoryString OPTIONAL,
+ *      partyName               [1]     DirectoryString }
+ *
+ * Name ::= CHOICE { RDNSequence }
+ * </pre>
+ */
+public class GeneralName
+    extends ASN1Encodable
+    implements ASN1Choice
+{
+    public static final int otherName                     = 0;
+    public static final int rfc822Name                    = 1;
+    public static final int dNSName                       = 2;
+    public static final int x400Address                   = 3;
+    public static final int directoryName                 = 4;
+    public static final int ediPartyName                  = 5;
+    public static final int uniformResourceIdentifier     = 6;
+    public static final int iPAddress                     = 7;
+    public static final int registeredID                  = 8;
+
+    DEREncodable      obj;
+    int               tag;
+
+    public GeneralName(
+        X509Name  dirName)
+    {
+        this.obj = dirName;
+        this.tag = 4;
+    }
+
+    /**
+     * @deprecated this constructor seems the wrong way round! Use GeneralName(tag, name).
+     */
+    public GeneralName(
+        DERObject name, int tag)
+    {
+        this.obj = name;
+        this.tag = tag;
+    }
+
+    /**
+     * When the subjectAltName extension contains an Internet mail address,
+     * the address MUST be included as an rfc822Name. The format of an
+     * rfc822Name is an "addr-spec" as defined in RFC 822 [RFC 822].
+     *
+     * When the subjectAltName extension contains a domain name service
+     * label, the domain name MUST be stored in the dNSName (an IA5String).
+     * The name MUST be in the "preferred name syntax," as specified by RFC
+     * 1034 [RFC 1034].
+     *
+     * When the subjectAltName extension contains a URI, the name MUST be
+     * stored in the uniformResourceIdentifier (an IA5String). The name MUST
+     * be a non-relative URL, and MUST follow the URL syntax and encoding
+     * rules specified in [RFC 1738].  The name must include both a scheme
+     * (e.g., "http" or "ftp") and a scheme-specific-part.  The scheme-
+     * specific-part must include a fully qualified domain name or IP
+     * address as the host.
+     *
+     * When the subjectAltName extension contains a iPAddress, the address
+     * MUST be stored in the octet string in "network byte order," as
+     * specified in RFC 791 [RFC 791]. The least significant bit (LSB) of
+     * each octet is the LSB of the corresponding byte in the network
+     * address. For IP Version 4, as specified in RFC 791, the octet string
+     * MUST contain exactly four octets.  For IP Version 6, as specified in
+     * RFC 1883, the octet string MUST contain exactly sixteen octets [RFC
+     * 1883].
+     */
+    public GeneralName(
+        int           tag,
+        ASN1Encodable name)
+    {
+        this.obj = name;
+        this.tag = tag;
+    }
+
+    /**
+     * Create a General name for the given tag from the passed in String.
+     *
+     * @param tag tag number
+     * @param name string representation of name
+     */
+    public GeneralName(
+        int       tag,
+        String    name)
+    {
+        if (tag == rfc822Name || tag == dNSName || tag == uniformResourceIdentifier)
+        {
+            this.tag = tag;
+            this.obj = new DERIA5String(name);
+        }
+        else if (tag == registeredID)
+        {
+            this.tag = tag;
+            this.obj = new DERObjectIdentifier(name);
+        }
+        else
+        {
+            throw new IllegalArgumentException("can't process String for tag: " + tag);
+        }
+    }
+
+    public static GeneralName getInstance(
+        Object obj)
+    {
+        if (obj == null || obj instanceof GeneralName)
+        {
+            return (GeneralName)obj;
+        }
+
+        if (obj instanceof ASN1TaggedObject)
+        {
+            ASN1TaggedObject    tagObj = (ASN1TaggedObject)obj;
+            int                 tag = tagObj.getTagNo();
+
+            switch (tag)
+            {
+            case otherName:
+                return new GeneralName(ASN1Sequence.getInstance(tagObj, false), tag);
+            case rfc822Name:
+                return new GeneralName(DERIA5String.getInstance(tagObj, false), tag);
+            case dNSName:
+                return new GeneralName(DERIA5String.getInstance(tagObj, false), tag);
+            case x400Address:
+                throw new IllegalArgumentException("unknown tag: " + tag);
+            case directoryName:
+                return new GeneralName(ASN1Sequence.getInstance(tagObj, true), tag);
+            case ediPartyName:
+                return new GeneralName(ASN1Sequence.getInstance(tagObj, false), tag);
+            case uniformResourceIdentifier:
+                return new GeneralName(DERIA5String.getInstance(tagObj, false), tag);
+            case iPAddress:
+                return new GeneralName(ASN1OctetString.getInstance(tagObj, false), tag);
+            case registeredID:
+                return new GeneralName(DERObjectIdentifier.getInstance(tagObj, false), tag);
+            }
+        }
+
+        throw new IllegalArgumentException("unknown object in getInstance");
+    }
+
+    public static GeneralName getInstance(
+        ASN1TaggedObject tagObj,
+        boolean          explicit)
+    {
+        return GeneralName.getInstance(ASN1TaggedObject.getInstance(tagObj, true));
+    }
+
+    public int getTagNo()
+    {
+        return tag;
+    }
+
+    public DEREncodable getName()
+    {
+        return obj;
+    }
+
+    public DERObject toASN1Object()
+    {
+        if (tag == directoryName)       // directoryName is explicitly tagged as it is a CHOICE
+        {
+            return new DERTaggedObject(true, tag, obj);
+        }
+        else
+        {
+            return new DERTaggedObject(false, tag, obj);
+        }
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralName.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralName.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralName.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralNames.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralNames.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralNames.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralNames.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,93 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+
+public class GeneralNames
+    extends ASN1Encodable
+{
+    ASN1Sequence            seq;
+
+    public static GeneralNames getInstance(
+        Object  obj)
+    {
+        if (obj == null || obj instanceof GeneralNames)
+        {
+            return (GeneralNames)obj;
+        }
+
+        if (obj instanceof ASN1Sequence)
+        {
+            return new GeneralNames((ASN1Sequence)obj);
+        }
+
+        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
+    }
+
+    public static GeneralNames getInstance(
+        ASN1TaggedObject obj,
+        boolean          explicit)
+    {
+        return getInstance(ASN1Sequence.getInstance(obj, explicit));
+    }
+
+    /**
+     * Construct a GeneralNames object containing one GeneralName.
+     *
+     * @param name the name to be contained.
+     */
+    public GeneralNames(
+        GeneralName  name)
+    {
+        this.seq = new DERSequence(name);
+    }
+
+    public GeneralNames(
+        ASN1Sequence  seq)
+    {
+        this.seq = seq;
+    }
+
+    public GeneralName[] getNames()
+    {
+        GeneralName[]   names = new GeneralName[seq.size()];
+
+        for (int i = 0; i != seq.size(); i++)
+        {
+            names[i] = GeneralName.getInstance(seq.getObjectAt(i));
+        }
+
+        return names;
+    }
+
+    /**
+     * Produce an object suitable for an ASN1OutputStream.
+     * <pre>
+     * GeneralNames ::= SEQUENCE SIZE {1..MAX} OF GeneralName
+     * </pre>
+     */
+    public DERObject toASN1Object()
+    {
+        return seq;
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralNames.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralNames.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralNames.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralSubtree.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralSubtree.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralSubtree.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralSubtree.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,142 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import java.math.BigInteger;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERInteger;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+import org.apache.geronimo.crypto.asn1.DERTaggedObject;
+
+public class GeneralSubtree
+    extends ASN1Encodable
+{
+    private GeneralName  base;
+    private DERInteger minimum;
+    private DERInteger maximum;
+
+    public GeneralSubtree(
+        ASN1Sequence seq)
+    {
+        base = GeneralName.getInstance(seq.getObjectAt(0));
+
+        switch (seq.size())
+        {
+        case 1:
+            break;
+        case 2:
+            ASN1TaggedObject o = (ASN1TaggedObject)seq.getObjectAt(1);
+            switch (o.getTagNo())
+            {
+            case 0 :
+                minimum = DERInteger.getInstance(o, false);
+                break;
+            case 1 :
+                maximum = DERInteger.getInstance(o, false);
+                break;
+            default:
+                throw new IllegalArgumentException("Bad tag number: " + o.getTagNo());
+            }
+            break;
+        case 3 :
+            minimum = DERInteger.getInstance((ASN1TaggedObject)seq.getObjectAt(1), false);
+            maximum = DERInteger.getInstance((ASN1TaggedObject)seq.getObjectAt(2), false);
+            break;
+        default:
+            throw new IllegalArgumentException("Bad sequence size: " + seq.size());
+        }
+    }
+
+    public static GeneralSubtree getInstance(
+        ASN1TaggedObject    o,
+        boolean             explicit)
+    {
+        return new GeneralSubtree(ASN1Sequence.getInstance(o, explicit));
+    }
+
+    public static GeneralSubtree getInstance(
+        Object obj)
+    {
+        if (obj == null)
+        {
+            return null;
+        }
+
+        if (obj instanceof GeneralSubtree)
+        {
+            return (GeneralSubtree)obj;
+        }
+
+        return new GeneralSubtree(ASN1Sequence.getInstance(obj));
+    }
+
+    public GeneralName getBase()
+    {
+        return base;
+    }
+
+    public BigInteger getMinimum()
+    {
+        if (minimum == null)
+        {
+            return BigInteger.valueOf(0);
+        }
+
+        return minimum.getValue();
+    }
+
+    public BigInteger getMaximum()
+    {
+        if (maximum == null)
+        {
+            return null;
+        }
+
+        return maximum.getValue();
+    }
+
+    /*
+     * GeneralSubtree ::= SEQUENCE {
+     *      base                    GeneralName,
+     *      minimum         [0]     BaseDistance DEFAULT 0,
+     *      maximum         [1]     BaseDistance OPTIONAL }
+     */
+    public DERObject toASN1Object()
+    {
+        ASN1EncodableVector v = new ASN1EncodableVector();
+
+        v.add(base);
+
+        if (minimum != null)
+        {
+            v.add(new DERTaggedObject(false, 0, minimum));
+        }
+
+        if (maximum != null)
+        {
+            v.add(new DERTaggedObject(false, 1, maximum));
+        }
+
+        return new DERSequence(v);
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralSubtree.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralSubtree.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/GeneralSubtree.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/Holder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/Holder.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/Holder.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/Holder.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,137 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+import org.apache.geronimo.crypto.asn1.DERTaggedObject;
+
+/**
+ * The Holder object.
+ * <pre>
+ *  Holder ::= SEQUENCE {
+ *        baseCertificateID   [0] IssuerSerial OPTIONAL,
+ *                 -- the issuer and serial number of
+ *                 -- the holder's Public Key Certificate
+ *        entityName          [1] GeneralNames OPTIONAL,
+ *                 -- the name of the claimant or role
+ *        objectDigestInfo    [2] ObjectDigestInfo OPTIONAL
+ *                 -- used to directly authenticate the holder,
+ *                 -- for example, an executable
+ *  }
+ * </pre>
+ */
+public class Holder
+    extends ASN1Encodable
+{
+    IssuerSerial        baseCertificateID;
+    GeneralNames        entityName;
+    ObjectDigestInfo    objectDigestInfo;
+
+    public static Holder getInstance(
+            Object  obj)
+    {
+        if (obj instanceof Holder)
+        {
+            return (Holder)obj;
+        }
+        else if (obj instanceof ASN1Sequence)
+        {
+            return new Holder((ASN1Sequence)obj);
+        }
+
+        throw new IllegalArgumentException("unknown object in factory");
+    }
+
+    public Holder(
+        ASN1Sequence    seq)
+    {
+        for (int i = 0; i != seq.size(); i++)
+        {
+            ASN1TaggedObject    tObj = (ASN1TaggedObject)seq.getObjectAt(i);
+
+            switch (tObj.getTagNo())
+            {
+            case 0:
+                baseCertificateID = IssuerSerial.getInstance(tObj, false);
+                break;
+            case 1:
+                entityName = GeneralNames.getInstance(tObj, false);
+                break;
+            case 2:
+                objectDigestInfo = ObjectDigestInfo.getInstance(tObj, false);
+                break;
+            default:
+                throw new IllegalArgumentException("unknown tag in Holder");
+            }
+        }
+    }
+
+    public Holder(
+        IssuerSerial    baseCertificateID)
+    {
+        this.baseCertificateID = baseCertificateID;
+    }
+
+    public Holder(
+        GeneralNames    entityName)
+    {
+        this.entityName = entityName;
+    }
+
+    public IssuerSerial getBaseCertificateID()
+    {
+        return baseCertificateID;
+    }
+
+    public GeneralNames getEntityName()
+    {
+        return entityName;
+    }
+
+    public ObjectDigestInfo getObjectDigestInfo()
+    {
+        return objectDigestInfo;
+    }
+
+    public DERObject toASN1Object()
+    {
+        ASN1EncodableVector  v = new ASN1EncodableVector();
+
+        if (baseCertificateID != null)
+        {
+            v.add(new DERTaggedObject(false, 0, baseCertificateID));
+        }
+
+        if (entityName != null)
+        {
+            v.add(new DERTaggedObject(false, 1, entityName));
+        }
+
+        if (objectDigestInfo != null)
+        {
+            v.add(new DERTaggedObject(false, 2, objectDigestInfo));
+        }
+
+        return new DERSequence(v);
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/Holder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/Holder.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/Holder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IetfAttrSyntax.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IetfAttrSyntax.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IetfAttrSyntax.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IetfAttrSyntax.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,191 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1OctetString;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERObjectIdentifier;
+import org.apache.geronimo.crypto.asn1.DEROctetString;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+import org.apache.geronimo.crypto.asn1.DERTaggedObject;
+import org.apache.geronimo.crypto.asn1.DERUTF8String;
+
+/**
+ * Implementation of <code>IetfAttrSyntax</code> as specified by RFC3281.
+ */
+public class IetfAttrSyntax
+    extends ASN1Encodable
+{
+    public static final int VALUE_OCTETS    = 1;
+    public static final int VALUE_OID       = 2;
+    public static final int VALUE_UTF8      = 3;
+    GeneralNames            policyAuthority = null;
+    Vector                  values          = new Vector();
+    int                     valueChoice     = -1;
+
+    /**
+     *
+     */
+    public IetfAttrSyntax(ASN1Sequence seq)
+    {
+        int i = 0;
+
+        if (seq.getObjectAt(0) instanceof ASN1TaggedObject)
+        {
+            policyAuthority = GeneralNames.getInstance(((ASN1TaggedObject)seq.getObjectAt(0)), false);
+            i++;
+        }
+        else if (seq.size() == 2)
+        { // VOMS fix
+            policyAuthority = GeneralNames.getInstance(seq.getObjectAt(0));
+            i++;
+        }
+
+        if (!(seq.getObjectAt(i) instanceof ASN1Sequence))
+        {
+            throw new IllegalArgumentException("Non-IetfAttrSyntax encoding");
+        }
+
+        seq = (ASN1Sequence)seq.getObjectAt(i);
+
+        for (Enumeration e = seq.getObjects(); e.hasMoreElements();)
+        {
+            DERObject obj = (DERObject)e.nextElement();
+            int type;
+
+            if (obj instanceof DERObjectIdentifier)
+            {
+                type = VALUE_OID;
+            }
+            else if (obj instanceof DERUTF8String)
+            {
+                type = VALUE_UTF8;
+            }
+            else if (obj instanceof DEROctetString)
+            {
+                type = VALUE_OCTETS;
+            }
+            else
+            {
+                throw new IllegalArgumentException("Bad value type encoding IetfAttrSyntax");
+            }
+
+            if (valueChoice < 0)
+            {
+                valueChoice = type;
+            }
+
+            if (type != valueChoice)
+            {
+                throw new IllegalArgumentException("Mix of value types in IetfAttrSyntax");
+            }
+
+            values.addElement(obj);
+        }
+    }
+
+    public GeneralNames getPolicyAuthority()
+    {
+        return policyAuthority;
+    }
+
+    public int getValueType()
+    {
+        return valueChoice;
+    }
+
+    public Object[] getValues()
+    {
+        if (this.getValueType() == VALUE_OCTETS)
+        {
+            ASN1OctetString[] tmp = new ASN1OctetString[values.size()];
+
+            for (int i = 0; i != tmp.length; i++)
+            {
+                tmp[i] = (ASN1OctetString)values.elementAt(i);
+            }
+
+            return tmp;
+        }
+        else if (this.getValueType() == VALUE_OID)
+        {
+            DERObjectIdentifier[] tmp = new DERObjectIdentifier[values.size()];
+
+            for (int i = 0; i != tmp.length; i++)
+            {
+                tmp[i] = (DERObjectIdentifier)values.elementAt(i);
+            }
+
+            return tmp;
+        }
+        else
+        {
+            DERUTF8String[] tmp = new DERUTF8String[values.size()];
+
+            for (int i = 0; i != tmp.length; i++)
+            {
+                tmp[i] = (DERUTF8String)values.elementAt(i);
+            }
+
+            return tmp;
+        }
+    }
+
+    /**
+     *
+     * <pre>
+     *
+     *  IetfAttrSyntax ::= SEQUENCE {
+     *    policyAuthority [0] GeneralNames OPTIONAL,
+     *    values SEQUENCE OF CHOICE {
+     *      octets OCTET STRING,
+     *      oid OBJECT IDENTIFIER,
+     *      string UTF8String
+     *    }
+     *  }
+     *
+     * </pre>
+     */
+    public DERObject toASN1Object()
+    {
+        ASN1EncodableVector v = new ASN1EncodableVector();
+
+        if (policyAuthority != null)
+        {
+            v.add(new DERTaggedObject(0, policyAuthority));
+        }
+
+        ASN1EncodableVector v2 = new ASN1EncodableVector();
+
+        for (Enumeration i = values.elements(); i.hasMoreElements();)
+        {
+            v2.add((ASN1Encodable)i.nextElement());
+        }
+
+        v.add(new DERSequence(v2));
+
+        return new DERSequence(v);
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IetfAttrSyntax.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IetfAttrSyntax.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IetfAttrSyntax.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuerSerial.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuerSerial.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuerSerial.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuerSerial.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,118 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERBitString;
+import org.apache.geronimo.crypto.asn1.DERInteger;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+
+public class IssuerSerial
+    extends ASN1Encodable
+{
+    GeneralNames            issuer;
+    DERInteger              serial;
+    DERBitString            issuerUID;
+
+    public static IssuerSerial getInstance(
+            Object  obj)
+    {
+        if (obj == null || obj instanceof GeneralNames)
+        {
+            return (IssuerSerial)obj;
+        }
+
+        if (obj instanceof ASN1Sequence)
+        {
+            return new IssuerSerial((ASN1Sequence)obj);
+        }
+
+        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
+    }
+
+    public static IssuerSerial getInstance(
+        ASN1TaggedObject obj,
+        boolean          explicit)
+    {
+        return getInstance(ASN1Sequence.getInstance(obj, explicit));
+    }
+
+    public IssuerSerial(
+        ASN1Sequence    seq)
+    {
+        issuer = GeneralNames.getInstance(seq.getObjectAt(0));
+        serial = (DERInteger)seq.getObjectAt(1);
+
+        if (seq.size() == 3)
+        {
+            issuerUID = (DERBitString)seq.getObjectAt(2);
+        }
+    }
+
+    public IssuerSerial(
+        GeneralNames    issuer,
+        DERInteger      serial)
+    {
+        this.issuer = issuer;
+        this.serial = serial;
+    }
+
+    public GeneralNames getIssuer()
+    {
+        return issuer;
+    }
+
+    public DERInteger getSerial()
+    {
+        return serial;
+    }
+
+    public DERBitString getIssuerUID()
+    {
+        return issuerUID;
+    }
+
+    /**
+     * Produce an object suitable for an ASN1OutputStream.
+     * <pre>
+     *  IssuerSerial  ::=  SEQUENCE {
+     *       issuer         GeneralNames,
+     *       serial         CertificateSerialNumber,
+     *       issuerUID      UniqueIdentifier OPTIONAL
+     *  }
+     * </pre>
+     */
+    public DERObject toASN1Object()
+    {
+        ASN1EncodableVector  v = new ASN1EncodableVector();
+
+        v.add(issuer);
+        v.add(serial);
+
+        if (issuerUID != null)
+        {
+            v.add(issuerUID);
+        }
+
+        return new DERSequence(v);
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuerSerial.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuerSerial.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuerSerial.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuingDistributionPoint.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuingDistributionPoint.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuingDistributionPoint.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuingDistributionPoint.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,127 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERBoolean;
+import org.apache.geronimo.crypto.asn1.DERObject;
+
+/**
+ * IssuingDistributionPoint ::= SEQUENCE {
+ *      distributionPoint          [0] DistributionPointName OPTIONAL,
+ *      onlyContainsUserCerts      [1] BOOLEAN DEFAULT FALSE,
+ *      onlyContainsCACerts        [2] BOOLEAN DEFAULT FALSE,
+ *      onlySomeReasons            [3] ReasonFlags OPTIONAL,
+ *      indirectCRL                [4] BOOLEAN DEFAULT FALSE,
+ *      onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
+ */
+public class IssuingDistributionPoint
+    extends ASN1Encodable
+{
+    private boolean         onlyContainsUserCerts;
+    private boolean         onlyContainsCACerts;
+    private boolean         indirectCRL;
+    private boolean         onlyContainsAttributeCerts;
+
+    private ASN1Sequence    seq;
+
+    public static IssuingDistributionPoint getInstance(
+        ASN1TaggedObject obj,
+        boolean          explicit)
+    {
+        return getInstance(ASN1Sequence.getInstance(obj, explicit));
+    }
+
+    public static IssuingDistributionPoint getInstance(
+        Object  obj)
+    {
+        if (obj == null || obj instanceof IssuingDistributionPoint)
+        {
+            return (IssuingDistributionPoint)obj;
+        }
+        else if (obj instanceof ASN1Sequence)
+        {
+            return new IssuingDistributionPoint((ASN1Sequence)obj);
+        }
+
+        throw new IllegalArgumentException("unknown object in factory");
+    }
+
+    /**
+     * Constructor from ASN1Sequence
+     */
+    public IssuingDistributionPoint(
+        ASN1Sequence  seq)
+    {
+        this.seq = seq;
+
+        for (int i = 0; i != seq.size(); i++)
+        {
+            ASN1TaggedObject  o = (ASN1TaggedObject)seq.getObjectAt(i);
+
+            switch (o.getTagNo())
+            {
+            case 0:
+                break;
+            case 1:
+                onlyContainsUserCerts = DERBoolean.getInstance(o, false).isTrue();
+                break;
+            case 2:
+                onlyContainsCACerts = DERBoolean.getInstance(o, false).isTrue();
+                break;
+            case 3:
+                break;
+            case 4:
+                indirectCRL = DERBoolean.getInstance(o, false).isTrue();
+                break;
+            case 5:
+                onlyContainsAttributeCerts = DERBoolean.getInstance(o, false).isTrue();
+                break;
+            default:
+                throw new IllegalArgumentException("unknown tag in IssuingDistributionPoint");
+            }
+        }
+    }
+
+    public boolean onlyContainsUserCerts()
+    {
+        return onlyContainsUserCerts;
+    }
+
+    public boolean onlyContainsCACerts()
+    {
+        return onlyContainsCACerts;
+    }
+
+    public boolean isIndirectCRL()
+    {
+        return indirectCRL;
+    }
+
+    public boolean onlyContainsAttributeCerts()
+    {
+        return onlyContainsAttributeCerts;
+    }
+
+    public DERObject toASN1Object()
+    {
+        return seq;
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuingDistributionPoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuingDistributionPoint.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/IssuingDistributionPoint.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyPurposeId.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyPurposeId.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyPurposeId.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyPurposeId.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,54 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.DERObjectIdentifier;
+
+/**
+ * The KeyPurposeId object.
+ * <pre>
+ *     KeyPurposeId ::= OBJECT IDENTIFIER
+ * </pre>
+ */
+public class KeyPurposeId
+    extends DERObjectIdentifier
+{
+    private static final String id_kp = "1.3.6.1.5.5.7.3";
+
+    private KeyPurposeId(
+        String  id)
+    {
+        super(id);
+    }
+
+    public static final KeyPurposeId anyExtendedKeyUsage = new KeyPurposeId(X509Extensions.ExtendedKeyUsage.getId() + ".0");
+    public static final KeyPurposeId id_kp_serverAuth = new KeyPurposeId(id_kp + ".1");
+    public static final KeyPurposeId id_kp_clientAuth = new KeyPurposeId(id_kp + ".2");
+    public static final KeyPurposeId id_kp_codeSigning = new KeyPurposeId(id_kp + ".3");
+    public static final KeyPurposeId id_kp_emailProtection = new KeyPurposeId(id_kp + ".4");
+    public static final KeyPurposeId id_kp_ipsecEndSystem = new KeyPurposeId(id_kp + ".5");
+    public static final KeyPurposeId id_kp_ipsecTunnel = new KeyPurposeId(id_kp + ".6");
+    public static final KeyPurposeId id_kp_ipsecUser = new KeyPurposeId(id_kp + ".7");
+    public static final KeyPurposeId id_kp_timeStamping = new KeyPurposeId(id_kp + ".8");
+    public static final KeyPurposeId id_kp_OCSPSigning = new KeyPurposeId(id_kp + ".9");
+
+    //
+    // microsoft key purpose ids
+    //
+    public static final KeyPurposeId id_kp_smartcardlogon = new KeyPurposeId("1.3.6.1.4.1.311.20.2.2");
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyPurposeId.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyPurposeId.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyPurposeId.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyUsage.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyUsage.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyUsage.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyUsage.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,79 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.DERBitString;
+
+/**
+ * The KeyUsage object.
+ * <pre>
+ *    id-ce-keyUsage OBJECT IDENTIFIER ::=  { id-ce 15 }
+ *
+ *    KeyUsage ::= BIT STRING {
+ *         digitalSignature        (0),
+ *         nonRepudiation          (1),
+ *         keyEncipherment         (2),
+ *         dataEncipherment        (3),
+ *         keyAgreement            (4),
+ *         keyCertSign             (5),
+ *         cRLSign                 (6),
+ *         encipherOnly            (7),
+ *         decipherOnly            (8) }
+ * </pre>
+ */
+public class KeyUsage
+    extends DERBitString
+{
+    public static final int        digitalSignature = (1 << 7);
+    public static final int        nonRepudiation   = (1 << 6);
+    public static final int        keyEncipherment  = (1 << 5);
+    public static final int        dataEncipherment = (1 << 4);
+    public static final int        keyAgreement     = (1 << 3);
+    public static final int        keyCertSign      = (1 << 2);
+    public static final int        cRLSign          = (1 << 1);
+    public static final int        encipherOnly     = (1 << 0);
+    public static final int        decipherOnly     = (1 << 15);
+
+    /**
+     * Basic constructor.
+     *
+     * @param usage - the bitwise OR of the Key Usage flags giving the
+     * allowed uses for the key.
+     * e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment)
+     */
+    public KeyUsage(
+        int usage)
+    {
+        super(getBytes(usage), getPadBits(usage));
+    }
+
+    public KeyUsage(
+        DERBitString usage)
+    {
+        super(usage.getBytes(), usage.getPadBits());
+    }
+
+    public String toString()
+    {
+        if (data.length == 1)
+        {
+            return "KeyUsage: 0x" + Integer.toHexString(data[0] & 0xff);
+        }
+        return "KeyUsage: 0x" + Integer.toHexString((data[1] & 0xff) << 8 | (data[0] & 0xff));
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyUsage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyUsage.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/KeyUsage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NameConstraints.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NameConstraints.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NameConstraints.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NameConstraints.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,85 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import java.util.Enumeration;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+import org.apache.geronimo.crypto.asn1.DERTaggedObject;
+
+public class NameConstraints
+    extends ASN1Encodable
+{
+    ASN1Sequence    permitted, excluded;
+
+    public NameConstraints(
+        ASN1Sequence    seq)
+    {
+        Enumeration e = seq.getObjects();
+        while (e.hasMoreElements())
+        {
+            ASN1TaggedObject    o = (ASN1TaggedObject)e.nextElement();
+            switch (o.getTagNo())
+            {
+            case 0:
+                permitted = ASN1Sequence.getInstance(o, false);
+                break;
+            case 1:
+                excluded = ASN1Sequence.getInstance(o, false);
+                break;
+            }
+        }
+    }
+
+    public ASN1Sequence getPermittedSubtrees()
+    {
+        return permitted;
+    }
+
+    public ASN1Sequence getExcludedSubtrees()
+    {
+        return excluded;
+    }
+
+    /*
+     * NameConstraints ::= SEQUENCE {
+     *      permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
+     *      excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
+     */
+    public DERObject toASN1Object()
+    {
+        ASN1EncodableVector   v = new ASN1EncodableVector();
+
+        if (permitted != null)
+        {
+            v.add(new DERTaggedObject(false, 0, permitted));
+        }
+
+        if (excluded != null)
+        {
+            v.add(new DERTaggedObject(false, 1, excluded));
+        }
+
+        return new DERSequence(v);
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NameConstraints.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NameConstraints.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NameConstraints.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NoticeReference.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NoticeReference.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NoticeReference.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NoticeReference.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,146 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.DERInteger;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+
+/**
+ * <code>NoticeReference</code> class, used in
+ * <code>CertificatePolicies</code> X509 V3 extensions
+ * (in policy qualifiers).
+ *
+ * <pre>
+ *  NoticeReference ::= SEQUENCE {
+ *      organization     DisplayText,
+ *      noticeNumbers    SEQUENCE OF INTEGER }
+ *
+ * </pre>
+ *
+ * @see PolicyQualifierInfo
+ * @see PolicyInformation
+ */
+public class NoticeReference
+    extends ASN1Encodable
+{
+   DisplayText organization;
+   ASN1Sequence noticeNumbers;
+
+   /**
+    * Creates a new <code>NoticeReference</code> instance.
+    *
+    * @param orgName a <code>String</code> value
+    * @param numbers a <code>Vector</code> value
+    */
+   public NoticeReference (String orgName, Vector numbers)
+   {
+      organization = new DisplayText(orgName);
+
+      Object o = numbers.elementAt(0);
+
+      ASN1EncodableVector av = new ASN1EncodableVector();
+      if (o instanceof Integer) {
+         Enumeration it = numbers.elements();
+
+         while (it.hasMoreElements()) {
+            Integer nm = (Integer) it.nextElement();
+               DERInteger di = new DERInteger(nm.intValue());
+            av.add (di);
+         }
+      }
+
+      noticeNumbers = new DERSequence(av);
+   }
+
+   /**
+    * Creates a new <code>NoticeReference</code> instance.
+    *
+    * @param orgName a <code>String</code> value
+    * @param numbers an <code>ASN1EncodableVector</code> value
+    */
+   public NoticeReference (String orgName, ASN1Sequence numbers)
+   {
+      organization = new DisplayText (orgName);
+      noticeNumbers = numbers;
+   }
+
+   /**
+    * Creates a new <code>NoticeReference</code> instance.
+    *
+    * @param displayTextType an <code>int</code> value
+    * @param orgName a <code>String</code> value
+    * @param numbers an <code>ASN1EncodableVector</code> value
+    */
+   public NoticeReference (int displayTextType,
+                           String orgName, ASN1Sequence numbers)
+   {
+      organization = new DisplayText(displayTextType,
+                                     orgName);
+      noticeNumbers = numbers;
+   }
+
+   /**
+    * Creates a new <code>NoticeReference</code> instance.
+    * <p>Useful for reconstructing a <code>NoticeReference</code>
+    * instance from its encodable/encoded form.
+    *
+    * @param as an <code>ASN1Sequence</code> value obtained from either
+    * calling @{link toASN1Object()} for a <code>NoticeReference</code>
+    * instance or from parsing it from a DER-encoded stream.
+    */
+   public NoticeReference (ASN1Sequence as)
+   {
+      organization = DisplayText.getInstance(as.getObjectAt(0));
+      noticeNumbers = (ASN1Sequence) as.getObjectAt(1);
+   }
+
+   public static NoticeReference getInstance (Object as)
+   {
+      if (as instanceof NoticeReference)
+      {
+          return (NoticeReference)as;
+      }
+      else if (as instanceof ASN1Sequence)
+      {
+          return new NoticeReference((ASN1Sequence)as);
+      }
+
+      throw new IllegalArgumentException("unknown object in getInstance.");
+   }
+
+   /**
+    * Describe <code>toASN1Object</code> method here.
+    *
+    * @return a <code>DERObject</code> value
+    */
+   public DERObject toASN1Object()
+   {
+      ASN1EncodableVector av = new ASN1EncodableVector();
+      av.add (organization);
+      av.add (noticeNumbers);
+      return new DERSequence (av);
+   }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NoticeReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NoticeReference.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/NoticeReference.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ObjectDigestInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ObjectDigestInfo.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ObjectDigestInfo.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ObjectDigestInfo.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,138 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1TaggedObject;
+import org.apache.geronimo.crypto.asn1.DERBitString;
+import org.apache.geronimo.crypto.asn1.DEREnumerated;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERObjectIdentifier;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+import org.apache.geronimo.crypto.asn1.x509.AlgorithmIdentifier;
+
+
+public class ObjectDigestInfo
+    extends ASN1Encodable
+{
+    DEREnumerated digestedObjectType;
+
+    DERObjectIdentifier otherObjectTypeID;
+
+    AlgorithmIdentifier digestAlgorithm;
+
+    DERBitString objectDigest;
+
+    public static ObjectDigestInfo getInstance(
+            Object  obj)
+    {
+        if (obj == null || obj instanceof ObjectDigestInfo)
+        {
+            return (ObjectDigestInfo)obj;
+        }
+
+        if (obj instanceof ASN1Sequence)
+        {
+            return new ObjectDigestInfo((ASN1Sequence)obj);
+        }
+
+        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
+    }
+
+    public static ObjectDigestInfo getInstance(
+        ASN1TaggedObject obj,
+        boolean          explicit)
+    {
+        return getInstance(ASN1Sequence.getInstance(obj, explicit));
+    }
+
+    public ObjectDigestInfo(ASN1Sequence seq)
+    {
+        digestedObjectType = DEREnumerated.getInstance(seq.getObjectAt(0));
+
+        int offset = 0;
+
+        if (seq.size() == 4)
+        {
+            otherObjectTypeID = DERObjectIdentifier.getInstance(seq.getObjectAt(1));
+            offset++;
+        }
+
+        digestAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(1 + offset));
+
+        objectDigest = new DERBitString(seq.getObjectAt(2 + offset));
+    }
+
+    public DEREnumerated getDigestedObjectType()
+    {
+        return digestedObjectType;
+    }
+
+    public DERObjectIdentifier getOtherObjectTypeID()
+    {
+        return otherObjectTypeID;
+    }
+
+    public AlgorithmIdentifier getDigestAlgorithm()
+    {
+        return digestAlgorithm;
+    }
+
+    public DERBitString getObjectDigest()
+    {
+        return objectDigest;
+    }
+
+    /**
+     * Produce an object suitable for an ASN1OutputStream.
+     *
+     * <pre>
+     *
+     *   ObjectDigestInfo ::= SEQUENCE {
+     *        digestedObjectType  ENUMERATED {
+     *                publicKey            (0),
+     *                publicKeyCert        (1),
+     *                otherObjectTypes     (2) },
+     *                        -- otherObjectTypes MUST NOT
+     *                        -- be used in this profile
+     *        otherObjectTypeID   OBJECT IDENTIFIER OPTIONAL,
+     *        digestAlgorithm     AlgorithmIdentifier,
+     *        objectDigest        BIT STRING
+     *   }
+     *
+     * </pre>
+     */
+    public DERObject toASN1Object()
+    {
+        ASN1EncodableVector v = new ASN1EncodableVector();
+
+        v.add(digestedObjectType);
+
+        if (otherObjectTypeID != null)
+        {
+            v.add(otherObjectTypeID);
+        }
+
+        v.add(digestAlgorithm);
+        v.add(objectDigest);
+
+        return new DERSequence(v);
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ObjectDigestInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ObjectDigestInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/ObjectDigestInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyInformation.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyInformation.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyInformation.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyInformation.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,98 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERObjectIdentifier;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+
+public class PolicyInformation
+    extends ASN1Encodable
+{
+    private DERObjectIdentifier   policyIdentifier;
+    private ASN1Sequence          policyQualifiers;
+
+    public PolicyInformation(
+        ASN1Sequence seq)
+    {
+        policyIdentifier = (DERObjectIdentifier)seq.getObjectAt(0);
+
+        if (seq.size() > 1)
+        {
+            policyQualifiers = (ASN1Sequence)seq.getObjectAt(1);
+        }
+    }
+
+    public PolicyInformation(
+        DERObjectIdentifier policyIdentifier)
+    {
+        this.policyIdentifier = policyIdentifier;
+    }
+
+    public PolicyInformation(
+        DERObjectIdentifier policyIdentifier,
+        ASN1Sequence        policyQualifiers)
+    {
+        this.policyIdentifier = policyIdentifier;
+        this.policyQualifiers = policyQualifiers;
+    }
+
+    public static PolicyInformation getInstance(
+        Object obj)
+    {
+        if (obj == null || obj instanceof PolicyInformation)
+        {
+            return (PolicyInformation)obj;
+        }
+
+        return new PolicyInformation(ASN1Sequence.getInstance(obj));
+    }
+
+    public DERObjectIdentifier getPolicyIdentifier()
+    {
+        return policyIdentifier;
+    }
+
+    public ASN1Sequence getPolicyQualifiers()
+    {
+        return policyQualifiers;
+    }
+
+    /*
+     * PolicyInformation ::= SEQUENCE {
+     *      policyIdentifier   CertPolicyId,
+     *      policyQualifiers   SEQUENCE SIZE (1..MAX) OF
+     *              PolicyQualifierInfo OPTIONAL }
+     */
+    public DERObject toASN1Object()
+    {
+        ASN1EncodableVector v = new ASN1EncodableVector();
+
+        v.add(policyIdentifier);
+
+        if (policyQualifiers != null)
+        {
+            v.add(policyQualifiers);
+        }
+
+        return new DERSequence(v);
+    }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyInformation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyInformation.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyInformation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyMappings.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyMappings.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyMappings.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyMappings.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,84 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import java.util.Hashtable;
+import java.util.Enumeration;
+
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERObjectIdentifier;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+
+/**
+ * PolicyMappings V3 extension, described in RFC3280.
+ * <pre>
+ *    PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
+ *      issuerDomainPolicy      CertPolicyId,
+ *      subjectDomainPolicy     CertPolicyId }
+ * </pre>
+ *
+ * @see <a href="http://www.faqs.org/rfc/rfc3280.txt">RFC 3280, section 4.2.1.6</a>
+ */
+public class PolicyMappings
+    extends ASN1Encodable
+{
+   ASN1Sequence seq = null;
+
+   /**
+    * Creates a new <code>PolicyMappings</code> instance.
+    *
+    * @param seq an <code>ASN1Sequence</code> constructed as specified
+    * in RFC 3280
+    */
+   public PolicyMappings (ASN1Sequence seq)
+      {
+         this.seq = seq;
+      }
+
+   /**
+    * Creates a new <code>PolicyMappings</code> instance.
+    *
+    * @param mappings a <code>HashMap</code> value that maps
+    * <code>String</code> oids
+    * to other <code>String</code> oids.
+    */
+   public PolicyMappings (Hashtable mappings)
+      {
+         ASN1EncodableVector dev = new ASN1EncodableVector();
+         Enumeration it = mappings.keys();
+
+         while (it.hasMoreElements()) {
+            String idp = (String) it.nextElement();
+            String sdp = (String) mappings.get(idp);
+            ASN1EncodableVector dv = new ASN1EncodableVector();
+            dv.add(new DERObjectIdentifier(idp));
+            dv.add(new DERObjectIdentifier(sdp));
+            dev.add(new DERSequence(dv));
+         }
+
+         seq = new DERSequence(dev);
+      }
+
+   public DERObject toASN1Object()
+      {
+         return seq;
+      }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyMappings.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyMappings.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyMappings.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierId.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierId.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierId.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierId.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,48 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.DERObjectIdentifier;
+
+/**
+ * PolicyQualifierId, used in the CertificatePolicies
+ * X509V3 extension.
+ *
+ * <pre>
+ *    id-qt          OBJECT IDENTIFIER ::=  { id-pkix 2 }
+ *    id-qt-cps      OBJECT IDENTIFIER ::=  { id-qt 1 }
+ *    id-qt-unotice  OBJECT IDENTIFIER ::=  { id-qt 2 }
+ *  PolicyQualifierId ::=
+ *       OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
+ * </pre>
+ */
+public class PolicyQualifierId extends DERObjectIdentifier
+{
+   private static final String id_qt = "1.3.6.1.5.5.7.2";
+
+   private PolicyQualifierId(String id)
+      {
+         super(id);
+      }
+
+   public static final PolicyQualifierId id_qt_cps =
+       new PolicyQualifierId(id_qt + ".1");
+   public static final PolicyQualifierId id_qt_unotice =
+       new PolicyQualifierId(id_qt + ".2");
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierId.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierId.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierId.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierInfo.java?rev=617610&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierInfo.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierInfo.java Fri Feb  1 11:01:39 2008
@@ -0,0 +1,110 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.crypto.asn1.x509;
+
+import org.apache.geronimo.crypto.asn1.ASN1Encodable;
+import org.apache.geronimo.crypto.asn1.ASN1EncodableVector;
+import org.apache.geronimo.crypto.asn1.ASN1Sequence;
+import org.apache.geronimo.crypto.asn1.DEREncodable;
+import org.apache.geronimo.crypto.asn1.DERObject;
+import org.apache.geronimo.crypto.asn1.DERIA5String;
+import org.apache.geronimo.crypto.asn1.DERObjectIdentifier;
+import org.apache.geronimo.crypto.asn1.DERSequence;
+
+/**
+ * Policy qualifiers, used in the X509V3 CertificatePolicies
+ * extension.
+ *
+ * <pre>
+ *   PolicyQualifierInfo ::= SEQUENCE {
+ *       policyQualifierId  PolicyQualifierId,
+ *       qualifier          ANY DEFINED BY policyQualifierId }
+ * </pre>
+ */
+public class PolicyQualifierInfo
+    extends ASN1Encodable
+{
+   DERObjectIdentifier policyQualifierId;
+   DEREncodable qualifier;
+
+   /**
+    * Creates a new <code>PolicyQualifierInfo</code> instance.
+    *
+    * @param policyQualifierId a <code>PolicyQualifierId</code> value
+    * @param qualifier the qualifier, defined by the above field.
+    */
+   public PolicyQualifierInfo (DERObjectIdentifier policyQualifierId,
+                               DEREncodable qualifier)
+   {
+      this.policyQualifierId = policyQualifierId;
+      this.qualifier = qualifier;
+   }
+
+   /**
+    * Creates a new <code>PolicyQualifierInfo</code> containing a
+    * cPSuri qualifier.
+    *
+    * @param cps the CPS (certification practice statement) uri as a
+    * <code>String</code>.
+    */
+   public PolicyQualifierInfo (String cps)
+   {
+      policyQualifierId = PolicyQualifierId.id_qt_cps;
+      qualifier = new DERIA5String (cps);
+   }
+
+   /**
+    * Creates a new <code>PolicyQualifierInfo</code> instance.
+    *
+    * @param as <code>PolicyQualifierInfo</code> X509 structure
+    * encoded as an ASN1Sequence.
+    */
+   public PolicyQualifierInfo (ASN1Sequence as)
+   {
+        policyQualifierId = (DERObjectIdentifier) as.getObjectAt(0);
+        qualifier = as.getObjectAt(1);
+    }
+
+   public static PolicyQualifierInfo getInstance (Object as)
+   {
+        if (as instanceof PolicyQualifierInfo)
+        {
+            return (PolicyQualifierInfo)as;
+        }
+        else if (as instanceof ASN1Sequence)
+        {
+            return new PolicyQualifierInfo((ASN1Sequence)as);
+        }
+
+        throw new IllegalArgumentException("unknown object in getInstance.");
+   }
+
+   /**
+    * Returns a DER-encodable representation of this instance.
+    *
+    * @return a <code>DERObject</code> value
+    */
+   public DERObject toASN1Object()
+   {
+      ASN1EncodableVector dev = new ASN1EncodableVector();
+      dev.add(policyQualifierId);
+      dev.add(qualifier);
+
+      return new DERSequence(dev);
+   }
+}

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/asn1/x509/PolicyQualifierInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message