StringUtil { public static boolean isValidSshPublicKey( String sshKey ) { if ( !StringUtils.isBlank( sshKey ) ) { String[] parts = sshKey.trim().split( "\\s+" ); if ( parts.length == 2 || parts.length == 3 ) { SshEncryptionType type = SshEncryptionType.parseTypeFromKey( parts[0] ); if ( type != SshEncryptionType.UNKNOWN ) { return isBase64( parts[1] ); } } } return false; } private  StringUtil(); static String escapeHtml( String str ); static boolean isBase64( String str ); static boolean isValidSshPublicKey( String sshKey ); static String unEscapeHtml( String str ); static boolean containsHtml( String str ); static String removeHtml( String str ); static String removeHtmlAndSpecialChars( String str, boolean removeSpaces ); static String removeSpecialChars( String str, boolean removeSpaces ); static boolean isValidEmail( String email );  }
@Test public void testIsValidSshPublicKey() throws Exception { assertTrue( StringUtil.isValidSshPublicKey( SSH_KEY ) ); }