public static boolean checkPassPhrase ( File keyFilePath , String passPhrase ) { KeyPair key = parsePrivateKeyFile ( keyFilePath ) ; boolean isValidPhrase = passPhrase != null && ! passPhrase . trim ( ) . isEmpty ( ) ; if ( key == null ) { return false ; } else if ( key . isEncrypted ( ) != isValidPhrase ) { return false ; } else if ( key . isEncrypted ( ) ) { return key . decrypt ( passPhrase ) ; } return true ; }
Checks to see if the passPhrase is valid for the private key file .