Skip to main content

Module kyber

Module kyber 

Source
Expand description

Post-quantum cryptography modules (requires oqs feature) Copyright © 2025-2026 Wenze Wei. All Rights Reserved.

This file is part of Ri. The Ri project belongs to the Dunimd Team.

Licensed under the Apache License, Version 2.0 (the “License”); You may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

§Kyber KEM

This module implements the Kyber Key Encapsulation Mechanism (KEM) using liboqs. Kyber is IND-CCA2 secure and is based on the hardness of the Module-LWE (Learning With Errors over Modules) problem.

§Security Level

  • Kyber512: NIST Level 1 ≈ AES-128
  • Kyber768: NIST Level 3 ≈ AES-192
  • Kyber1024: NIST Level 5 ≈ AES-256

§Usage

use ri::protocol::kyber::KyberKEM;

let kem = KyberKEM::new();
let (public_key, secret_key) = kem.keygen()?;
let (ciphertext, shared_secret_1) = kem.encapsulate(&public_key)?;
let shared_secret_2 = kem.decapsulate(&ciphertext, &secret_key)?;
assert_eq!(shared_secret_1, shared_secret_2);

Structs§

KyberCiphertext
KyberKEM
KyberPublicKey
KyberSecretKey