generateSignature method

  1. @override
RSASignature generateSignature(
  1. Uint8List message, {
  2. bool normalize = false,
})
override

Sign the passed in message (usually the output of a hash function)

Implementation

@override
RSASignature generateSignature(Uint8List message, {bool normalize = false}) {
  if (!_forSigning) {
    throw StateError('Signer was not initialised for signature generation');
  }

  var hash = Uint8List(_digest.digestSize);
  _digest.reset();
  _digest.update(message, 0, message.length);
  _digest.doFinal(hash, 0);

  var data = _derEncode(hash);
  var out = Uint8List(_rsa.outputBlockSize);
  var len = _rsa.processBlock(data, 0, data.length, out, 0);
  return RSASignature(out.sublist(0, len));
}