* @throws BadNameException
*/
public Name(String rfc2253String, int encType) throws BadNameException {
super(8);
ASN1ObjectIdentifier oid;
RFC2253Parser p;
ASN1Sequence seq;
Iterator i;
ASN1Set set;
String key;
String val;
AVA entry;
initMaps();
if (encType == -1) {
if (!allowDefaultEncoding_) {
throw new BadNameException(
"Use the other constructor with the explicit "
+ "encoding parameter!");
}
currentEncoding_ = defaultEncoding_;
} else {
if (encType != UTF8_ENCODING && encType != T61_ENCODING
&& encType != PRINTABLE_ENCODING && encType != IA5_ENCODING) {
throw new BadNameException("Unknown EncodingType: " + encType);
}
currentEncoding_ = encType;
}
p = new RFC2253Parser();
set = new ASN1Set(1);
for (i = p.parse(rfc2253String).iterator(); i.hasNext();) {
entry = (AVA) i.next();
key = entry.getKey();
key = key.toUpperCase();
oid = (ASN1ObjectIdentifier) a2oid_.get(key);
seq = new ASN1Sequence(2);
if (oid == null) {
try {
oid = new ASN1ObjectIdentifier(key);
} catch (Exception e) {
throw new BadNameException("Unsupported attribute key: \""
+ key + "\"");
}
}
seq.add(oid.clone());
if (entry.isEncodedValue()) {
ByteArrayInputStream in;
BERDecoder dec;
ASN1Type obj;