parse static method

ASN1Null parse(
  1. MutableIterable bytes
)
override

Implementation

static ASN1Null parse(final MutableIterable bytes) {
  if (bytes.length < 2) {
    throw Exception('Invalid data!');
  }

  int tag = bytes.first;
  if (tag != ASN1Type.nullTag) {
    throw Exception('Invalid tag!');
  }
  bytes.mutate = bytes.skip(1);

  if (bytes.first != 0) {
    throw Exception('Invalid length!');
  }
  bytes.mutate = bytes.skip(1);

  return ASN1Null();
}