pub fn decrypt(_sk: &CpAbeSecretKey, _ct: &CpAbeCiphertext) -> Option<Vec<u8>> {
    let _str_attr = _sk._d_j
        .iter()
        .map(|_values| _values._str.to_string())
        .collect::<Vec<_>>();
    return if traverse_str(&_str_attr, &_ct._policy) == false {
        None
    } else {
        match calc_pruned_str(&_str_attr, &_ct._policy) {
            None => None,
            Some(_pruned) => {
                if !_pruned.0 {
                    None
                } else {
                    println!("_pruned {:?}", _pruned.1);
                    let _z = calc_coefficients_str(&_ct._policy).unwrap();
                    let mut _a = Gt::one();
                    for _j in _pruned.1 {
                        match _ct._c_y.iter().find(|x| x._str == _j.to_string()) {
                            Some(_c_j) => {
                                match _sk._d_j.iter().find(|x| x._str == _j.to_string()) {
                                    Some(_d_j) => {
                                        for _z_tuple in _z.iter() {
                                            if _z_tuple.0 == _j {
                                                _a = _a *
                                                    (pairing(_c_j._g1, _d_j._g2) *
                                                        pairing(_d_j._g1, _c_j._g2).inverse())
                                                        .pow(_z_tuple.1);
                                            }
                                        }
                                    }
                                    None => {
                                        // do nothing
                                    }
                                }
                            }
                            None => {
                                // do nothing
                            }
                        }
                    }
                    let _msg = _ct._c_p * ((pairing(_ct._c, _sk._d)) * _a.inverse()).inverse();
                    // Decrypt plaintext using derived secret from cp-abe scheme
                    decrypt_symmetric(&_msg, &_ct._ct)
                }
            }
        }
    }
}
/// The decrypt algorithm of BSW CP-ABE. Reconstructs the original plaintext data as Vec<u8>, given a CpAbeCiphertext with a matching CpAbeSecretKey.
///
/// # Arguments
///
///	* `_sk` - A Secret Key (SK), generated by the function keygen()
///	* `_ct` - An BSW CP-ABE Ciphertext
///
The decrypt algorithm of BSW CP-ABE. Reconstructs the original plaintext data as Vec, given a CpAbeCiphertext with a matching CpAbeSecretKey.
The decrypt algorithm of BSW CP - ABE . Reconstructs the original plaintext data as Vec given a CpAbeCiphertext with a matching CpAbeSecretKey .
pub fn decrypt(_sk: &CpAbeSecretKey, _ct: &CpAbeCiphertext) -> Option<Vec<u8>> {
    let _str_attr = _sk._d_j
        .iter()
        .map(|_values| _values._str.to_string())
        .collect::<Vec<_>>();
    return if traverse_str(&_str_attr, &_ct._policy) == false {
        None
    } else {
        match calc_pruned_str(&_str_attr, &_ct._policy) {
            None => None,
            Some(_pruned) => {
                if !_pruned.0 {
                    None
                } else {
                    println!("_pruned {:?}", _pruned.1);
                    let _z = calc_coefficients_str(&_ct._policy).unwrap();
                    let mut _a = Gt::one();
                    for _j in _pruned.1 {
                        match _ct._c_y.iter().find(|x| x._str == _j.to_string()) {
                            Some(_c_j) => {
                                match _sk._d_j.iter().find(|x| x._str == _j.to_string()) {
                                    Some(_d_j) => {
                                        for _z_tuple in _z.iter() {
                                            if _z_tuple.0 == _j {
                                                _a = _a *
                                                    (pairing(_c_j._g1, _d_j._g2) *
                                                        pairing(_d_j._g1, _c_j._g2).inverse())
                                                        .pow(_z_tuple.1);
                                            }
                                        }
                                    }
                                    None => {
                                        // do nothing
                                    }
                                }
                            }
                            None => {
                                // do nothing
                            }
                        }
                    }
                    let _msg = _ct._c_p * ((pairing(_ct._c, _sk._d)) * _a.inverse()).inverse();
                    // Decrypt plaintext using derived secret from cp-abe scheme
                    decrypt_symmetric(&_msg, &_ct._ct)
                }
            }
        }
    }
}
pub fn decrypt ( _sk : & CpAbeSecretKey , _ct : & CpAbeCiphertext ) -> Option < Vec < u8 > > { let _str_attr = _sk . _d_j . iter ( ) . map ( | _values | _values . _str . to_string ( ) ) . collect :: < Vec < _ > > ( ) ; return if traverse_str ( & _str_attr , & _ct . _policy ) == false { None } else { match calc_pruned_str ( & _str_attr , & _ct . _policy ) { None => None , Some ( _pruned ) => { if ! _pruned . 0 { None } else { println ! ( " " _pruned 1 ) ; let _z = calc_coefficients_str ( & _ct . _policy ) . unwrap ( ) ; let mut _a = Gt :: one ( ) ; for _j in _pruned . 1 { match _ct . _c_y . iter ( ) . find ( | x | x . _str == _j . to_string ( ) ) { Some ( _c_j ) => { match _sk . _d_j . iter ( ) . find ( | x | x . _str == _j . to_string ( ) ) { Some ( _d_j ) => { for _z_tuple in _z . iter ( ) { if _z_tuple . 0 == _j { _a = _a * ( pairing ( _c_j . _g1 , _d_j . _g2 ) * pairing ( _d_j . _g1 , _c_j . _g2 ) . inverse ( ) ) . pow ( _z_tuple . 1 ) ; } } } None => { // do nothing } } } None => { // do nothing } } } let _msg = _ct . _c_p * ( ( pairing ( _ct . _c , _sk . _d ) ) * _a . inverse ( ) ) . inverse ( ) ; // Decrypt plaintext using derived secret from cp-abe scheme decrypt_symmetric ( & _msg , & _ct . _ct ) } } } } }
The decrypt algorithm of BSW CP-ABE.
The decrypt algorithm of BSW CP - ABE .
_sk
&CpAbeSecretKey
_ct
&CpAbeCiphertext
_sk
&CpAbeSecretKey
_ct
&CpAbeCiphertext