use of org.xipki.security.exception.InvalidOidOrNameException in project xipki by xipki.
the class CsrGenAction method toOid.
private static ASN1ObjectIdentifier toOid(String str) throws InvalidOidOrNameException {
final int n = str.length();
boolean isName = false;
for (int i = 0; i < n; i++) {
char ch = str.charAt(i);
if (!((ch >= '0' && ch <= '1') || ch == '.')) {
isName = true;
}
}
if (!isName) {
try {
return new ASN1ObjectIdentifier(str);
} catch (IllegalArgumentException ex) {
// CHECKSTYLE:SKIP
}
}
ASN1ObjectIdentifier oid = ObjectIdentifiers.nameToOid(str);
if (oid == null) {
throw new InvalidOidOrNameException(str);
}
return oid;
}
use of org.xipki.security.exception.InvalidOidOrNameException in project xipki by xipki.
the class EnrollCertAction method toOid.
private static ASN1ObjectIdentifier toOid(String str) throws InvalidOidOrNameException {
final int n = str.length();
boolean isName = false;
for (int i = 0; i < n; i++) {
char ch = str.charAt(i);
if (!((ch >= '0' && ch <= '1') || ch == '.')) {
isName = true;
}
}
if (!isName) {
try {
return new ASN1ObjectIdentifier(str);
} catch (IllegalArgumentException ex) {
// CHECKSTYLE:SKIP
}
}
ASN1ObjectIdentifier oid = ObjectIdentifiers.nameToOid(str);
if (oid == null) {
throw new InvalidOidOrNameException(str);
}
return oid;
}
Aggregations