1 2 package com.ca.commons.security.cert.extensions; 3 4 import com.ca.commons.security.asn1.*; 5 6 23 public class NetscapeCertType implements V3Extension 24 { 25 String value = null; 26 27 public void init(ASN1Object asn1object) throws Exception 28 { 29 if (!asn1object.isASN1Type(ASN1Type.BIT_STRING)) 30 throw new Exception ("Wrong ASN.1 type for NetscapeCertType"); 31 32 byte[] o = (byte[]) asn1object.getValue(); 33 34 StringBuffer buff = new StringBuffer (); 35 36 if ((o[1] & (byte)0x80) != 0) 37 buff.append("SSL client, "); 38 if ((o[1] & (byte)0x40) != 0) 39 buff.append("SSL server, "); 40 if ((o[1] & (byte)0x20) != 0) 41 buff.append("S/MIME, "); 42 if ((o[1] & (byte)0x10) != 0) 43 buff.append("Object Signing, "); 44 if ((o[1] & (byte)0x08) != 0) 45 buff.append("Reserved, "); 46 if ((o[1] & (byte)0x04) != 0) 47 buff.append("SSL CA, "); 48 if ((o[1] & (byte)0x02) != 0) 49 buff.append("S/MIME CA, "); 50 if ((o[1] & (byte)0x01) != 0) 51 buff.append("Object Signing CA, "); 52 53 value = buff.toString(); 54 if (value.endsWith(", ")) 55 value = value.substring(0, value.length() - 2); 56 } 57 58 public String toString() 59 { 60 return value; 61 } 62 } 63 64 | Popular Tags |