因此,我想在Rust中发挥功能,在这里我可以输入一个字符串并将其从中获取。我正在使用KYBER1024 KEM,我找不到一种输入自定义字符串变成密码的方法。
文档:
板条板:
文档中的用法只是说:(
use pqcrypto_kyber::kyber1024::*;
let (pk, sk) = keypair();
let (ss1, ct) = encapsulate(&pk);
let ss2 = decapsulate(&ct, &sk);
assert!(ss1 == ss2);
据我所知,它都没有任何地方说明用户插入自定义字符串的方法。
我该怎么做?
So I would like to make a function in Rust where I can input a string and get the ciphertext out of it. I'm using the Kyber1024 KEM and I can't find a way to input a custom string to turn into a cipher.
Documentation: https://docs.rs/pqcrypto-kyber/0.7.6/pqcrypto_kyber/kyber1024/index.html
Crate: https://crates.io/crates/pqcrypto-kyber
The usage in the documentation just says this:
use pqcrypto_kyber::kyber1024::*;
let (pk, sk) = keypair();
let (ss1, ct) = encapsulate(&pk);
let ss2 = decapsulate(&ct, &sk);
assert!(ss1 == ss2);
Nowhere does it illustrate (as far as I can see) a way for a user to insert a custom string for example so it can get converted into ciphertext.
How do I do this?
发布评论
评论(1)
板条箱 kyber-pke 提供了加密自定义消息的功能,但是有一些谨慎,但是Kyber-- PKE使用第三方板条箱PQC_KYBER(上游),而上游更新的pqc_kyber,Kyber-pke可能不会更新以使用较新的上游版本;因此,您需要更改kyber-pke内部的货物以使用较新的pqc_kyber,提示:kyber-pke 3.0在Apache 2.0下获得许可。而且Kyber-Pke必须将自定义消息的长度附加到密文中,因为Kyber1024使用256位块大小来加密AES256密钥,Kyber-Pke将明文长度附加到Ciphertext上,以供以后解密。
The crate kyber-pke provides functions to encrypt custom messages, but there are some cautions: Kyber-pke uses 3rd-party crate pqc_kyber (the upstream), while the upstream updated pqc_kyber, kyber-pke may not be updated to use newer upstream version; So you need to change Cargo.toml inside kyber-pke to use newer pqc_kyber, hint: kyber-pke 3.0 is licensed under Apache 2.0. And kyber-pke has to append the length of your custom message to the ciphertext, because Kyber1024 uses 256-bit block size to encrypt an AES256 key, kyber-pke appends the plaintext length to the ciphertext for later decryption.