rsaSign static method
Signing the given dataToSign
with the given privateKey
.
algorithm
support SHA-256/RSA only
Implementation
static Uint8List rsaSign(RSAPrivateKey privateKey, Uint8List dataToSign) {
const String algorithmName = 'SHA-256/RSA';
final RSASigner signer = Signer(algorithmName) as RSASigner;
signer.init(true, PrivateKeyParameter<RSAPrivateKey>(privateKey));
final RSASignature sig = signer.generateSignature(dataToSign);
return sig.bytes;
}