KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > util > asn1 > x509 > PolicyMappings


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.geronimo.util.asn1.x509;
19
20 import java.util.Hashtable JavaDoc;
21 import java.util.Enumeration JavaDoc;
22
23 import org.apache.geronimo.util.asn1.ASN1Sequence;
24 import org.apache.geronimo.util.asn1.ASN1Encodable;
25 import org.apache.geronimo.util.asn1.ASN1EncodableVector;
26 import org.apache.geronimo.util.asn1.DERObject;
27 import org.apache.geronimo.util.asn1.DERObjectIdentifier;
28 import org.apache.geronimo.util.asn1.DERSequence;
29
30 /**
31  * PolicyMappings V3 extension, described in RFC3280.
32  * <pre>
33  * PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
34  * issuerDomainPolicy CertPolicyId,
35  * subjectDomainPolicy CertPolicyId }
36  * </pre>
37  *
38  * @see <a HREF="http://www.faqs.org/rfc/rfc3280.txt">RFC 3280, section 4.2.1.6</a>
39  */

40 public class PolicyMappings
41     extends ASN1Encodable
42 {
43    ASN1Sequence seq = null;
44
45    /**
46     * Creates a new <code>PolicyMappings</code> instance.
47     *
48     * @param seq an <code>ASN1Sequence</code> constructed as specified
49     * in RFC 3280
50     */

51    public PolicyMappings (ASN1Sequence seq)
52       {
53          this.seq = seq;
54       }
55
56    /**
57     * Creates a new <code>PolicyMappings</code> instance.
58     *
59     * @param mappings a <code>HashMap</code> value that maps
60     * <code>String</code> oids
61     * to other <code>String</code> oids.
62     */

63    public PolicyMappings (Hashtable JavaDoc mappings)
64       {
65          ASN1EncodableVector dev = new ASN1EncodableVector();
66          Enumeration JavaDoc it = mappings.keys();
67
68          while (it.hasMoreElements()) {
69             String JavaDoc idp = (String JavaDoc) it.nextElement();
70             String JavaDoc sdp = (String JavaDoc) mappings.get(idp);
71             ASN1EncodableVector dv = new ASN1EncodableVector();
72             dv.add(new DERObjectIdentifier(idp));
73             dv.add(new DERObjectIdentifier(sdp));
74             dev.add(new DERSequence(dv));
75          }
76
77          seq = new DERSequence(dev);
78       }
79
80    public DERObject toASN1Object()
81       {
82          return seq;
83       }
84 }
85
Popular Tags