SecretKey class

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.

Properties

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

Methods

dispose() → void
Wipes the secret key held in Rust memory. Every later use of this key throws a StateError, and disposing it again does nothing. Copies already exported, such as by toBytes, are not affected. Without a dispose, the key is only wiped if the garbage collector finalizes it, which is not guaranteed.
fingerprint() → Fingerprint
Returns a 256-bit unique identifier for this key. For RSA, that is the SHA256 hash of the raw (le modulus || le exponent) public key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
publicKey() → PublicKey
Retrieves the public counterpart of the secret key.
sign(Uint8List message) → Signature
Creates a digital signature of the message.
toBytes() → Uint8List
Serializes a private key into a 520-byte array.
toDer() → Uint8List
Serializes a private key into a DER buffer.
toPem() → String
Serializes a private key into a PEM string.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

fromBytes(Uint8List bytes) → SecretKey
Parses a 520-byte array into a private key.
fromDer(Uint8List der) → SecretKey
Parses a DER buffer into a private key.
fromPem(String pem) → SecretKey
Parses a PEM string into a private key.
generate() → SecretKey
Creates a new, random private key.