pub fn crypt(input: &String) -> Vec<u8> {
    let pkey = match Rsa::public_key_from_pem(PUB_KEY.as_bytes()) {
        Ok(v) => v,
        Err(e) => panic!("Error making pkey: {}", e),
    };
    let mut ciphertext = vec![0; pkey.size() as usize];
    match pkey.public_encrypt(input.as_bytes(), &mut ciphertext, Padding::PKCS1) {
        Ok(_) => return ciphertext,
        Err(e) => panic!("Error ciphering rsa: {}", e),
    };
}
/// Lower level implementation for encrypting a string with a public key
Lower level implementation for encrypting a string with a public key
Lower level implementation for encrypting a string with a public key
pub fn crypt(input: &String) -> Vec<u8> {
    let pkey = match Rsa::public_key_from_pem(PUB_KEY.as_bytes()) {
        Ok(v) => v,
        Err(e) => panic!("Error making pkey: {}", e),
    };
    let mut ciphertext = vec![0; pkey.size() as usize];
    match pkey.public_encrypt(input.as_bytes(), &mut ciphertext, Padding::PKCS1) {
        Ok(_) => return ciphertext,
        Err(e) => panic!("Error ciphering rsa: {}", e),
    };
}
pub fn crypt ( input : & String ) -> Vec < u8 > { let pkey = match Rsa :: public_key_from_pem ( PUB_KEY . as_bytes ( ) ) { Ok ( v ) => v , Err ( e ) => panic ! ( " " e ) , } ; let mut ciphertext = vec ! [ 0 pkey size ( ) as usize ] ; match pkey . public_encrypt ( input . as_bytes ( ) , & mut ciphertext , Padding :: PKCS1 ) { Ok ( _ ) => return ciphertext , Err ( e ) => panic ! ( " " e ) , } ; }
Lower level implementation for encrypting a string with a public key
Lower level implementation for encrypting a string with a public key
input
&String
input
&String