pub fn open<K: AbstractKey>(&mut self, key: &K) -> Result<()> {
        if self.master_key.is_some() {
            // We're already opened, this will be a no-op.
            return Ok(());
        }

        let mut master_key: Option<Key> = None;
        for wrapped_key in self.wrapped_keys.iter() {
            if let Ok(k) = wrapped_key.unwrap(key) {
                if is_master_key(&k, self.token_nonce.as_ref(), self.token.as_slice()) {
                    master_key = Some(k);
                    break;
                }
            }
        }

        if master_key.is_none() {
            return Err(Error::InvalidArgument(format!(
                "KeyStore unlocking failed: the given key is not present in this KeyStore"
            )));
        }

        self.master_key = master_key;
        Ok(())
    }
/// Open this KeyStore (attempt to unwrap the master key) using the given
/// wrapping key. If this fails, the structure will still be in a valid
/// state, so you could e.g. try again with a different wrapping key.
Open this KeyStore (attempt to unwrap the master key) using the given
wrapping key. If this fails, the structure will still be in a valid
state, so you could e.g. try again with a different wrapping key.
Open this KeyStore ( attempt to unwrap the master key ) using the given wrapping key . If this fails the structure will still be in a valid state so you could e . g . try again with a different wrapping key .
pub fn open<K: AbstractKey>(&mut self, key: &K) -> Result<()> {
        if self.master_key.is_some() {
            // We're already opened, this will be a no-op.
            return Ok(());
        }
        let mut master_key: Option<Key> = None;
        for wrapped_key in self.wrapped_keys.iter() {
            if let Ok(k) = wrapped_key.unwrap(key) {
                if is_master_key(&k, self.token_nonce.as_ref(), self.token.as_slice()) {
                    master_key = Some(k);
                    break;
                }
            }
        }
        if master_key.is_none() {
            return Err(Error::InvalidArgument(format!(
                "KeyStore unlocking failed: the given key is not present in this KeyStore"
            )));
        }
        self.master_key = master_key;
        Ok(())
    }
pub fn open < K : AbstractKey > ( & mut self , key : & K ) -> Result < ( ) > { if self . master_key . is_some ( ) { // We're already opened, this will be a no-op. return Ok ( ( ) ) ; } let mut master_key : Option < Key > = None ; for wrapped_key in self . wrapped_keys . iter ( ) { if let Ok ( k ) = wrapped_key . unwrap ( key ) { if is_master_key ( & k , self . token_nonce . as_ref ( ) , self . token . as_slice ( ) ) { master_key = Some ( k ) ; break ; } } } if master_key . is_none ( ) { return Err ( Error :: InvalidArgument ( format ! ( " " ) ) ) ; } self . master_key = master_key ; Ok ( ( ) ) }
Open this KeyStore (attempt to unwrap the master key) using the given
wrapping key.
Open this KeyStore ( attempt to unwrap the master key ) using the given wrapping key .
&mut self
key
&K
&mut self
key
&K