1 13 14 package org.ejbca.core.model.ca.certextensions; 15 16 import java.util.Iterator ; 17 import java.util.Properties ; 18 19 import org.bouncycastle.asn1.DEREncodable; 20 import org.ejbca.core.model.ca.caadmin.CA; 21 import org.ejbca.core.model.ca.certificateprofiles.CertificateProfile; 22 import org.ejbca.core.model.ra.UserDataVO; 23 24 35 36 public abstract class CertificateExtension { 37 38 private int id; 39 private String oID; 40 private boolean criticalFlag; 41 private Properties properties; 42 43 46 protected CertificateExtension() { 47 super(); 48 } 49 50 53 public int getId() { 54 return id; 55 } 56 57 60 public String getOID() { 61 return oID; 62 } 63 64 67 public boolean isCriticalFlag() { 68 return criticalFlag; 69 } 70 71 78 protected Properties getProperties() { 79 return properties; 80 } 81 82 91 public void init(int id, String oID, boolean criticalFlag, Properties config){ 92 this.id = id; 93 this.oID = oID; 94 this.criticalFlag = criticalFlag; 95 96 this.properties = new Properties (); 97 Iterator keyIter = config.keySet().iterator(); 98 String matchString = "id" + id + ".property."; 99 while(keyIter.hasNext()){ 100 String nextKey = (String ) keyIter.next(); 101 if(nextKey.startsWith(matchString)){ 102 if(nextKey.length() > matchString.length()){ 103 properties.put(nextKey.substring(matchString.length()), config.get(nextKey)); 104 } 105 } 106 } 107 } 108 109 118 public abstract DEREncodable getValue(UserDataVO userData, CA ca, CertificateProfile certProfile ) throws CertificateExtentionConfigurationException; 119 120 121 } 122 | Popular Tags |