Import std.crypto.signatures
std.crypto.signatures
Ed25519, over Monocypher, and EcdsaP256, Rsa, and X25519, over mbedTLS: signatures, which a private key makes and its public key checks, and key exchange, which gives two sides one secret from their own private keys and each other's public ones. Keys are bytes, as each one's Methods say; Key reads and writes them as PEM. A key or signature that isn't one verifies nothing.
std/crypto/signatures.fb
Types
Ed25519
struct
Public Struct Ed25519
Ed25519 (RFC 8032), EdDSA on Curve25519 with SHA-512: a private key is a 32-byte seed, a public key 32 bytes, and a signature 64 bytes, deterministic, so signing needs no random number.
std/crypto/signatures.fb, line 32
-
A new random private key.
-
privateKey's public key. Panics unlessprivateKeyis 32 bytes. -
@PanicsAtCaller Public Static Method Sign(privateKey: UInt8[], message: UInt8[]): UInt8[]static method #message's signature withprivateKey. Panics unlessprivateKeyis 32 bytes. -
@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. -
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.
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.
std/crypto/signatures.fb, line 78
-
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.
Rsa
struct
Public Struct Rsa
RSA signatures, to verify, with SHA-256: a public key is PKCS #1's DER of its modulus and exponent, which PublicKey makes from them, or Key reads from PEM. A modulus has up to 8192 bits, of any number, and a key with a larger one verifies nothing.
std/crypto/signatures.fb, line 134
-
The public key of
modulusandexponent, big-endian bytes, as JWK's "n" and "e" are. -
Public Static Method Verify(publicKey: UInt8[], message: UInt8[], signature: UInt8[]): Boolstatic method #Whether
signatureispublicKey's ofmessageby RSASSA-PKCS1-v1_5 (RS256). -
Public Static Method Verify(publicKey: UInt8[], text: String, signature: UInt8[]): Boolstatic method #Whether
signatureispublicKey's oftext's UTF-8 bytes, by RSASSA-PKCS1-v1_5 (RS256). -
Public Static Method VerifyPss(publicKey: UInt8[], message: UInt8[], signature: UInt8[]): Boolstatic method #Whether
signatureispublicKey's ofmessageby RSASSA-PSS, with MGF1 by SHA-256 and a salt of 32 bytes, as long as the hash (PS256). -
Public Static Method VerifyPss(publicKey: UInt8[], text: String, signature: UInt8[]): Boolstatic method #Whether
signatureispublicKey's oftext's UTF-8 bytes, by RSASSA-PSS (PS256).
X25519
struct
Public Struct X25519
X25519 key exchange (RFC 7748): private and public keys are 32 bytes each, and so is the secret two sides share, which a KDF, like Hkdf, makes keys from.
std/crypto/signatures.fb, line 170
-
A new random private key.
-
privateKey's public key, to give the other side. Panics unlessprivateKeyis 32 bytes.
Report an issue with this page or with FutureBlitz on GitHub.