HydroSign

This module contains functions for signing data, both single- and multi-part.

Example:

(def context (Hydro.context "Examples"))
(def msg (Hydro.buf "Test"))

(let [keypair (HydroSign.keygen)
      signature (Maybe.unsafe-from (HydroSign.create msg context
                                                     keypair))]
  (println* (HydroSign.verify signature msg context keypair))))

create

defn

(Fn [(Ref (Array Byte) a), (Ptr CChar), (Ref HydroSignKeyPair b)] (Maybe (Array Byte)))

                    (create msg ctx keypair)
                

signs a message msg, using the context ctx and the keypair keypair.

final-create

defn

(Fn [(Ref HydroSignState a), (Ref HydroSignKeyPair b)] (Maybe (Array Byte)))

                    (final-create s keypair)
                

finalizes a sign state s with a keypair keypair. Returns a signature.

final-verify

defn

(Fn [(Ref HydroSignState a), (Array Byte), (Ref HydroSignKeyPair b)] Bool)

                    (final-verify s signature keypair)
                

finalizes a sign state s with a signature signature and a keypair keypair. Returns a boolean signifying whether we were able to verify the signature.

init

external

(Fn [(Ref HydroSignState a), (Ptr CChar)] Bool)

initializes a state for multi-part signing, using a context.

keygen

defn

(Fn [] HydroSignKeyPair)

                    (keygen)
                

generates a key for use in signing procedures.

state

external

(Fn [] HydroSignState)

generates a state for multi-part signing.

update

defn

(Fn [(Ref HydroSignState a), (Ref (Array Byte) b)] Int)

                    (update s buf)
                

updates a sign state s with a buffer buf.

verify

defn

(Fn [(Ref (Array Byte) a), (Ref (Array Byte) b), (Ptr CChar), (Ref HydroSignKeyPair c)] Bool)

                    (verify signature msg ctx keypair)
                

verifies a signature signature for a message msg, using the context ctx and the keypair keypair.