Rust script to calculate the encrypted ciphertext of a specific encrypted tuple according to a given public key
ryardley opened this issue · 1 comments
ryardley commented
Write a script to calculate an encryption of a hardcoded tuple (ciphertext output) and push it to stdout.
This is going to be easiest as a rust script. Something like this but streams to stdout
./calculate-encrypted-output --pubkey dGhpc2lzYXJhbmRvbXN0cmluZw
let yes = 1234u64;
let no = 873827u64;
let raw_plaintext = vec![yes, no];
let expected_raw_plaintext = bincode::serialize(&raw_plaintext)?;
let pt = Plaintext::try_encode(&raw_plaintext, Encoding::poly(), ¶ms)?;
// pubkey need to come from argv and be deserialized from base64
let ciphertext = pubkey.try_encrypt(&pt, &mut ChaCha20Rng::seed_from_u64(42))?;
let ciphertext = CiphertextSerializer::to_bytes(ciphertext.clone(), params.clone())?;