SignatureAlgorithm<T extends PublicKey> class
abstract
An digital signature algorithm that supports newKeyPair(), sign(), verify().
Available algorithms
Example
In this example, we use Ed25519:
import 'package:cryptography/cryptography.dart';
Future<void> main() async {
final signedMessage = 'Hello, world!';
final ed25519 = Ed25519();
final keyPair = await ed25519.newKeyPair();
final signature = await ed25519.signString(
signedMessage,
keyPair: keyPair,
);
// ...
final isRealSignature = await ed25519.verifyString(
signedMessage,
signature: signature,
);
print('Signature verification result: $isRealSignature');
}
Constructors
- SignatureAlgorithm()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keyPairType
→ KeyPairType<
KeyPairData, PublicKey> -
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
newKeyPair(
) → Future< KeyPair> - Generates a new KeyPair for this algorithm.
-
newKeyPairFromSeed(
List< int> seed) → Future<KeyPair> - Generates a new KeyPair that uses the seed bytes.
-
newSignatureWand(
) → Future< SignatureWand> - Generates a new SignatureWand that has a random KeyPair.
-
newSignatureWandFromKeyPair(
KeyPair keyPair) → Future< SignatureWand> - Generates a new SignatureWand that uses the given KeyPair.
-
newSignatureWandFromSeed(
List< int> seed) → Future<SignatureWand> - Generates a new SignatureWand that uses the given seed bytes.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sign(
List< int> message, {required KeyPair keyPair}) → Future<Signature> - Signs bytes.
-
signString(
String message, {required KeyPair keyPair}) → Future< Signature> - Signs a string.
-
toString(
) → String -
A string representation of this object.
inherited
-
verify(
List< int> message, {required Signature signature}) → Future<bool> -
Verifies whether bytes was signed with
signature
. -
verifyString(
String message, {required Signature signature}) → Future< bool> -
Verifies whether a string was signed with
signature
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited