1 17 18 package org.apache.geronimo.util.asn1.x509; 19 20 import java.io.IOException ; 21 22 import org.apache.geronimo.util.asn1.DERBMPString; 23 import org.apache.geronimo.util.asn1.DERIA5String; 24 import org.apache.geronimo.util.asn1.DERObject; 25 import org.apache.geronimo.util.asn1.DERObjectIdentifier; 26 import org.apache.geronimo.util.asn1.DERPrintableString; 27 import org.apache.geronimo.util.asn1.DERUTF8String; 28 29 33 public class X509DefaultEntryConverter 34 extends X509NameEntryConverter 35 { 36 44 public DERObject getConvertedValue( 45 DERObjectIdentifier oid, 46 String value) 47 { 48 if (value.length() != 0 && value.charAt(0) == '#') 49 { 50 try 51 { 52 return convertHexEncoded(value, 1); 53 } 54 catch (IOException e) 55 { 56 throw new RuntimeException ("can't recode value for oid " + oid.getId()); 57 } 58 } 59 else if (oid.equals(X509Name.EmailAddress)) 60 { 61 return new DERIA5String(value); 62 } 63 else if (canBePrintable(value)) 64 { 65 return new DERPrintableString(value); 66 } 67 else if (canBeUTF8(value)) 68 { 69 return new DERUTF8String(value); 70 } 71 72 return new DERBMPString(value); 73 } 74 } 75 | Popular Tags |