pub fn decode_message_2<B: AsRef<[u8]>>(&mut self, message: B) -> OckamResult<Vec<u8>> {
        let t = &mut self.0;
        let public_key_size = t.get_public_key_size();
        let message = message.as_ref();
        if message.len() < 2 * public_key_size + AES_GCM_TAGSIZE {
            return Err(Error::MessageLenMismatch.into());
        }

        let ephemeral_key_pair = t
            .ephemeral_key_pair
            .take()
            .ok_or_else(|| Error::InvalidState.into())?;

        let ephemeral_secret_handle = &ephemeral_key_pair.secret_handle;

        let mut index_l = 0;
        let mut index_r = public_key_size;
        let re = &message[..index_r];
        let re = PublicKey::new(re.to_vec());
        index_l += public_key_size;
        index_r += public_key_size + AES_GCM_TAGSIZE;
        let encrypted_rs_and_tag = &message[index_l..index_r];
        let encrypted_payload_and_tag = &message[index_r..];

        t.mix_hash(re.as_ref())?;
        t.dh(ephemeral_secret_handle, re.as_ref())?;
        t.remote_ephemeral_public_key = Some(re);
        let rs = t.decrypt_and_mix_hash(encrypted_rs_and_tag)?;
        let rs = PublicKey::new(rs);
        t.dh(ephemeral_secret_handle, rs.as_ref())?;
        t.remote_static_public_key = Some(rs);

        t.ephemeral_key_pair = Some(ephemeral_key_pair);
        let payload = t.decrypt_and_mix_hash(encrypted_payload_and_tag)?;
        Ok(payload)
    }
/// Decode the second message in the sequence, sent from the responder
Decode the second message in the sequence, sent from the responder
Decode the second message in the sequence sent from the responder
pub fn decode_message_2<B: AsRef<[u8]>>(&mut self, message: B) -> OckamResult<Vec<u8>> {
        let t = &mut self.0;
        let public_key_size = t.get_public_key_size();
        let message = message.as_ref();
        if message.len() < 2 * public_key_size + AES_GCM_TAGSIZE {
            return Err(Error::MessageLenMismatch.into());
        }
        let ephemeral_key_pair = t
            .ephemeral_key_pair
            .take()
            .ok_or_else(|| Error::InvalidState.into())?;
        let ephemeral_secret_handle = &ephemeral_key_pair.secret_handle;
        let mut index_l = 0;
        let mut index_r = public_key_size;
        let re = &message[..index_r];
        let re = PublicKey::new(re.to_vec());
        index_l += public_key_size;
        index_r += public_key_size + AES_GCM_TAGSIZE;
        let encrypted_rs_and_tag = &message[index_l..index_r];
        let encrypted_payload_and_tag = &message[index_r..];
        t.mix_hash(re.as_ref())?;
        t.dh(ephemeral_secret_handle, re.as_ref())?;
        t.remote_ephemeral_public_key = Some(re);
        let rs = t.decrypt_and_mix_hash(encrypted_rs_and_tag)?;
        let rs = PublicKey::new(rs);
        t.dh(ephemeral_secret_handle, rs.as_ref())?;
        t.remote_static_public_key = Some(rs);
        t.ephemeral_key_pair = Some(ephemeral_key_pair);
        let payload = t.decrypt_and_mix_hash(encrypted_payload_and_tag)?;
        Ok(payload)
    }
pub fn decode_message_2 < B : AsRef < [ u8 ] > > ( & mut self , message : B ) -> OckamResult < Vec < u8 > > { let t = & mut self . 0 ; let public_key_size = t . get_public_key_size ( ) ; let message = message . as_ref ( ) ; if message . len ( ) < 2 * public_key_size + AES_GCM_TAGSIZE { return Err ( Error :: MessageLenMismatch . into ( ) ) ; } let ephemeral_key_pair = t . ephemeral_key_pair . take ( ) . ok_or_else ( | | Error :: InvalidState . into ( ) ) ? ; let ephemeral_secret_handle = & ephemeral_key_pair . secret_handle ; let mut index_l = 0 ; let mut index_r = public_key_size ; let re = & message [ .. index_r ] ; let re = PublicKey :: new ( re . to_vec ( ) ) ; index_l += public_key_size ; index_r += public_key_size + AES_GCM_TAGSIZE ; let encrypted_rs_and_tag = & message [ index_l .. index_r ] ; let encrypted_payload_and_tag = & message [ index_r .. ] ; t . mix_hash ( re . as_ref ( ) ) ? ; t . dh ( ephemeral_secret_handle , re . as_ref ( ) ) ? ; t . remote_ephemeral_public_key = Some ( re ) ; let rs = t . decrypt_and_mix_hash ( encrypted_rs_and_tag ) ? ; let rs = PublicKey :: new ( rs ) ; t . dh ( ephemeral_secret_handle , rs . as_ref ( ) ) ? ; t . remote_static_public_key = Some ( rs ) ; t . ephemeral_key_pair = Some ( ephemeral_key_pair ) ; let payload = t . decrypt_and_mix_hash ( encrypted_payload_and_tag ) ? ; Ok ( payload ) }
Decode the second message in the sequence, sent from the responder
Decode the second message in the sequence sent from the responder
&mut self
message
B
&mut self
message
B