Import std.crypto.signatures
EcdsaP256
struct
Public Struct EcdsaP256
ECDSA on NIST's P-256 with SHA-256 (ES256): a private key is 32 bytes, a public key its point, uncompressed, 65 bytes, and a signature r then s, 64 bytes.
Examples
Local privateKey = EcdsaP256.NewPrivateKey()
Local publicKey = EcdsaP256.PublicKeyOf(privateKey)
Expect(publicKey.Count == 65)
Local signature = EcdsaP256.Sign(privateKey, "a message")
Expect(EcdsaP256.Verify(publicKey, "a message", signature))std/crypto/signatures.fb, line 100
-
A new random private key.
-
privateKey's public key. Panics unlessprivateKeyis a P-256 private key. -
@PanicsAtCaller Public Static Method Sign(privateKey: UInt8[], message: UInt8[]): UInt8[]static method #message's signature withprivateKey, deterministic, as RFC 6979 makes it, so it needs no random number. Panics unlessprivateKeyis a P-256 private key. -
@PanicsAtCaller Public Static Method Sign(privateKey: UInt8[], text: String): UInt8[]static method #text's signature, by its UTF-8 bytes, withprivateKey. Panics unlessprivateKeyis 32 bytes, a number from 1 up to the curve's order. -
Public Static Method Verify(publicKey: UInt8[], message: UInt8[], signature: UInt8[]): Boolstatic method #Whether
signatureispublicKey's ofmessage. -
Public Static Method Verify(publicKey: UInt8[], text: String, signature: UInt8[]): Boolstatic method #Whether
signatureispublicKey's oftext's UTF-8 bytes.
Report an issue with this page or with FutureBlitz on GitHub.