# newEncryptionKey=key attribute

#### Function

Specifies a new external encryption key for an encrypted database. All of the existing data in the database is encrypted using the new encryption key and any new data written to the database will use this key for encryption. For more information about this attribute, see "Encrypting databases with a new external encryption key" in the Derby Developer's Guide.

#### Combining with other attributes

The newEncryptionKey attribute must be combined with the encryptionKey=key attribute.

You cannot change the encryption provider or the encryption algorithm when you use the newEncryptionKey attribute.

For an existing encrypted database for which authentication and SQL authorization are both enabled, only the database owner can perform reencryption. Please see "Enabling user authentication" and "Setting the SQL standard authorization mode" in the Derby Developer's Guide for more information.

#### Example

    -- specify a new encryption key for a database
    jdbc:derby:salesdb;encryptionKey=6162636465666768;newEncryptionKey=6862636465666768

Parent topic: Setting attributes for the database connection URL