RsaDecrypter class

Decrypts data using an RSA private key.

Build via RsaBuilder:

final decrypter = Fortis.rsa()
    .padding(RsaPadding.oaep_v2)
    .hash(RsaHash.sha256)
    .decrypter(pair.privateKey);

final plaintext = decrypter.decrypt(ciphertext);         // Uint8List
final text      = decrypter.decryptToString(ciphertext); // UTF-8 String

The padding, hash, and label (for OAEP v2.1) must match those used by the encrypter; otherwise FortisEncryptionException is thrown.

Constructors

RsaDecrypter({required FortisRsaPrivateKey key, required RsaPadding padding, required RsaHash hash, Uint8List? label})
Creates an RsaDecrypter directly. Prefer RsaBuilder — this constructor is public only for advanced scenarios.
factory

Properties

hash RsaHash
The hash algorithm used by the padding scheme.
final
hashCode int
The hash code for this object.
no setterinherited
key FortisRsaPrivateKey
The private key used to decrypt.
final
label Uint8List?
The label for OAEP v2.1 (null for other paddings).
final
padding RsaPadding
The padding scheme.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decrypt(Object input) Uint8List
Decrypts input and returns the plaintext as raw bytes.
decryptToString(Object input) String
Decrypts input and returns the plaintext as a UTF-8 decoded String.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited