Skip to contents

Inverse of morie_crypto_hybrid_encrypt(). The wrapping key is re-derived from HKDF(kem_ct || pk) using the public key embedded in the ML-KEM-768 secret key (bytes 1153..2336), matching the Python morie.crypto.hybrid_decrypt exactly, so no decapsulation round-trip is required.

Usage

morie_crypto_hybrid_decrypt(ciphertext, recipient_sk)

Arguments

ciphertext

Raw vector container.

recipient_sk

Raw vector: recipient's ML-KEM-768 secret key (2400 bytes).

Value

Raw vector of decrypted plaintext.

Examples

if (morie_crypto_liboqs_available()) {
  kp <- morie_crypto_hybrid_keygen()
  ct <- morie_crypto_hybrid_encrypt(charToRaw("secret"), kp$pk)
  rawToChar(morie_crypto_hybrid_decrypt(ct, kp$sk))
}