printAsn1 method

String printAsn1({
  1. dynamic insets = "",
})

Implementation

String printAsn1({insets = ""}) {
  var output = insets;
  output += identifier?.description.toUpperCase() ?? "";
  output += (value != null ? ": $value" : "");
  if (identifier?.typeClass() == ASN1IdentifierClass.UNIVERSAL &&
      identifier?.tagNumber() == ASN1IdentifierTagNumber.OBJECT_IDENTIFIER) {
    var descr = OID.fromValue(value?.toString() ?? "")?.name();
    if (descr != null) {
      output += " ($descr)";
    }
  }
  output += sub != null && sub!.length > 0 ? " {" : "";
  output += "\n";
  for (var item in (sub ?? <ASN1Object>[])) {
    output += item.printAsn1(insets: insets + "    ");
  }
  output += sub != null && sub!.length > 0 ? "}\n" : "";
  return output;
}