getEncoded method

  1. @override
Future<String> getEncoded()
override

Implementation

@override
Future<String> getEncoded() async {
  final pubKeySequence = ASN1Sequence();
  pubKeySequence.add(ASN1Integer(publicKey.modulus!));
  pubKeySequence.add(ASN1Integer(publicKey.exponent!));
  final dataBase64 = base64Encode(pubKeySequence.encodedBytes);

  return '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A$dataBase64\n-----END PUBLIC KEY-----';
}