Show / Hide Table of Contents

Class Pbes

Used to provide encryption of data using a password. The encryption is a PBKDF2 cryptographic key derivation function. The underlying encryption algorithm is rc2. Note that all Service installations will be using the same salt.

Syntax

Constructors

Pbes()

Initializes a new instance of the Pbes class.

Declaration
Pbes
Examples
Pbes Pbes;

Methods

encrypt(Byte[],String)

The content in the data array will be encrypted using the supplied password. Since this is working on binary data, you must handle character sets if converting between byte data and strings.

Declaration
Byte[] encrypt(Byte[] data,String password)
Parameters
Type Name Description
Byte[] data

Binary data

String password

Password

Returns
Type Description
Byte[]

The returned byte array contains the encrypted data

Examples
Pbes pbes;
Byte[] content = String("Hello world").toByteArray();
Byte[] encrypted = pbes.encrypt(content, "foobar");

decrypt(Byte[],String)

The content in the data array will be decrypted using the supplied password. Since this is working on binary data, you must handle character sets if converting between byte data and strings. Note that this method does not check if the password is the same as used when encrypting. If wrong password is used, you will get something else than the original data back.

Declaration
Byte[] decrypt(Byte[] data,String password)
Parameters
Type Name Description
Byte[] data

Binary data

String password

Password

Returns
Type Description
Byte[]

The returned byte array contains the decrypted data.

Examples
Pbes pbes;
Byte[] content = String("Hello world").toByteArray();
Byte[] encrypted = pbes.encrypt(content, "foobar");
Byte[] decrypted = pbes.decrypt(encrypted, "foobar");printLine(String(decrypted));
In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top