1 2 package com.ca.commons.security.cert.extensions; 3 4 import com.ca.commons.security.asn1.*; 5 6 import java.util.Hashtable ; 7 8 22 public class AuthorityInfoAccess implements V3Extension 23 { 24 String value = null; 25 26 static Hashtable acc = new Hashtable (); 27 28 static 29 { 30 acc.put(ASN1OID.authInfoAccessOCSP, "On-line Certificate Status Protocol"); 31 } 32 33 public void init(ASN1Object asn1object) throws Exception 34 { 35 if (!asn1object.isASN1Type(ASN1Type.SEQUENCE)) 36 throw new Exception ("Wrong ASN.1 type for AuthorityInfoAccess"); 37 38 for (int i = 0; i < asn1object.size(); i++) 39 { 40 if (!(asn1object.getComponent(i) instanceof Sequence)) 41 throw new Exception ("AuthorityInfoAccess component is not sequence"); 42 43 Sequence seq = (Sequence) asn1object.getComponent(i); 44 for (int j = 0; j < seq.size(); j++) 45 { 46 ASN1Object nextComp = seq.getComponent(j); 47 48 if (j == 0) 49 { 50 String accMethod = (String )acc.get(nextComp.getValue()); 51 if (accMethod == null) accMethod = "Unidentified"; 52 53 if (value == null) 54 value = "Access Method: " + accMethod; 55 else 56 value = value + "\n" + "Access Method: " + accMethod; 57 } 58 else if (j == 1) 59 { 60 if (value == null) 61 value = IssuerAltName.getGNameString(nextComp); 62 else 63 value = value + "\n" + IssuerAltName.getGNameString(nextComp); 64 } 65 } 66 } 67 } 68 69 public String toString() 70 { 71 return value; 72 } 73 } 74 75 | Popular Tags |