
Hybrid decrypt: ML-KEM-768 + ChaCha20-Poly1305
Source:R/crypto_hybrid.R
morie_crypto_hybrid_decrypt.RdInverse of morie_crypto_hybrid_encrypt(), and of morie's
hybrid_encrypt: decapsulates the KEM ciphertext with the secret key and
re-derives the wrapping key from the shared secret, the ciphertext and
the public key embedded in the ML-KEM-768 secret key (bytes 1153..2336).
A 1.3.x container (no marker) still opens, with a warning: its wrapping
key needed no secret, so anyone with the file and the public key can
open it too; encrypt it again.
Examples
kp <- morie_crypto_hybrid_keygen()
ct <- morie_crypto_hybrid_encrypt(charToRaw("secret"), kp$pk)
rawToChar(morie_crypto_hybrid_decrypt(ct, kp$sk))
#> [1] "secret"