@@ -33,7 +33,6 @@ clients must be made or how a client should react.
3333#endif
3434
3535int verify_knownhost (ssh_session session ){
36- char * hexa ;
3736 enum ssh_known_hosts_e state ;
3837 char buf [10 ];
3938 unsigned char * hash = NULL ;
@@ -47,7 +46,7 @@ int verify_knownhost(ssh_session session){
4746 }
4847
4948 rc = ssh_get_publickey_hash (srv_pubkey ,
50- SSH_PUBLICKEY_HASH_SHA1 ,
49+ SSH_PUBLICKEY_HASH_SHA256 ,
5150 & hash ,
5251 & hlen );
5352 ssh_key_free (srv_pubkey );
@@ -62,7 +61,7 @@ int verify_knownhost(ssh_session session){
6261 break ; /* ok */
6362 case SSH_KNOWN_HOSTS_CHANGED :
6463 fprintf (stderr ,"Host key for server changed : server's one is now :\n" );
65- ssh_print_hexa ( "Public key hash" , hash , hlen );
64+ ssh_print_hash ( SSH_PUBLICKEY_HASH_SHA256 , hash , hlen );
6665 ssh_clean_pubkey_hash (& hash );
6766 fprintf (stderr ,"For security reason, connection will be stopped\n" );
6867 return -1 ;
@@ -78,10 +77,10 @@ int verify_knownhost(ssh_session session){
7877 /* fallback to SSH_SERVER_NOT_KNOWN behavior */
7978 FALL_THROUGH ;
8079 case SSH_SERVER_NOT_KNOWN :
81- hexa = ssh_get_hexa ( hash , hlen );
82- fprintf ( stderr , "The server is unknown. Do you trust the host key ?\n" );
83- fprintf ( stderr , "Public key hash: %s\n" , hexa );
84- ssh_string_free_char ( hexa );
80+ fprintf ( stderr ,
81+ "The server is unknown. Do you trust the host key (yes/no) ?\n" );
82+ ssh_print_hash ( SSH_PUBLICKEY_HASH_SHA256 , hash , hlen );
83+
8584 if (fgets (buf , sizeof (buf ), stdin ) == NULL ) {
8685 ssh_clean_pubkey_hash (& hash );
8786 return -1 ;
0 commit comments