private void load ( ) throws IOException { if ( ! knownHosts . exists ( ) ) { return ; } assertKnownHostFileReadable ( ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( knownHosts ) ) ) { String line ; while ( ( line = reader . readLine ( ) ) != null ) { if ( ( ! line . trim ( ) . startsWith ( "#" ) ) ) { String [ ] strings = line . split ( " " ) ; if ( strings [ 0 ] . trim ( ) . equals ( serverId ) ) { // load the certificate fingerprint = strings [ 1 ] . trim ( ) ; return ; } } } } }
Try to load the certificate form the file if the server we ve connected is a known server .