@@ -5,58 +5,36 @@ template = "doc.html"
7This is a summary of the cryptography functions found in `sys/zuse.hoon`, Arvo's
7This is a summary of the cryptography functions found in `sys/zuse.hoon`, Arvo's
8−standard library.
8+standard library. This page currently only documents cryptographic functions
9+directly utilized by [Ames](@/docs/arvo/ames/ames.md). `zuse` also contains
10+cryptographic functions relevant to Ethereum such as the `+keccak:crypto` core,
11+but they are currently undocumented.
13+Documentation for [Insecure Hashing](@/docs/hoon/reference/stdlib/2e.md) and the
14+[SHA Hash Family](@/docs/reference/stdlib/3d.md) is found in the Hoon standard
12−`zuse` contains several cryptosuites. The only ones currently in use are
19+`zuse` contains several cryptosuites. The ones utilized by Ames are
13−`+ed:crypto`, `+aes:crypto`, and `+crub:crypto`, with the latter being the
20+[`+ed:crypto`](#ed), [`+aes:crypto`](#aes), and [`+crub:crypto`](#crub), with
14−only one which is implementable as an [`+acru:ames`
21+the latter being the only one which is implementable as an [`+acru:ames`
15core](@/docs/arvo/ames/cryptography/#crypto-core).
22core](@/docs/arvo/ames/cryptography/#crypto-core).
17−### `+ed:crypto` {#ed}
19−This core contains cryptographic primitives and helper functions for elliptic
20−curve cryptography with [Curve25519](https://en.wikipedia.org/wiki/Curve25519).
22−`+ed:crypto` is used to generate public/private keypairs from a seed for use
24−Diffie-Hellman](https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman)
25−key agreements as well as [Elliptic Curve Digital Signature
26−Algorithm](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm).
27−These functionalities are ultimately utilized by [`+crub:crypto`](#crub), the
28−only cryptosuite which [Ames](@/docs/arvo/ames/ames.md) makes use of.
30−Most gates in `+ed:crypto` are [jetted](@/docs/vere/jetting.md), meaning that an
31−external reference library is utilized whenever these functions are called,
32−rather than running in Nock natively. See the [Vere
33−documentation](@/docs/vere/cryptography/#ed) for more information about the
34−library utilized by jets.
36−### `+aes:crypto` {#aes}
38−This core contains cryptographic primitives and helper functions for
39−[AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) symmetric key
40−encryption and decryption. As is the case with `ed:crypto`, these
41−functionalities are utilized by [`+crub:crypto`](#crub), and most functions are
42−jetted. See also the Vere documentation on [AES
43−SIV](@/docs/vere/cryptography/#aes) for more information about the library
46−### `+crub:crypto` {#crub}
24+## `+crub:crypto` {#crub}
48`+crub:crypto` implements an
26`+crub:crypto` implements an
49[`+acru:ames`](@/docs/arvo/ames/cryptography/#crypto-core) core that implements
27[`+acru:ames`](@/docs/arvo/ames/cryptography/#crypto-core) core that implements
50[Suite B Cryptography](https://en.wikipedia.org/wiki/NSA_Suite_B_Cryptography).
28[Suite B Cryptography](https://en.wikipedia.org/wiki/NSA_Suite_B_Cryptography).
52−It utilizes AES symmetric key encryption and decryption from `+aes:crypto`
30+It utilizes AES symmetric key encryption and decryption from [`+aes:crypto`](#aes)
53implemented using the Diffie-Hellman key exchange protocol, elliptic curve
31implemented using the Diffie-Hellman key exchange protocol, elliptic curve
54−digital signature algorithm (ECDSA) signing and verification with `+ed:crypto`,
32+digital signature algorithm (ECDSA) signing and verification with [`+ed:crypto`](#ed),
55and generates public/private key pairs using elliptic curve cryptography with
33and generates public/private key pairs using elliptic curve cryptography with
56`+ed:crypto`.
34`+ed:crypto`.
58−`+crub:crypto` is called with public encryption and authentication keys and
36+A `+crub:crypto` core's payload contains public encryption and authentication
59−optional secret encryption and authentication keys.
37+keys and optional secret encryption and authentication keys.
61 ++ crub !:
39 ++ crub !:
@@ -64,10 +42,9 @@ optional secret encryption and authentication keys.
67−`+crub` cores are typically not created by directly calling the gate, but
68−instead using one of the constructors in `+nu:crub`.
45+`+crub` cores are typically created using one of the constructors in [`+nu:crub`](#nu).
70−#### `+seal:as`
47+### `+seal:as`
73 ++ seal ::
50 ++ seal ::
@@ -81,7 +58,7 @@ signed message using `+en:siva:aes` with the symmetric key, and then `+jam`s it.
82Crashes if `sek` is null.
59Crashes if `sek` is null.
84−#### `+sign:as`
61+### `+sign:as` {#sign:as}
87 ++ sign ::
64 ++ sign ::
@@ -94,7 +71,7 @@ cell `[signed-message msg]` and `+jam`s it.
95Crashes if `sek` is null.
72Crashes if `sek` is null.
97−#### `+sure:as`
74+### `+sure:as`
100 ++ sure ::
77 ++ sure ::
@@ -106,7 +83,7 @@ Crashes if `sek` is null.
106`sig` was `msg` signed using the secret key associated to the public key stored
83`sig` was `msg` signed using the secret key associated to the public key stored
107at `sgn.pub`. Returns `(unit msg)` if so, null otherwise.
84at `sgn.pub`. Returns `(unit msg)` if so, null otherwise.
109−#### `+tear:as`
86+### `+tear:as`
112 ++ tear ::
89 ++ tear ::
@@ -123,7 +100,7 @@ is successful, verifies the decrypted message using authentication key part of
124Crashes if `sek` is null.
101Crashes if `sek` is null.
126−#### `+de`
103+### `+de`
129 ++ de :: decrypt
106 ++ de :: decrypt
@@ -131,10 +108,10 @@ Crashes if `sek` is null.
134−`+cue`s `txt` then decrypts with the symmetric key `key` using `de:sivc:aes`.
111+`+cue`s `txt` then decrypts with the symmetric key `key` using `+de:sivc:aes`.
135Returns null in case of failure.
112Returns null in case of failure.
137−#### `+dy`
114+### `+dy`
140 ++ dy :: need decrypt
117 ++ dy :: need decrypt
@@ -144,7 +121,7 @@ Returns null in case of failure.
145Same as `+dy`, but crashes in case of failure.
122Same as `+dy`, but crashes in case of failure.
147−#### `+en`
124+### `+en` {#en}
150 ++ en :: encrypt
127 ++ en :: encrypt
@@ -154,23 +131,23 @@ Same as `+dy`, but crashes in case of failure.
154Encrypts `msg` with the symmetric key `key` using `en:sivc:aes`, then `+jam`s
131Encrypts `msg` with the symmetric key `key` using `en:sivc:aes`, then `+jam`s
157−#### `+fig:ex`
134+### `+fig:ex`
159Returns the fingerprint (SHA-256) of `+pub:ex`.
136Returns the fingerprint (SHA-256) of `+pub:ex`.
161−#### `+pac:ex`
138+### `+pac:ex`
163Returns the fingerprint (SHA-256) of `+sec:ex`. Crashes if `sek` is null.
140Returns the fingerprint (SHA-256) of `+sec:ex`. Crashes if `sek` is null.
165−#### `+pub:ex`
142+### `+pub:ex`
167Returns the concatenation of `sgn.pub` and `cry.pub`.
144Returns the concatenation of `sgn.pub` and `cry.pub`.
169−#### `+sec:ex`
146+### `+sec:ex`
171Returns the concatenation of `sgn.u.sek` and `cry.u.sek`.
148Returns the concatenation of `sgn.u.sek` and `cry.u.sek`.
173−#### `+pit:nu`
150+### `+pit:nu` {#nu}
176 ++ pit :: create keypair
153 ++ pit :: create keypair
@@ -186,7 +163,7 @@ private keys.
186This is how one typically generates a brand new `+crub` core for signing and
163This is how one typically generates a brand new `+crub` core for signing and
187encrypting your own messages.
164encrypting your own messages.
189−#### `+nol:nu`
166+### `+nol:nu`
192 ++ nol :: activate secret
169 ++ nol :: activate secret
@@ -198,7 +175,7 @@ Takes in a `ring` from a `+sec:ex:crub` and generates a new `+crub` core with
198`sek` taken from `+sec:ex` and `pub` generated with `+puck:ed:crypto`. Crashes
175`sek` taken from `+sec:ex` and `pub` generated with `+puck:ed:crypto`. Crashes
199if `+sec:ex` is not a `+crub` secret key.
176if `+sec:ex` is not a `+crub` secret key.
201−#### `+com:nu`
178+### `+com:nu`
204 ++ com :: activate public
181 ++ com :: activate public
@@ -209,7 +186,37 @@ if `+sec:ex` is not a `+crub` secret key.
209Takes in a `pass` from a `+pub:ex:crub` and generates a new `+crub` core with
186Takes in a `pass` from a `+pub:ex:crub` and generates a new `+crub` core with
210`pub` taken from `+pub:ex` and null `sek`.
187`pub` taken from `+pub:ex` and null `sek`.
189+## `+ed:crypto` {#ed}
191+This core contains cryptographic primitives and helper functions for elliptic
192+curve cryptography with [Curve25519](https://en.wikipedia.org/wiki/Curve25519).
194+`+ed:crypto` is primarily used to generate public/private keypairs from a seed
195+for use with [elliptic curve
196+Diffie-Hellman](https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman)
197+key agreements as well as [Elliptic Curve Digital Signature
198+Algorithm](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm).
199+These functionalities are ultimately utilized by [`+crub:crypto`](#crub), the
200+only cryptosuite which [Ames](@/docs/arvo/ames/ames.md) makes use of.
202+Most gates in `+ed:crypto` are [jetted](@/docs/vere/jetting.md), meaning that an
203+external reference library is utilized whenever these functions are called,
204+rather than running in Nock natively. See the [Vere
205+documentation](@/docs/vere/cryptography/#ed) for more information about the
206+library utilized by jets.
212−### `+secp:crypto` {#secp}
208+## `+aes:crypto` {#aes}
210+This core contains cryptographic primitives and helper functions for
211+[AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) symmetric key
212+encryption and decryption. As is the case with `ed:crypto`, these
213+functionalities are utilized by [`+crub:crypto`](#crub), and most gates are
214+jetted. See also the Vere documentation on [AES
215+SIV](@/docs/vere/cryptography/#aes) for more information about the library
214−Utilized for secp256k1 (Ethereum public and private keys).
218+This core contains several doors, each one used for a different variation of AES
219+according to key size and mode. The only ones currently in use are
220+`+siva:aes:crypto` and `+sivc:aes:crypto`, which are 128-bit and
221+256-bit modes of [`AES-SIV`](https://www.aes-siv.com) respectively.