rsa library
RSA cryptography wrappers and parametrization.
https://datatracker.ietf.org/doc/html/rfc8017
RSA-2048 with PKCS#1 v1.5 padding over SHA-256, the classical scheme kept
for places where a boot ROM or a legacy system dictates it. New designs
should use the xdsa library. Only 2048-bit moduli with the exponent 65537
are accepted, and encryption is deliberately not exposed.
import 'dart:convert';
import 'package:darkbio_crypto/rsa.dart' as rsa;
void example() {
final secret = rsa.SecretKey.generate();
final signature = secret.sign(utf8.encode('hello'));
secret.publicKey().verify(utf8.encode('hello'), signature);
}
Classes
- Fingerprint
- A 256-bit unique identifier for an RSA key, the SHA256 hash of its raw public key in little-endian format (modulus || exponent).
- PublicKey
- A 2048-bit RSA public key usable for verification, with SHA256 as the underlying hash algorithm. Whilst RSA could also be used for decryption, that is not exposed on the API as it's not required by the project.
- SecretKey
- A 2048-bit RSA private key usable for signing, with SHA256 as the underlying hash algorithm. Whilst RSA could also be used for encryption, that is not exposed on the API as it's not required by the project.
- Signature
- A 256-byte RSA-2048 digital signature.