FortisRsaPrivateKey class RSA

An RSA private key used for decryption.

Pure data container wrapping PointyCastle's RSAPrivateKey. Serialization is available via toPem, toDer, and toDerBase64; import via fromPem, fromDer, and fromDerBase64. To decrypt data, build an RsaDecrypter via RsaBuilder.

⚠️ Handle with care — treat the output of toPem / toDer / toDerBase64 as a secret.

Example:

final pair = await Fortis.rsa().generateKeyPair();
final pem = pair.privateKey.toPem();
final restored = FortisRsaPrivateKey.fromPem(pem);

See also:

Constructors

FortisRsaPrivateKey(RSAPrivateKey key)
Creates a FortisRsaPrivateKey from a raw PointyCastle RSAPrivateKey.
const
FortisRsaPrivateKey.fromDer(Uint8List der, {RsaPrivateKeyFormat format = RsaPrivateKeyFormat.pkcs8})
Imports a private key from DER bytes (binary ASN.1).
factory
FortisRsaPrivateKey.fromDerBase64(String base64, {RsaPrivateKeyFormat format = RsaPrivateKeyFormat.pkcs8})
Imports a private key from a Base64-encoded DER string.
factory
FortisRsaPrivateKey.fromPem(String pem, {RsaPrivateKeyFormat format = RsaPrivateKeyFormat.pkcs8})
Imports a private key from a PEM string.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
key → RSAPrivateKey
The underlying PointyCastle key.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDer({RsaPrivateKeyFormat format = RsaPrivateKeyFormat.pkcs8}) Uint8List
Encodes this key as DER bytes (binary ASN.1).
toDerBase64({RsaPrivateKeyFormat format = RsaPrivateKeyFormat.pkcs8}) String
Exports the private key as a Base64-encoded DER string.
toPem({RsaPrivateKeyFormat format = RsaPrivateKeyFormat.pkcs8}) String
Encodes this key as a PEM string.
toString() String
A string representation of this object.
inherited

Operators

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