HmacSecretKey class abstract
Key for signing/verifying with HMAC.
An HmacSecretKey instance holds a symmetric secret key and a Hash, which can be used to create and verify HMAC signatures as specified in FIPS PUB 180-4.
Instances of HmacSecretKey can be imported from:
- Raw bytes using HmacSecretKey.importRawKey, and,
JWK
format using HmacSecretKey.importJsonWebKey.
A random key can also be generated using HmacSecretKey.generateKey.
- Annotations
-
- @sealed
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
-
exportJsonWebKey(
) → Future< Map< String, dynamic> > - Export HmacSecretKey as JSON Web Key.
-
exportRawKey(
) → Future< Uint8List> - Export HmacSecretKey as raw bytes.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
signBytes(
List< int> data) → Future<Uint8List> -
Compute an HMAC signature of given
data
. -
signStream(
Stream< List< data) → Future<int> >Uint8List> -
Compute an HMAC signature of given
data
stream. -
toString(
) → String -
A string representation of this object.
inherited
-
verifyBytes(
List< int> signature, List<int> data) → Future<bool> -
Verify the HMAC
signature
of givendata
. -
verifyStream(
List< int> signature, Stream<List< data) → Future<int> >bool> -
Verify the HMAC
signature
of givendata
stream.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
generateKey(
Hash hash, {int? length}) → Future< HmacSecretKey> -
Generate random
HmacSecretKey
. -
importJsonWebKey(
Map< String, dynamic> jwk, Hash hash, {int? length}) → Future<HmacSecretKey> -
Import
HmacSecretKey
from JSON Web Key. -
importRawKey(
List< int> keyData, Hash hash, {int? length}) → Future<HmacSecretKey> -
Import
HmacSecretKey
from rawkeyData
.