rsaPssSign static method

Uint8List rsaPssSign(
  1. RSAPrivateKey privateKey,
  2. Uint8List dataToSign,
  3. Uint8List salt, {
  4. String algorithm = 'SHA-256/PSS',
})

Signing the given dataToSign with the given privateKey and the given salt.

The default algorithm used is SHA-256/PSS. All supported algorihms are :

  • MD2/PSS
  • MD4/PSS
  • MD5/PSS
  • RIPEMD-128/PSS
  • RIPEMD-160/PSS
  • RIPEMD-256/PSS
  • SHA-1/PSS
  • SHA-224/PSS
  • SHA-256/PSS
  • SHA-384/PSS
  • SHA-512/PSS

Implementation

static Uint8List rsaPssSign(
    RSAPrivateKey privateKey, Uint8List dataToSign, Uint8List salt,
    {String algorithm = 'SHA-256/PSS'}) {
  //var signer = Signer(algorithm) as PSSSigner;
  var digestName = algorithm.substring(0, algorithm.indexOf('/'));
  var signer =
      LocalPSSSigner(RSAEngine(), Digest(digestName), Digest(digestName));
  signer.init(
      true,
      ParametersWithSalt(
          PrivateKeyParameter<RSAPrivateKey>(privateKey), salt));

  var sig = signer.generateSignature(dataToSign);

  return sig.bytes;
}