keySignature method

Uint8List keySignature(
  1. Uint8List signContent,
  2. ECPrivateKey privateKey
)

Implementation

Uint8List keySignature(Uint8List signContent, ECPrivateKey privateKey) {
 var secureRandom = getSecureRandom();
 final signer = ECDSASigner()
   ..init(
     true,
     ParametersWithRandom(
       PrivateKeyParameter(privateKey),
       secureRandom,
     ),
   );
 var signature = signer.generateSignature(signContent) as ECSignature;
 final encodedSignature = ASN1Sequence(elements: [
   ASN1Integer(signature.r),
   ASN1Integer(signature.s),
 ]).encode();
 return encodedSignature;
  }