verifyStream abstract method
Verify signature
of data
using this RSASSA-PSS public key.
Returns true
if the signature was made the private key matching this
public key. This uses the Hash specified when the key was
generated or imported. The length of the salt is specified in bytes
using saltLength
.
For limitations on saltLength
see RsaPssPrivateKey.signBytes.
Example
import 'dart:io' show File;
import 'package:webcrypto/webcrypto.dart';
// Generate a key-pair.
final keyPair = await RsaPssPrivateKey.generateKey(
4096,
BigInt.from(65537),
Hash.sha256,
);
// Use the same salt for signing and verifying.
const saltLength = 256 / 8;
// Using privateKey Bob can sign a message for Alice.
final signature = await keyPair.privateKey.signStream(
File('message.txt').openRead(), // read directly from file
saltLength,
);
// Given publicKey and signature Alice can verify the message from Bob.
final isValid = await keypair.publicKey.verifyStream(
signature,
File('message.txt').openRead(), // read directly from file
saltLength,
);
if (isValid) {
print('Authentic message from Bob: $message');
}
Implementation
Future<bool> verifyStream(
List<int> signature,
Stream<List<int>> data,
int saltLength,
);