+

Search Tips   |   Advanced Search

Index Overview

PREV CLASS NEXT CLASS FRAMES


 

Class WL.SecurityUtils


Description:

Security Utilities


Method Attributes Method Name and Description
 

base64Decode(input)

Decodes input base64 string to a non base64 encoded string.

 

base64Encode(input)

Encodes input as base64 string.

 

decrypt(options)

Decryption function.

 

encrypt(options)

Encrypts text with a key.

 

keygen(options)

Generates a key using the PBKDF2 algorithm.

 

localRandomString(bytes)

Generates a random hex string locally.

 

remoteRandomString(bytes)

Generates a random hex string by contacting a random generator on the IBM Worklight Server.

Method Detail

base64Decode

{Promise} base64Decode(input)

Decodes input base64 string to a non base64 encoded string.

Parameters:

{string} input - Required. Input base64 encoded string.

Returns:

{Promise} Resolved when the operation succeeds, first parameter is the input string decoded. Rejected when there is a failure.


base64Encode

{Promise} base64Encode(input)

Encodes input as base64 string.

Parameters:

{string} input - Required. Input string.

Returns:

{Promise} Resolved when the operation succeeds, first parameter is the input string encoded. Rejected when there is a failure.


decrypt

{Promise} decrypt(options)

Decryption function.

Parameters:

{object} options - Required.

{string} options.key - Required. Key.

{string} options.ct - Required. Cipher Text.

{string} options.iv - Required. Initialization Vector.

{string} options.src - Required. Source ('obj' = iOS, 'java' = Android, 'js' = Web).

{number} options.v - Required. Version.

Returns:

{Promise} Resolved when the operation succeeds, first parameter is the decrypted text. Rejected when there is a failure.


encrypt

{Promise} encrypt(options)

Encrypts text with a key.

Parameters:

{object} options - Required.

{string} options.key - Required. Text to encrypt.

{string} options.text - Required. Key used for encryption.

Returns:

{Promise} Resolved when the operation succeeds, first parameter is an object which includes the cipher text. Rejected when there is a failure.


keygen

{Promise} keygen(options)

Generates a key using the PBKDF2 algorithm.

Parameters:

{object} options - Required.

{string} options.password - Required. Password used to generate the key.

{string} options.salt - Required. Salt used to to generate the key.

{number} options.iterations - Required. Number of iterations used for the key generation algorithm.

Returns:

{Promise} Resolved when the operation succeeds, first parameter is the hex encoded key. Rejected when there is a failure.


localRandomString

{Promise} localRandomString(bytes)

Generates a random hex string locally.

Parameters:

{number} bytes Optional - Optional. Number of bytes used to generate the string. Default is 32 bytes.

Returns:

{Promise} Resolved when the operation succeeds, first parameter is the random hex string. Rejected when there is a failure.


remoteRandomString

{Promise} remoteRandomString(bytes)

Generates a random hex string by contacting a random generator on the IBM Worklight Server.

Parameters:

{number} bytes Optional - Optional. Number of bytes used to generate the string. Default is 20 bytes, maximum is 64 bytes.

Returns:

{Promise} Resolved when the operation succeeds, first parameter is the random hex string. Rejected when there is a failure.


©Copyright IBM Corp. 2011-2014.