pub fn add_authorized_key(&mut self, key: &[u8]) -> Result<(), OssuaryError> {
        if key.len() != 32 {
            return Err(OssuaryError::KeySize(32, key.len()));
        }
        let mut key_owned = [0u8; 32];
        key_owned.copy_from_slice(key);
        self.authorized_keys.push(key_owned);

        // If handshake is waiting for key approval, check if this is the key.
        match self.state {
            ConnectionState::ClientWaitServerApproval => {
                match self.remote_auth.public_key {
                    Some(remote_key) => {
                        if remote_key.as_bytes() == key {
                            self.state = ConnectionState::ClientSendAuthentication
                        }
                    },
                    _ => {},
                }
            },
            _ => {},
        };
        Ok(())
    }
/// Add public key of permitted remote hosts
///
/// During the handshake, both hosts will be required to sign a challenge
/// with their secret authentication key.  The host sends both the signature
/// and the public key it signed with.  The other side validates the
/// signature, and verifies that the public key is in the list of authorized
/// keys.
///
/// Unauthenticated servers do not verify the public key.  Authenticated
/// servers do verify the public key, and reject the connection if the key
/// is unknown.  Clients verify the public key, and raise
/// [`OssuaryError::UntrustedServer`] if the key is unknown, permitting a
/// Trust-On-First-Use scheme if desired.
///
/// If a key is rejected, permanent connection failures are raised on both sides.
///
Add public key of permitted remote hosts
During the handshake, both hosts will be required to sign a challenge
with their secret authentication key.  The host sends both the signature
and the public key it signed with.  The other side validates the
signature, and verifies that the public key is in the list of authorized
keys.

Unauthenticated servers do not verify the public key.  Authenticated
servers do verify the public key, and reject the connection if the key
is unknown.  Clients verify the public key, and raise
[`OssuaryError::UntrustedServer`] if the key is unknown, permitting a
Trust-On-First-Use scheme if desired.

If a key is rejected, permanent connection failures are raised on both sides.
Add public key of permitted remote hosts During the handshake both hosts will be required to sign a challenge with their secret authentication key . The host sends both the signature and the public key it signed with . The other side validates the signature and verifies that the public key is in the list of authorized keys . Unauthenticated servers do not verify the public key . Authenticated servers do verify the public key and reject the connection if the key is unknown . Clients verify the public key and raise [ ` OssuaryError :: UntrustedServer ` ] if the key is unknown permitting a Trust - On - First - Use scheme if desired . If a key is rejected permanent connection failures are raised on both sides .
pub fn add_authorized_key(&mut self, key: &[u8]) -> Result<(), OssuaryError> {
        if key.len() != 32 {
            return Err(OssuaryError::KeySize(32, key.len()));
        }
        let mut key_owned = [0u8; 32];
        key_owned.copy_from_slice(key);
        self.authorized_keys.push(key_owned);
        // If handshake is waiting for key approval, check if this is the key.
        match self.state {
            ConnectionState::ClientWaitServerApproval => {
                match self.remote_auth.public_key {
                    Some(remote_key) => {
                        if remote_key.as_bytes() == key {
                            self.state = ConnectionState::ClientSendAuthentication
                        }
                    },
                    _ => {},
                }
            },
            _ => {},
        };
        Ok(())
    }
pub fn add_authorized_key ( & mut self , key : & [ u8 ] ) -> Result < ( ) , OssuaryError > { if key . len ( ) != 32 { return Err ( OssuaryError :: KeySize ( 32 , key . len ( ) ) ) ; } let mut key_owned = [ 0u8 ; 32 ] ; key_owned . copy_from_slice ( key ) ; self . authorized_keys . push ( key_owned ) ; // If handshake is waiting for key approval, check if this is the key. match self . state { ConnectionState :: ClientWaitServerApproval => { match self . remote_auth . public_key { Some ( remote_key ) => { if remote_key . as_bytes ( ) == key { self . state = ConnectionState :: ClientSendAuthentication } } , _ => { } , } } , _ => { } , } ; Ok ( ( ) ) }
Add public key of permitted remote hosts
During the handshake, both hosts will be required to sign a challenge
with their secret authentication key.
Add public key of permitted remote hosts During the handshake both hosts will be required to sign a challenge with their secret authentication key .
&mut self
key
&[u8]
&mut self
key
&[u8]