I am trying to reference an unregistered ASN.1 Object Identifier which is compliant with the {joint-iso-itu-t(2) uuid(25)}
arc. I am using the com.objsys.asn1j.runtime package.
But it seems that the asn1rt library only accepts int[] as identifier. I can't pass the value of the UUID component of the OID string as int as such:
public Asn1ObjectIdentifier getAttributeOID() {
int[] identifierValue = { 2, 25, singleIntegerValue}; // last part is greater than int max
return new Asn1ObjectIdentifier(identifierValue);
}
I have tried to use the decode method as explained in the objsys.com docs as following:
public Asn1ObjectIdentifier getAttributeOID() {
//uuid part is converted to integer value from uuid according to ITU-T X.667 Section 6.3 using
String oid = "2.25.142312163956071652603888631318689442116";
Asn1BerDecodeBuffer decodeBuffer = new Asn1BerDecodeBuffer(oid.getBytes(StandardCharsets.UTF_8));
Asn1ObjectIdentifier asn1ObjectIdentifier = new Asn1ObjectIdentifier();
try {
asn1ObjectIdentifier.decode(decodeBuffer, false, oid.length());
} catch (IOException e) {
throw new RuntimeException(e);
}
return asn1ObjectIdentifier;
}
However this approach also does not get me the correct identifier value in the resulting object. It outputs something like this:
1.10.46.50.53.46.49.52.50.51.49.50.49.54.51.57.53.54.48.55.49.54.53.50.54.48.51.…
I have also failed when trying BouncyCastle to encode the object identifier and then tried to decode it with the api from the com.objsys.asn1j.runtime
package. Didn't work.
Obj-sys documentation shows that the java mapping for OBJECT IDENTIFIER is an array of int (so it's a limitation)
I'm surprised you ask the question here, they have a contact form