abla/crypto/p256

Generated from source.

Import with import "abla/crypto/p256".

Source: abla/crypto/p256/entry.ab

Re-exports abla/crypto/result.

p256PublicKey (fun)

fun p256PublicKey(privateKey: string): CryptoResult

The public key, 65 bytes (0x04 || X || Y), of a private key of 32 bytes.

p256IsValidPublicKey (fun)

fun p256IsValidPublicKey(encoded: string): bool

Whether encoded is an uncompressed point of the curve (and so a valid public key).

p256Ecdh (fun)

fun p256Ecdh(privateKey: string, peerPublicKey: string): CryptoResult

ECDH: the x coordinate, 32 bytes, of privateKey times the peer's public point. The peer's point is checked; a private key out of range is refused.

p256GeneratePrivateKey (fun)

fun p256GeneratePrivateKey(): CryptoResult

A random private key of 32 bytes, or a failure if there is no random source (see cryptoSetRandom).

p256EcdsaSignRaw (fun)

fun p256EcdsaSignRaw(privateKey: string, message: string): CryptoResult

ECDSA over SHA-256 (RFC 6979 nonce, so a message always gets the same signature): the 64 bytes r || s.

p256SignatureToDer (fun)

fun p256SignatureToDer(raw: string): string

The signature r || s (64 bytes) as DER, the form X.509 and TLS carry.

p256SignatureFromDer (fun)

fun p256SignatureFromDer(der: string): string

r || s (64 bytes) from a strict DER signature, or "".

p256EcdsaSign (fun)

fun p256EcdsaSign(privateKey: string, message: string): CryptoResult

ECDSA over SHA-256, the signature as DER.

p256EcdsaVerifyDigestRaw (fun)

fun p256EcdsaVerifyDigestRaw(publicKey: string, digest: string, signature: string): bool

Verifies signature (64 bytes, r || s) over a message digest (SHA-256 normally; a longer digest is cut to its leftmost 256 bits, as ECDSA says) by the public key. Public inputs: not constant time.

p256EcdsaVerifyRaw (fun)

fun p256EcdsaVerifyRaw(publicKey: string, message: string, signature: string): bool

ECDSA over SHA-256, the signature as r || s (64 bytes). As in any ECDSA, (r, s) and (r, n - s) both verify: never identify a signed message by its signature bytes.

p256EcdsaVerify (fun)

fun p256EcdsaVerify(publicKey: string, message: string, signature: string): bool

ECDSA over SHA-256, the signature as strict DER. As in any ECDSA, (r, s) and (r, n - s) both verify: never identify a signed message by its signature bytes.

p256EcdsaVerifySha384 (fun)

fun p256EcdsaVerifySha384(publicKey: string, message: string, signature: string): bool

ECDSA over SHA-384 (TLS 1.2's ecdsa_secp256r1 with a longer hash; the digest is cut to 256 bits).

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.