<h1>TweetNaCl Bindings</h1>

<h2>Synopsis</h2>

<code>(import (crypto tweetnacl))</code>

Bindings to the library of cryptographic operations.

<h2>Keys</h2>

<h3>record:
<h3>procedure: <code>(key?
<h3>procedure: <code>(make-key <i>algorithm</i> <i>public</i>
<h3>procedure: <code>(key-algorithm
<h3>procedure: <code>(public-key
<h3>procedure: <code>(secret-key

Keys are represented by record instances that hold an algorithm name, a public key bytevector and a secret key bytevector. Depending on the algorithm and intended use of the key, either the public or secret component may be <tt>#f</tt>.

<h3>procedure: <code>(check-key <i>who</i> <i>algorithm</i>

Ensures that the given value is a key with the given algorithm name and returns the key. If the value does not pass the check, an error condition is raised that contains a <tt>&who</tt> condition indicating the given location.

<h2>Asymmetric Boxes</h2>

<h3>constant:

The name of the asymmetric box algorithm.

<h3>constant:
<h3>constant:
<h3>constant:

Byte lengths of algorithm parameters.

<h3>procedure:
<h3>procedure: <code>(make-asymmetric-box-key

Generate a new keypair using entropy from the given port or from <tt>(current-entropy-port)</tt>.

<h3>procedure: <code>((asymmetric-box <i>pk</i> <i>sk</i>) <i>data</i>
<h3>procedure: <code>((asymmetric-unbox <i>pk</i> <i>sk</i>) <i>data</i>

Perform key agreement and return boxing and unboxing procedures.

<h2>Asymmetric Signatures</h2>

<h3>constant:

The name of the asymmetric signature algorithm.

<h3>constant:
<h3>constant:

Byte lengths of algorithm parameters.

<h3>procedure:
<h3>procedure: <code>(make-asymmetric-sign-key

Generate a new keypair using entropy from the given port or from <tt>(current-entropy-port)</tt>.

<h3>procedure: <code>((asymmetric-sign <i>sk</i>)
<h3>procedure: <code>((asymmetric-verify <i>pk</i>)

Create signature and verification procedures.

<h2>Symmetric Boxes</h2>

<h3>constant:

The name of the symmetric box algorithm.

<h3>constant:
<h3>constant:

Byte lengths of algorithm parameters.

<h3>procedure:
<h3>procedure: <code>(make-symmetric-box-key

Generate a new key using entropy from the given port or from <tt>(current-entropy-port)</tt>.

<h3>procedure: <code>((symmetric-box <i>k</i>) <i>data</i>
<h3>procedure: <code>((symmetric-unbox <i>k</i>) <i>data</i>

Create boxing and unboxing procedures.

<h2>Symmetric Signatures</h2>

<h3>constant:

The name of the symmetric signature algorithm.

<h3>constant:

Byte lengths of algorithm parameters.

<h3>procedure:
<h3>procedure: <code>(make-symmetric-sign-key

Generate a new key using entropy from the given port or from <tt>(current-entropy-port)</tt>.

<h3>procedure: <code>((symmetric-sign <i>k</i>)
<h3>procedure: <code>((symmetric-verify <i>k</i>)

Create signature and verification procedures.

<h2>Message Digests</h2>

<h3>constant:

The name of the message digest algorithm.

<h3>procedure: <code>(hash

Compute the message digest of binary data.