encode method

  1. @override
Uint8List encode({
  1. ASN1EncodingRule encodingRule = ASN1EncodingRule.ENCODING_DER,
})
override

Encode the ASN1Null to the byte representation.

This basically returns 0x05, 0x00 or 0x05, 0x81, 0x00 depending on the encodingRule and will not call the super.encode() method.

Supported encoding rules are :

Implementation

@override
Uint8List encode(
    {ASN1EncodingRule encodingRule = ASN1EncodingRule.ENCODING_DER}) {
  switch (encodingRule) {
    case ASN1EncodingRule.ENCODING_DER:
      return Uint8List.fromList([tag!, 0x00]);
    case ASN1EncodingRule.ENCODING_BER_LONG_LENGTH_FORM:
      return Uint8List.fromList([tag!, 0x81, 0x00]);
    default:
      throw UnsupportedAsn1EncodingRuleException(encodingRule);
  }
}