KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ca > commons > security > cert > extensions > SubjectKeyIdentifier


1
2 package com.ca.commons.security.cert.extensions;
3
4 import com.ca.commons.security.asn1.*;
5 import com.ca.commons.cbutil.CBParse;
6
7 /**
8  * <pre>
9  * SubjectKeyIdentifier ::= KeyIdentifier
10  * KeyIdentifier ::= OCTET STRING
11  * </pre>
12  *
13  * @author vbui
14  */

15 public class SubjectKeyIdentifier implements V3Extension
16 {
17     String JavaDoc value = null;
18     byte [] keyId;
19
20     public byte [] getKeyId() { return keyId; }
21
22     public void init(ASN1Object asn1object) throws Exception JavaDoc
23     {
24         if (!asn1object.isASN1Type(ASN1Type.OCTET_STRING))
25             throw new Exception JavaDoc("Wrong ASN.1 type for SubjectKeyIdentifier");
26
27         keyId = (byte[]) asn1object.getValue();
28         value = CBParse.bytes2HexSplit(keyId, 4);
29     }
30
31     public String JavaDoc toString()
32     {
33         return value;
34     }
35 }
36
37
Popular Tags