KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > protocol > ocsp > FnrFromUnidExtension


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13
14 package org.ejbca.core.protocol.ocsp;
15
16 import org.bouncycastle.asn1.ASN1Encodable;
17 import org.bouncycastle.asn1.DERIA5String;
18 import org.bouncycastle.asn1.DERObject;
19 import org.bouncycastle.asn1.DERObjectIdentifier;
20
21 /** The ASN.1 extension with OID 2.16.578.1.16.3.2 used to request an FNR from a UNID
22  * and respond with the FNR. When requesting, the fnr passed in the extension deas not matter, use 1.
23  *
24  * id-fnrFromUnid OBJECT IDENTIFIER ::= { 2 16 578 1 16 3 2 }
25  *
26  * FnrFromUnid ::= Fnr
27  *
28  * Fnr ::= IA5String
29  *
30  * @author tomas
31  * @version $Id: FnrFromUnidExtension.java,v 1.3 2006/07/30 17:04:32 anatom Exp $
32  *
33  */

34 public class FnrFromUnidExtension extends ASN1Encodable {
35
36     public static final DERObjectIdentifier FnrFromUnidOid = new DERObjectIdentifier("2.16.578.1.16.3.2");
37     
38     private String JavaDoc fnr;
39
40     public static FnrFromUnidExtension getInstance(
41         Object JavaDoc obj)
42     {
43         if (obj == null || obj instanceof FnrFromUnidExtension)
44         {
45             return (FnrFromUnidExtension)obj;
46         }
47         
48         if (obj instanceof DERIA5String)
49         {
50             return new FnrFromUnidExtension((DERIA5String)obj);
51         }
52         
53         throw new IllegalArgumentException JavaDoc("Invalid FnrFromUnidExtension: " + obj.getClass().getName());
54     }
55     
56     public FnrFromUnidExtension(
57         String JavaDoc nr)
58     {
59         this.fnr=nr;
60     }
61
62     public FnrFromUnidExtension(
63             DERIA5String nr)
64     {
65         this.fnr=nr.getString();
66
67     }
68
69     public String JavaDoc getFnr()
70     {
71         return fnr;
72     }
73
74     public DERObject toASN1Object()
75     {
76         return new DERIA5String(fnr);
77     }
78
79 }
80
Popular Tags