diff options
Diffstat (limited to 'src/main/model/asn1/ObjectIdentifier.java')
-rw-r--r-- | src/main/model/asn1/ObjectIdentifier.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/model/asn1/ObjectIdentifier.java b/src/main/model/asn1/ObjectIdentifier.java index f6e850a..64ade8e 100644 --- a/src/main/model/asn1/ObjectIdentifier.java +++ b/src/main/model/asn1/ObjectIdentifier.java @@ -105,6 +105,22 @@ public class ObjectIdentifier extends ASN1Object { } /** + * EFFECTS: Get OID from a known part, case insensitive. Currently known: C CN OU O L DC. + * Throws {@link ParseException} if the name is unsupported. + */ + public static Integer[] getKnown(String name) throws ParseException { + switch (name.toUpperCase()) { + case "C": return OID_C; + case "CN": return OID_CN; + case "OU": return OID_OU; + case "O": return OID_O; + case "L": return OID_L; + case "DC": return OID_DC; + default: throw new ParseException("Unsupported DN part: " + name); + } + } + + /** * EFFECTS: Parse input OID bytes. * REQUIRES: raw.length >= 1 */ |