pub fn encrypt<T: Serialize>(&self, msg: &T) -> Result<Vec<u8>, EncryptionError> {
        Ok(match *self {
            EncryptContext::NoEncryption => serialize(msg)?,
            EncryptContext::Authenticated { ref shared_key } => shared_key.encrypt(msg)?,
            EncryptContext::AnonymousEncrypt { ref their_pk } => {
                their_pk.anonymously_encrypt(msg)?
            }
        })
    }
/// Serialize given structure and encrypt it.
Serialize given structure and encrypt it.
Serialize given structure and encrypt it .
pub fn encrypt<T: Serialize>(&self, msg: &T) -> Result<Vec<u8>, EncryptionError> {
        Ok(match *self {
            EncryptContext::NoEncryption => serialize(msg)?,
            EncryptContext::Authenticated { ref shared_key } => shared_key.encrypt(msg)?,
            EncryptContext::AnonymousEncrypt { ref their_pk } => {
                their_pk.anonymously_encrypt(msg)?
            }
        })
    }
pub fn encrypt < T : Serialize > ( & self , msg : & T ) -> Result < Vec < u8 > , EncryptionError > { Ok ( match * self { EncryptContext :: NoEncryption => serialize ( msg ) ? , EncryptContext :: Authenticated { ref shared_key } => shared_key . encrypt ( msg ) ? , EncryptContext :: AnonymousEncrypt { ref their_pk } => { their_pk . anonymously_encrypt ( msg ) ? } } ) }
Serialize given structure and encrypt it.
Serialize given structure and encrypt it .
&self
msg
&T
&self
msg
&T