rsa_digitalsignature 1.0.5 rsa_digitalsignature: ^1.0.5 copied to clipboard
A plugin for signing data with privateKey RSACNG for windows & MacOS.
RSA Digital Signature #
Library for SignData use RSACNG privateKey with support for macos, windows
Usage #
Retreive all certificate has NonRepudiation KeyUsage #
import 'package:rsa_digitalsignature/rsa_digitalsignature.dart';
import 'package:rsa_digitalsignature/certificate.dart';
final RsaDigitalsignature _rsaDigitalSignaturePlugin =RsaDigitalsignature();
final List<Certificate> _certificates = await _rsaDigitalSignaturePlugin.getCertifications();
SignData With PrivateKey #
final String message = "Hello World !";
final Uint8List dataToSign = Uint8List.fromList(utf8.encode(message));
final Digest hash = sha256.convert(dataToSign);
final dynamic publickey = await _rsaDigitalSignaturePlugin.signWithprivatekey((hash.bytes as Uint8List), _selectedCertificate!.publickey);
Uint8List datasigned = Uint8List.fromList(List<int>.from(publickey as List<dynamic>));
Cerificate Class #
class Certificate {
final Uint8List publickey; <-- DER Certificate
final X509Certificate x509certificate; <-- X509 Instance
final String cn; <-- Common Name
const Certificate(
{required this.publickey,
required this.x509certificate,
required this.cn});
}
Setup #
Windows #
No additional setup required.
MacOS #
No additional setup required.
Example #
Inside example folder
cd example && flutter run