encode method

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

Encodes this ASN1Object depending on the given encodingRule

If no ASN1EncodingRule is given, ENCODING_DER will be used.

Supported encoding rules are :

Throws an UnsupportedAsn1EncodingRuleException if the given encodingRule is not supported.

Implementation

@override
Uint8List encode(
    {ASN1EncodingRule encodingRule = ASN1EncodingRule.ENCODING_DER}) {
  if (encodingRule != ASN1EncodingRule.ENCODING_DER) {
    throw UnsupportedAsn1EncodingRuleException(encodingRule);
  }
  valueByteLength = 1;
  valueBytes = (boolValue == true)
      ? Uint8List.fromList([BOOLEAN_TRUE_VALUE])
      : Uint8List.fromList([BOOLEAN_FALSE_VALUE]);
  return super.encode();
}