Public Key Signing

Index

sign/bytes sign/context-bytes sign/create sign/final-create sign/final-verify sign/keygen sign/keygen-deterministic sign/new-state sign/public-key-bytes sign/secret-key-bytes sign/seed-bytes sign/update sign/verify

Reference

sign/bytesnumber 64

Number of bytes in a signature.

Number of bytes needed for a signature context.

sign/createcfunction
(sign/create msg ctx sk)

Create a new sigature from a message, ctx, and secret key. The message can be any byte sequence, the context ctx should be a byte sequence of at least 8 bytes, and the secret key sk should be secret key as generated from sign/keygen or sign/keygen-deterministic. Returns a signature, which is a 64 byte string.

(sign/final-create state sk)

Create a signature from the sign-state. Takes a jhydro/sign-state state and a secret key sk. Returns the signature and also modifies the state.

(sign/final-verify state csig pk)

Verify a signature with a public key. Given a sign-state state, signature csig, and public key pk, return true if csig is valid, otherwise false.

sign/keygencfunction
(sign/keygen)

Create a random key pair for public key signing. Returns a struct containing a :public-key and a :secret-key as strings.

(sign/keygen-deterministic seed)

Create a key pair from a seed. Seed should be a byte sequence of at least 32 bytes; random/buf should work well. Returns a struct of two key value pairs, a :secret-key and a :public-key. Each key is a string.

(sign/new-state ctx)

Create a new state machine for generating a signature. A state machine allows processing a message in chunks to generate a signature. A string ctx of at least 8 bytes is also required, and can be a hard coded string. Returns a new jhydro/sign-state.

Number of bytes in a public key for making signatures.

Number of bytes in a secret key for making signatures.

Number of bytes in a seed for generating a key.

sign/updatecfunction
(sign/update state msg)

Process a message chunk for generating a signature. Returns the modified signature state.

sign/verifycfunction
(sign/verify csig msg ctx pk)

Check a signature to determine if a message is authentic. csig is the signature as generated by sign/create or sign/final-create, msg is the message that we are checking, ctx is the context string, and pk is the public key. Returns a boolean, true if the signature is valid, false otherwise.