pub fn decode_message_3<B: AsRef<[u8]>>(&mut self, message_3: B) -> OckamResult<Vec<u8>> {
        let t = &mut self.0;
        let public_key_size = t.get_public_key_size();
        let message_3 = message_3.as_ref();
        if message_3.len() < 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 rs = t.decrypt_and_mix_hash(&message_3[..public_key_size + AES_GCM_TAGSIZE])?;
        let rs = PublicKey::new(rs);
        t.dh(&ephemeral_key_pair.secret_handle, rs.as_ref())?;
        t.ephemeral_key_pair = Some(ephemeral_key_pair);
        let payload = t.decrypt_and_mix_hash(&message_3[public_key_size + AES_GCM_TAGSIZE..])?;
        t.remote_static_public_key = Some(rs);
        Ok(payload)
    }
/// Decode the final message received for the handshake
Decode the final message received for the handshake
Decode the final message received for the handshake
pub fn decode_message_3<B: AsRef<[u8]>>(&mut self, message_3: B) -> OckamResult<Vec<u8>> {
        let t = &mut self.0;
        let public_key_size = t.get_public_key_size();
        let message_3 = message_3.as_ref();
        if message_3.len() < 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 rs = t.decrypt_and_mix_hash(&message_3[..public_key_size + AES_GCM_TAGSIZE])?;
        let rs = PublicKey::new(rs);
        t.dh(&ephemeral_key_pair.secret_handle, rs.as_ref())?;
        t.ephemeral_key_pair = Some(ephemeral_key_pair);
        let payload = t.decrypt_and_mix_hash(&message_3[public_key_size + AES_GCM_TAGSIZE..])?;
        t.remote_static_public_key = Some(rs);
        Ok(payload)
    }
pub fn decode_message_3 < B : AsRef < [ u8 ] > > ( & mut self , message_3 : B ) -> OckamResult < Vec < u8 > > { let t = & mut self . 0 ; let public_key_size = t . get_public_key_size ( ) ; let message_3 = message_3 . as_ref ( ) ; if message_3 . len ( ) < 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 rs = t . decrypt_and_mix_hash ( & message_3 [ .. public_key_size + AES_GCM_TAGSIZE ] ) ? ; let rs = PublicKey :: new ( rs ) ; t . dh ( & ephemeral_key_pair . secret_handle , rs . as_ref ( ) ) ? ; t . ephemeral_key_pair = Some ( ephemeral_key_pair ) ; let payload = t . decrypt_and_mix_hash ( & message_3 [ public_key_size + AES_GCM_TAGSIZE .. ] ) ? ; t . remote_static_public_key = Some ( rs ) ; Ok ( payload ) }
Decode the final message received for the handshake
Decode the final message received for the handshake
&mut self
message_3
B
&mut self
message_3
B