encode method

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

Encode the object to their byte representation.

encodingRule defines if the valueByteLength should be encoded as indefinite length (0x80) or fixed length with short/long form. The default is ASN1EncodingRule.ENCODING_DER which will automatically decode in definite length with short form.

Important note: Subclasses need to override this method and may call this method. If this method is called by a subclass, the subclass has to set the valueBytes before calling super.encode().

Implementation

@override
Uint8List encode(
    {ASN1EncodingRule encodingRule = ASN1EncodingRule.ENCODING_DER}) {
  var wrapper = _getWrapper();
  var tmp = ASN1Sequence(elements: [
    contentType,
    wrapper,
  ]);
  return tmp.encode(encodingRule: encodingRule);
}