code: public static void checkPrivateKeyPermissions(String privateKeyFile)
      throws IOException {
  
      for (PosixFilePermission p : PRIVATE_KEY_PERMS) {
        try {
          matchesFilePermissions(privateKeyFile, p);
          return;
        } catch (FilePermissionError e) {
        }
      }
  
      final String errorMessage = String.format(
        "Wrong file permissions on file %s. Required permissions are: %s ",
        privateKeyFile, PRIVATE_KEY_PERMS_STR);
  
      throw new FilePermissionError(errorMessage);
    }
docs: Checks whether a private key file has the 'right' permissions
  
  @param privateKeyFile
  the file to be checked
  @throws IOException
  if an error occurs checking file attributes
  @throws FilePermissionError
  if the permissions are not correct