ASN1ObjectIdentifier.fromIdentifierString constructor

ASN1ObjectIdentifier.fromIdentifierString(
  1. String? objectIdentifierAsString, {
  2. int tag = ASN1Tags.OBJECT_IDENTIFIER,
})

Creates an ASN1ObjectIdentifier entity from the given objectIdentifierAsString.

Example:

var oi = ASN1ObjectIdentifier.fromName('2.5.4.3');

Throws an UnsupportedObjectIdentifierException if the given objectIdentifierAsString is not supported

Implementation

ASN1ObjectIdentifier.fromIdentifierString(this.objectIdentifierAsString,
    {int tag = ASN1Tags.OBJECT_IDENTIFIER})
    : super(tag: tag) {
  var identifier =
      ObjectIdentifiers.getIdentifierByIdentifier(objectIdentifierAsString);
  if (identifier != null) {
    objectIdentifierAsString = identifier['identifierString'] as String?;
    readableName = identifier['readableName'] as String?;
    objectIdentifier = identifier['identifier'] as List<int>?;
  } else {
    var splittedInts = objectIdentifierAsString!.split('.');
    objectIdentifier = <int>[];
    for (var i in splittedInts) {
      objectIdentifier!.add(int.parse(i));
    }
  }
}