encode method
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);
}
if (integer!.bitLength == 0) {
if (integer == BigInt.from(-1)) {
valueBytes = Uint8List.fromList([0xff]);
} else {
valueBytes = Uint8List.fromList([0]);
}
} else {
valueBytes = encodeBigInt(integer);
}
valueByteLength = valueBytes!.length;
return super.encode();
}