private static boolean isEncryptedKey(char[] text) throws IOException {
  BufferedReader in=new BufferedReader(new CharArrayReader(text));
  try {
    String line;
    while ((line=in.readLine()) != null) {
      if (line.startsWith("Proc-Type: ") && line.contains("ENCRYPTED")) {
        return true;
      }
      if (line.length() == 0) {
        break;
      }
    }
    return false;
  }
  finally {
    in.close();
  }
}

private static boolean isEncryptedKey ( char [ ] text ) throws IOException { BufferedReader in = new BufferedReader ( new CharArrayReader ( text ) ) ; try { String line ; while ( ( line = in . readLine ( ) ) != null ) { if ( line . startsWith ( "Proc-Type: " ) && line . contains ( "ENCRYPTED" ) ) { return true ; } if ( line . length ( ) == 0 ) { break ; } } return false ; } finally { in . close ( ) ; } }
check if the key is encrypted . the key is considered encrypted
