/// Parses a ciphertext into the miracl representation.
///
/// # Errors
/// This will return an error if any of the constituent group elements is
/// invalid.
Parses a ciphertext into the miracl representation.
Parses a ciphertext into the miracl representation .
pub fn ciphertext_into_miracl(
    ciphertext: &FsEncryptionCiphertext,
) -> Result<crypto::Crsz, &'static str> {
    let rr: Vec<ECP> = ciphertext.rand_r[..]
        .iter()
        .map(|g1_bytes| miracl_g1_from_bytes(&g1_bytes.0).or(Err("Malformed rand_r")))
        .collect::<Result<Vec<_>, _>>()?;
    let ss: Vec<ECP> = ciphertext.rand_s[..]
        .iter()
        .map(|g1_bytes| miracl_g1_from_bytes(&g1_bytes.0).or(Err("Malformed rand_s")))
        .collect::<Result<Vec<_>, _>>()?;
    let zz: Vec<ECP2> = ciphertext.rand_z[..]
        .iter()
        .map(|g2_bytes| miracl_g2_from_bytes(&g2_bytes.0).or(Err("Malformed rand_z")))
        .collect::<Result<Vec<_>, _>>()?;
    let cc: Vec<Vec<ECP>> = ciphertext
        .ciphertext_chunks
        .iter()
        .map(|cj| {
            cj.as_ref()
                .iter()
                .map(|c| miracl_g1_from_bytes(&c.0).or(Err("Malformed ciphertext_chunk")))
                .collect::<Result<Vec<_>, _>>()
        })
        .collect::<Result<Vec<_>, _>>()?;
    Ok(crypto::Crsz { cc, rr, ss, zz })
}
pub fn ciphertext_into_miracl ( ciphertext : & FsEncryptionCiphertext , ) -> Result < crypto :: Crsz , & ' static str > { let rr : Vec < ECP > = ciphertext . rand_r [ .. ] . iter ( ) . map ( | g1_bytes | miracl_g1_from_bytes ( & g1_bytes . 0 ) . or ( Err ( " " ) ) ) . collect :: < Result < Vec < _ > , _ > > ( ) ? ; let ss : Vec < ECP > = ciphertext . rand_s [ .. ] . iter ( ) . map ( | g1_bytes | miracl_g1_from_bytes ( & g1_bytes . 0 ) . or ( Err ( " " ) ) ) . collect :: < Result < Vec < _ > , _ > > ( ) ? ; let zz : Vec < ECP2 > = ciphertext . rand_z [ .. ] . iter ( ) . map ( | g2_bytes | miracl_g2_from_bytes ( & g2_bytes . 0 ) . or ( Err ( " " ) ) ) . collect :: < Result < Vec < _ > , _ > > ( ) ? ; let cc : Vec < Vec < ECP > > = ciphertext . ciphertext_chunks . iter ( ) . map ( | cj | { cj . as_ref ( ) . iter ( ) . map ( | c | miracl_g1_from_bytes ( & c . 0 ) . or ( Err ( " " ) ) ) . collect :: < Result < Vec < _ > , _ > > ( ) } ) . collect :: < Result < Vec < _ > , _ > > ( ) ? ; Ok ( crypto :: Crsz { cc , rr , ss , zz } ) }
Parses a ciphertext into the miracl representation.
Parses a ciphertext into the miracl representation .
ciphertext
&FsEncryptionCiphertext
errors
This will return an error if any of the constituent group elements is
invalid.
This will return an error if any of the constituent group elements is invalid .