encrypt (Database - Java)

Encrypts a database.

Defined in

Database

Syntax

To encrypt using default encryption strength Database.DBENCRYPT_STRENGTH_AES128 and compact immediately:

public void encrypt()
    throws NotesException

To encrypt using a specified encryption strength and compact immediately:

public void encrypt(int encryptionStrength)
    throws NotesException

To encrypt using a specified encryption strength and to defer compacting:

public void encrypt(int encryptionStrength, boolean defer)
    throws NotesException

If defer is set, encryption and compaction occur the next time the database is opened.

Parameters

encryptionStrength
Constant Specify the constant associated with the desired encryption strength.
String Description
Database.DBENCRYPT_STRENGTH_NONE Database is not encrypted
Database.DBENCRYPT_STRENGTH_SIMPLE Simple database encryption strength. A deprecated strength that can be used only on a database with Simple or Medium encryption.
Database.DBENCRYPT_STRENGTH_MEDIUM Medium database encryption strength. A deprecated strength that can be used only on a database with Simple or Medium encryption.
Database.DBENCRYPT_STRENGTH_STRONG Strong database encryption strength.
Database.DBENCRYPT_STRENGTH_AES128 128-bit AES database encryption strength.
Database.DBENCRYPT_STRENGTH_AES256 256-bit AES database encryption strength.
defer

Boolean. Specify true to wait and compact the database the first time it's opened. Specify false to compact the database immediately after encrypting it. Compacting is required to enable a new encryption strength.

Usage

Encrypting is done locally on a Domino server or Notes client. If run on the Notes client, encrypting requires Manager access in the database ACL. If run on the server, it requires Full administrator access to the server.

Compacting is required to encrypt a database. If defer isn't used and a database can't be immediately compacted, be assured that it will be encrypted the first time the database is opened after the method runs.
Note: The script does not always have exclusive access to the database. In this case, use of the defer option will ensure the method runs to completion.

Example