pub fn authgen(
    _gk: &Aw11GlobalKey,
    _attributes: &Vec<String>,
) -> Option<(Aw11PublicKey, Aw11MasterKey)> {
    // if no attibutes or an empty policy
    // maybe add empty msk also here
    if _attributes.is_empty() {
        return None;
    }
    // random number generator
    let mut _rng = rand::thread_rng();
    // generator of group G1: g and generator of group G2: h
    let mut _sk: Vec<(String, Fr, Fr)> = Vec::new(); //dictionary of {s: {alpha_i, y_i}}
    let mut _pk: Vec<(String, Gt, G2)> = Vec::new(); // dictionary of {s: {e(g,g)^alpha_i, g1^y_i}}
    // now calculate attribute values
    for _attr in _attributes {
        // calculate randomness
        let _alpha_i:Fr = _rng.gen();
        let _y_i:Fr = _rng.gen();
        _sk.push((_attr.clone().to_uppercase(), _alpha_i, _y_i));
        _pk.push((
            _attr.clone().to_uppercase(),
            pairing(_gk._g1, _gk._g2).pow(_alpha_i),
            _gk._g2 * _y_i,
        ));
    }
    // return PK and MSK
    return Some((Aw11PublicKey { _attr: _pk }, Aw11MasterKey { _attr: _sk }));
}
/// Sets up a new AW11 Authority by creating a key pair: Public Parameters Key (PK) and Master Key (MK)
///
/// # Arguments
///
///	* `_gk` - A Global Parameters Key (GK), generated by the function setup()
///	* `_attributes` - A Vector of String attributes assigned to this Authority
///
/// # Remarks
///
/// In this scheme, all attributes are converted to upper case bevor calculation, i.e. they are case insensitive
/// This means that all attributes "tEsT", "TEST" and "test" are the same in this scheme.
Sets up a new AW11 Authority by creating a key pair: Public Parameters Key (PK) and Master Key (MK)
Sets up a new AW11 Authority by creating a key pair : Public Parameters Key ( PK ) and Master Key ( MK )
pub fn authgen(
    _gk: &Aw11GlobalKey,
    _attributes: &Vec<String>,
) -> Option<(Aw11PublicKey, Aw11MasterKey)> {
    // if no attibutes or an empty policy
    // maybe add empty msk also here
    if _attributes.is_empty() {
        return None;
    }
    // random number generator
    let mut _rng = rand::thread_rng();
    // generator of group G1: g and generator of group G2: h
    let mut _sk: Vec<(String, Fr, Fr)> = Vec::new(); //dictionary of {s: {alpha_i, y_i}}
    let mut _pk: Vec<(String, Gt, G2)> = Vec::new(); // dictionary of {s: {e(g,g)^alpha_i, g1^y_i}}
    // now calculate attribute values
    for _attr in _attributes {
        // calculate randomness
        let _alpha_i:Fr = _rng.gen();
        let _y_i:Fr = _rng.gen();
        _sk.push((_attr.clone().to_uppercase(), _alpha_i, _y_i));
        _pk.push((
            _attr.clone().to_uppercase(),
            pairing(_gk._g1, _gk._g2).pow(_alpha_i),
            _gk._g2 * _y_i,
        ));
    }
    // return PK and MSK
    return Some((Aw11PublicKey { _attr: _pk }, Aw11MasterKey { _attr: _sk }));
}
pub fn authgen ( _gk : & Aw11GlobalKey , _attributes : & Vec < String > , ) -> Option < ( Aw11PublicKey , Aw11MasterKey ) > { // if no attibutes or an empty policy // maybe add empty msk also here if _attributes . is_empty ( ) { return None ; } // random number generator let mut _rng = rand :: thread_rng ( ) ; // generator of group G1: g and generator of group G2: h let mut _sk : Vec < ( String , Fr , Fr ) > = Vec :: new ( ) ; //dictionary of {s: {alpha_i, y_i}} let mut _pk : Vec < ( String , Gt , G2 ) > = Vec :: new ( ) ; // dictionary of {s: {e(g,g)^alpha_i, g1^y_i}} // now calculate attribute values for _attr in _attributes { // calculate randomness let _alpha_i : Fr = _rng . gen ( ) ; let _y_i : Fr = _rng . gen ( ) ; _sk . push ( ( _attr . clone ( ) . to_uppercase ( ) , _alpha_i , _y_i ) ) ; _pk . push ( ( _attr . clone ( ) . to_uppercase ( ) , pairing ( _gk . _g1 , _gk . _g2 ) . pow ( _alpha_i ) , _gk . _g2 * _y_i , ) ) ; } // return PK and MSK return Some ( ( Aw11PublicKey { _attr : _pk } , Aw11MasterKey { _attr : _sk } ) ) ; }
Sets up a new AW11 Authority by creating a key pair: Public Parameters Key (PK) and Master Key (MK)
Sets up a new AW11 Authority by creating a key pair : Public Parameters Key ( PK ) and Master Key ( MK )
_gk
&Aw11GlobalKey
_attributes
&Vec<String>
_gk
&Aw11GlobalKey
_attributes
&Vec<String>
remarks
In this scheme, all attributes are converted to upper case bevor calculation, i.e. they are case insensitive
This means that all attributes "tEsT", "TEST" and "test" are the same in this scheme.
In this scheme all attributes are converted to upper case bevor calculation i . e . they are case insensitive This means that all attributes " tEsT " " TEST " and " test " are the same in this scheme .