## org.h2.tools
Class ChangeFileEncryption

    java.lang.Object
      org.h2.util.Tool
          org.h2.tools.ChangeFileEncryption

    public class ChangeFileEncryption

extends Tool

Allows changing the database file encryption password or algorithm.
This tool can not be used to change a password of a user. The database must be closed before using this tool.

H2.resource:

Field Summary

Fields inherited from class org.h2.util.Tool
`out`

Constructor Summary
`ChangeFileEncryption()`

Method Summary
`static void` `execute(java.lang.String dir, java.lang.String db, java.lang.String cipher, char[] decryptPassword, char[] encryptPassword, boolean quiet)` Changes the password for a database.
`static void` `main(java.lang.String... args)` Options are case sensitive.
`void` `run(java.lang.String... args)` Run the tool with the given output stream and arguments.

Methods inherited from class org.h2.util.Tool
`printNoDatabaseFilesFound, readArgBoolean, setOut, showUsage, throwUnsupportedOption`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ChangeFileEncryption

    public ChangeFileEncryption()

Method Detail

### main

    public static void main(java.lang.String... args)
                     throws java.sql.SQLException

  Options are case sensitive. Supported options are:

  [-help] or [-?] | Print the list of options
  [-cipher type] | The encryption type (AES or XTEA)
  [-dir <dir>] | The database directory (default: .)
  [-db <database>] | Database name (all databases if not set)
  [-decrypt <pwd>] | The decryption password (if not set: not yet encrypted)
  [-encrypt <pwd>] | The encryption password (if not set: do not encrypt)
  [-quiet] | Do not print progress information

  Parameters:
    `args` - the command line arguments
  Throws:
    `java.sql.SQLException`
  H2.resource:

### run

    public void run(java.lang.String... args)
             throws java.sql.SQLException

  Description copied from class: `Tool`
  Run the tool with the given output stream and arguments.

  Specified by:
    `run` in class `Tool`
  Parameters:
    `args` - the argument list
  Throws:
    `java.sql.SQLException`

### execute

    public static void execute(java.lang.String dir,
                               java.lang.String db,
                               java.lang.String cipher,
                               char[] decryptPassword,
                               char[] encryptPassword,
                               boolean quiet)
                        throws java.sql.SQLException

  Changes the password for a database. The passwords must be supplied as char arrays and are cleaned in this method. The database must be closed before calling this method.

  Parameters:
    `dir` - the directory (. for the current directory)
    `db` - the database name (null for all databases)
    `cipher` - the cipher (AES, XTEA)
    `decryptPassword` - the decryption password as a char array
    `encryptPassword` - the encryption password as a char array
    `quiet` - don't print progress information
  Throws:
    `java.sql.SQLException`