- AeadKey and AeadNonce are opaque types. A key given where a nonce is wanted is a type error: for AEGIS-256 both are 32 bytes, and as arrays a swap would store the key in clear. Both print as #<AeadKey> and #<AeadNonce>. - A nonce knows its cipher, so aead-encrypt and aead-decrypt take none. They and the nonce functions move to (bjosodium raw). (bjosodium core) keeps aead-seal and aead-unseal, which make the nonce. - Every Argon2id function takes an Argon2idCost. There are no defaults: a key made with a default that a later version changed would not be made again. argon2id-interactive, -moderate and -sensitive are libsodium's three costs. - argon2id-derive-key returns an AeadKey of 32 bytes. #:length is gone. - Passwords are normalized to Unicode NFC before Argon2id. - random-bytes. make-aead-key takes no cipher: both keys are 32 bytes. - (bjosodium impl) holds the code; core and raw are facades of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
1 KiB
Text
23 lines
1 KiB
Text
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
;; bjosodium/src/raw.bjo — the module (bjosodium raw): encryption with a
|
|
;; nonce that the caller gives, for a format that keeps the nonce in its own
|
|
;; place. Use it with (bjosodium core), which has the keys.
|
|
;;
|
|
;; - A nonce is `AeadNonce`, an opaque type that knows its cipher.
|
|
;; `aead-encrypt` and `aead-decrypt` take the cipher from it.
|
|
;; - Make each nonce with `make-aead-nonce`. Never encrypt two messages with
|
|
;; the same key and nonce: that shows the XOR of the two plaintexts, and
|
|
;; lets an attacker forge messages.
|
|
;; - `bytes->aead-nonce` is for a nonce read back from stored data, to
|
|
;; decrypt. Do not encrypt with a nonce made from bytes.
|
|
|
|
(import (bjosodium impl))
|
|
|
|
(re-export AeadNonce)
|
|
|
|
(export
|
|
make-aead-nonce bytes->aead-nonce aead-nonce->bytes aead-nonce-cipher
|
|
aead-encrypt aead-decrypt)
|