IronCoreLabs / recrypt-rs

A set of cryptographic primitives for building a multi-hop Proxy Re-encryption scheme, known as Transform Encryption.
https://crates.io/crates/recrypt
GNU Affero General Public License v3.0
144 stars 23 forks source link

Error Creating PlainText #169

Closed Kalanamith closed 2 years ago

Kalanamith commented 2 years ago

Im using the following to create a PlainText

use recrypt::api::Plaintext;

fn main() {

    let hex_val = hex::encode( "Hello".as_bytes());
    let dd = &hex::decode(hex_val).unwrap();
    let expected_pt = Plaintext::new_from_slice(dd).unwrap();

}

But this throws the error

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InputWrongSize("Plaintext", 384)', src/main.rs:17:53
stack backtrace:

Whats the correct way to create a PlainText out of Hello ?

coltfred commented 2 years ago

The plaintext in the context of this library is not arbitrary bytes to be encrypted.

We've discussed this a bit in #125 #142 and #170. Lmk if you have specific questions after reading those issues.