add crypto-wipe

This commit is contained in:
xenia 2020-11-08 18:29:44 -05:00
parent 9bc5eece92
commit 9be3ce452f
2 changed files with 15 additions and 0 deletions

View File

@ -105,3 +105,9 @@
(define (crypto-lock-make-nonce)
(crypto-random-bytes 24))
(provide crypto-lock-make-key crypto-lock-make-nonce)
;; misc
(define/ffi crypto-wipe
(_fun (buf : _u8vector) (sz : _size = (u8vector-length buf)) -> _void))
(provide crypto-wipe)

View File

@ -19,3 +19,12 @@
(require "../crossfire/not-crypto.rkt")
(crypto-sign-public-key #"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
(define key (crypto-lock-make-key))
(define nonce (crypto-lock-make-nonce))
(define pt #"hello world")
(define-values [ct mac] (crypto-lock key nonce pt))
(displayln (crypto-unlock key nonce mac ct))
(displayln (crypto-unlock key nonce mac (bytes-append ct #"abcd")))