pub fn decrypt(_sk: &KpAbeSecretKey, _ct: &KpAbeCiphertext) -> Option<Vec<u8>> {
    let _attrs_str = _ct
        ._ej
        .iter()
        .map(|values| values.clone().0.to_string())
        .collect::<Vec<_>>();
    let _pruned = calc_pruned_str(&_attrs_str, &_sk._policy);
    return match _pruned {
        None => {
            None
        }
        Some(_p) => {
            let (_match, _list) = _p;
            if _match {
                let mut _prod_t = Gt::one();
                let mut _z_y = Gt::one();
                let _coeffs: Vec<(String, Fr)> = calc_coefficients_str(&_sk._policy).unwrap();
                for _attr_str in _list.iter() {
                    let _sk_attr = _sk
                        ._dj
                        .iter()
                        .filter(|_attr| _attr.0 == _attr_str.to_string())
                        .nth(0)
                        .unwrap();
                    let _ct_attr = _ct
                        ._ej
                        .iter()
                        .filter(|_attr| _attr.0 == _attr_str.to_string())
                        .nth(0)
                        .unwrap();
                    let _coeff_attr = _coeffs
                        .iter()
                        .filter(|_attr| _attr.0 == _attr_str.to_string())
                        .nth(0)
                        .unwrap();
                    if is_negative(&_attr_str) {
                        // TODO !!
                        /*let _sum_e4 = G2::zero();
                        let _sum_e5 = G2::zero();
                        _prod_t = _prod_t *
                            (pairing(sk._d_i[_i].3, ct._e2) *
                                 (pairing(sk._d_i[_i].4, _sum_e4) * pairing(sk._d_i[_i].5, _sum_e5))
                                     .inverse());
                        */
                    } else {
                        _z_y = pairing(_sk_attr.1, _ct._e2)
                            * pairing(_ct_attr.1, _sk_attr.2).inverse();
                    }
                    _prod_t = _prod_t * _z_y.pow(_coeff_attr.1);
                }
                let _msg = _ct._e1 * _prod_t.inverse();
                // Decrypt plaintext using derived secret from cp-abe scheme
                decrypt_symmetric(&_msg, &_ct._ct)
            } else {
                None
            }
        }
    }
}
/// The decrypt algorithm of LSW KP-ABE. Reconstructs the original plaintext data as Vec<u8>, given a KpAbeCiphertext with a matching KpAbeSecretKey.
///
/// # Arguments
///
///	* `_sk` - A Secret Key (SK), generated by the function keygen()
///	* `_ct` - A LSW KP-ABE Ciphertext
///
The decrypt algorithm of LSW KP-ABE. Reconstructs the original plaintext data as Vec, given a KpAbeCiphertext with a matching KpAbeSecretKey.
The decrypt algorithm of LSW KP - ABE . Reconstructs the original plaintext data as Vec given a KpAbeCiphertext with a matching KpAbeSecretKey .
pub fn decrypt(_sk: &KpAbeSecretKey, _ct: &KpAbeCiphertext) -> Option<Vec<u8>> {
    let _attrs_str = _ct
        ._ej
        .iter()
        .map(|values| values.clone().0.to_string())
        .collect::<Vec<_>>();
    let _pruned = calc_pruned_str(&_attrs_str, &_sk._policy);
    return match _pruned {
        None => {
            None
        }
        Some(_p) => {
            let (_match, _list) = _p;
            if _match {
                let mut _prod_t = Gt::one();
                let mut _z_y = Gt::one();
                let _coeffs: Vec<(String, Fr)> = calc_coefficients_str(&_sk._policy).unwrap();
                for _attr_str in _list.iter() {
                    let _sk_attr = _sk
                        ._dj
                        .iter()
                        .filter(|_attr| _attr.0 == _attr_str.to_string())
                        .nth(0)
                        .unwrap();
                    let _ct_attr = _ct
                        ._ej
                        .iter()
                        .filter(|_attr| _attr.0 == _attr_str.to_string())
                        .nth(0)
                        .unwrap();
                    let _coeff_attr = _coeffs
                        .iter()
                        .filter(|_attr| _attr.0 == _attr_str.to_string())
                        .nth(0)
                        .unwrap();
                    if is_negative(&_attr_str) {
                        // TODO !!
                        /*let _sum_e4 = G2::zero();
                        let _sum_e5 = G2::zero();
                        _prod_t = _prod_t *
                            (pairing(sk._d_i[_i].3, ct._e2) *
                                 (pairing(sk._d_i[_i].4, _sum_e4) * pairing(sk._d_i[_i].5, _sum_e5))
                                     .inverse());
                        */
                    } else {
                        _z_y = pairing(_sk_attr.1, _ct._e2)
                            * pairing(_ct_attr.1, _sk_attr.2).inverse();
                    }
                    _prod_t = _prod_t * _z_y.pow(_coeff_attr.1);
                }
                let _msg = _ct._e1 * _prod_t.inverse();
                // Decrypt plaintext using derived secret from cp-abe scheme
                decrypt_symmetric(&_msg, &_ct._ct)
            } else {
                None
            }
        }
    }
}
pub fn decrypt ( _sk : & KpAbeSecretKey , _ct : & KpAbeCiphertext ) -> Option < Vec < u8 > > { let _attrs_str = _ct . _ej . iter ( ) . map ( | values | values . clone ( ) . 0 . to_string ( ) ) . collect :: < Vec < _ > > ( ) ; let _pruned = calc_pruned_str ( & _attrs_str , & _sk . _policy ) ; return match _pruned { None => { None } Some ( _p ) => { let ( _match , _list ) = _p ; if _match { let mut _prod_t = Gt :: one ( ) ; let mut _z_y = Gt :: one ( ) ; let _coeffs : Vec < ( String , Fr ) > = calc_coefficients_str ( & _sk . _policy ) . unwrap ( ) ; for _attr_str in _list . iter ( ) { let _sk_attr = _sk . _dj . iter ( ) . filter ( | _attr | _attr . 0 == _attr_str . to_string ( ) ) . nth ( 0 ) . unwrap ( ) ; let _ct_attr = _ct . _ej . iter ( ) . filter ( | _attr | _attr . 0 == _attr_str . to_string ( ) ) . nth ( 0 ) . unwrap ( ) ; let _coeff_attr = _coeffs . iter ( ) . filter ( | _attr | _attr . 0 == _attr_str . to_string ( ) ) . nth ( 0 ) . unwrap ( ) ; if is_negative ( & _attr_str ) { // TODO !! /*let _sum_e4 = G2::zero();
                        let _sum_e5 = G2::zero();
                        _prod_t = _prod_t *
                            (pairing(sk._d_i[_i].3, ct._e2) *
                                 (pairing(sk._d_i[_i].4, _sum_e4) * pairing(sk._d_i[_i].5, _sum_e5))
                                     .inverse());
                        */ } else { _z_y = pairing ( _sk_attr . 1 , _ct . _e2 ) * pairing ( _ct_attr . 1 , _sk_attr . 2 ) . inverse ( ) ; } _prod_t = _prod_t * _z_y . pow ( _coeff_attr . 1 ) ; } let _msg = _ct . _e1 * _prod_t . inverse ( ) ; // Decrypt plaintext using derived secret from cp-abe scheme decrypt_symmetric ( & _msg , & _ct . _ct ) } else { None } } } }
The decrypt algorithm of LSW KP-ABE.
The decrypt algorithm of LSW KP - ABE .
_sk
&KpAbeSecretKey
_ct
&KpAbeCiphertext
_sk
&KpAbeSecretKey
_ct
&KpAbeCiphertext