Key class

An active key or keypair instance.

Constructors

Key(LocalKeyHandle localKeyHandle)
Initializes the Key instance.

Properties

aeadParams AeadParams
Gets the AEAD parameters.
no setter
aeadRandomNonce Uint8List
Generates a random nonce for AEAD.
no setter
algorithm KeyAlgorithm
Gets the key algorithm.
no setter
ephemeral bool
Gets whether the key is ephemeral.
no setter
handle LocalKeyHandle
no setter
hashCode int
The hash code for this object.
no setterinherited
jwkPublic Jwk
Gets the public JWK.
no setter
jwkSecret Jwk
Gets the secret JWK.
no setter
jwkThumbprint String
Gets the JWK thumbprint.
no setter
localKeyHandle LocalKeyHandle
final
publicBytes Uint8List
Gets the public key bytes.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secretBytes Uint8List
Gets the secret key bytes.
no setter

Methods

aeadDecrypt({required Uint8List ciphertext, required Uint8List nonce, Uint8List? tag, Uint8List? aad}) Uint8List
Decrypts a message using AEAD.
aeadEncrypt({required Uint8List message, Uint8List? nonce, Uint8List? aad}) EncryptedBuffer
Encrypts a message using AEAD.
convertKey({required KeyAlgorithm algorithm}) Key
Converts this key or keypair to its equivalent for another key algorithm.
keyFromKeyExchange({required KeyAlgorithm algorithm, required Key secretKey, required Key publicKey}) Key
Derives an instance of this key directly from a supported key exchange.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
signMessage({required Uint8List message, required SignatureAlgorithm sigType}) Uint8List
Signs a message.
toString() String
A string representation of this object.
inherited
unwrapKey({required KeyAlgorithm algorithm, Uint8List? tag, required Uint8List ciphertext, Uint8List? nonce}) Key
Unwraps a key.
verifySignature({required Uint8List message, required Uint8List signature, required SignatureAlgorithm sigType}) bool
Verifies a signature.
wrapKey({required Key other, Uint8List? nonce}) EncryptedBuffer
Wraps a key.

Operators

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

Static Methods

fromJwk({required Jwk jwk}) Key
Create a new key instance from a JWK
fromPublicBytes({required KeyAlgorithm algorithm, required Uint8List publicKey}) Key
Creates a new key instance from a slice of public key bytes.
fromSecretBytes({required KeyAlgorithm algorithm, required Uint8List secretKey}) Key
Creates a new key instance from a slice of key secret bytes.
fromSeed({required KeyAlgorithm algorithm, required Uint8List seed, KeyMethod method = KeyMethod.none}) Key
Creates a new deterministic key or keypair from a seed.
generate(KeyAlgorithm algorithm, KeyBackend keyBackend, {bool ephemeral = false}) Key
Generates a new key.