OScript API/Built-in Package Index

Class: Security

The Security package provides encryption, decryption and hashing functions. The major functionalities offered in the Security Package are the following:

Class Attributes

128 bit AES in CBC mode.

128 bit AES in 128 bit CFB mode.

128 bit AES in 8 bit CFB mode.

128 bit AES in ECB mode.

128 bit AES in 128 bit OFB mode.

192 bit AES in CBC mode.

192 bit AES in 128 bit CFB mode.

192 bit AES in 8 bit CFB mode.

192 bit AES in ECB mode.

192 bit AES in 128 bit OFB mode.

256 bit AES in CBC mode.

256 bit AES in 128 CFB mode.

256 bit AES in 8 bit CFB mode.

256 bit AES in ECB mode.

256 bit AES in 128 OFB mode.

128 bit blowfish in CBC mode.

128 bit blowfish in 64 bit CFB mode.

128 bit blowfish in ECB mode.

128 bit blowfish in 64 bit OFB mode.

128 bit CAST5 in CBC mode.

128 bit CAST5 in 64 bit CFB mode.

128 bit CAST5 in ECB mode.

128 bit CAST5 in 64 bit OFB mode.

56 bit DES in CBC mode.

56 bit DES in 64 bit CFB mode.

56 bit DES in 8 bit CFB mode.

56 bit DES in ECB mode.

168 bit 3DES in CBC mode.

168 bit 3DES in 64 bit CFB mode.

168 bit 3DES in ECB mode.

168 bit 3DES in 64 bit OFB mode.

112 bit 2 key triple DES in ECB mode.

112 bit 2 key triple DES in 64 bit CFB mode.

112 bit 2 key triple DES in ECB mode.

112 bit 2 key triple DES in 64 bit OFB mode.

56 bit DES in 64 bit OFB mode.

56 bit DESX in CBC mode.

128 bit

128 bit

128 bit

40 bit RC2 in CBC mode.

64 bit RC2 in CBC mode.

128 bit RC2 in CBC mode.

128 bit RC2 in CFB mode.

128 bit RC2 in ECB mode.

128 bit RC2 in OFB mode.

128 bit RC4.

40 bit RC4.

160 bit

160 bit

160 bit

224 bit

256 bit SHA-2 hash.

384 bit SHA-2 hash.

512 bit SHA-2 hash.

Class Methods

Decrypt( String value, String key, Integer encryptionType )

Decrypts 'value' with a key generated with 'key' using the encryptionType constant ( see above for constants ). Value should a base64 encoded string of bytes

DecryptBytes( Bytes value, String key, Integer encryptionType )

Decrypts the Bytes 'value' with a key generated with 'key' using the encryptionType constant ( see above for constants ). Returns a string.

Encrypt( String value, String key, Integer encryptionType )

Encrypts 'value' with a key generated with 'key' using the encryptionType constant ( see above for constants ). Returns a base64 encoded string of bytes

EncryptBytes( String value, String key, Integer encryptionType )

Encrypts the String 'value' with a key generated with 'key' using the encryptionType constant ( see above for constants ). Returns a Bytes object

Hash( String value, Integer hashType )

Hashes 'value' with the algorithm specified, returning a hex-encoded string.

Class Attributes

Class Methods

Decrypt

String Decrypt( String value,
                String key,
                Integer encryptionType )

Decrypts value with key using encryptionType

Parameters

value

String containing the base64 encoded value to be decrypted.

key

String containing the text used to generate the key to decrypt the value with.

encryptionType

Type of encryption to use

Returns:

A hex encoded string of the decrypted value.

DecryptBytes

String DecryptBytes( Bytes value,
                     String key,
                     Integer encryptionType )

Decrypts value with key using encryptionType

Parameters

value

Bytes containing the value to be decrypted.

key

String containing the text used to generate the key to decrypt the value with.

encryptionType

Type of encryption to use

Returns:

A String object of the decrypted value.

Encrypt

String Encrypt( String value,
                String key,
                Integer encryptionType )

Encrypt value with key using encryptionType

Parameters

value

String containing the value to be encrypted.

key

String containing the text used to generate the key to encrypt the value with.

encryptionType

Type of encryption to use

Returns:

A base64 encoded string of the encrypted value.

EncryptBytes

Bytes EncryptBytes( String value,
                    String key,
                    Integer encryptionType )

Encrypts value with key using encryptionType

Parameters

value

String containing the value to be encrypted.

key

String containing the text used to generate the key to encrypt the value with.

encryptionType

Type of encryption to use

Returns:

A Bytes object of the encrypted value.

Hash

String Hash( String value,
             Integer hashType )

Hash value using hashType

Parameters

value

String containing the value to be decrypted.

hashType

Type of hash algorithm to use

Returns:

A hex encoded string of the hash.

 Copyright © 2021 OpenText Corporation. All rights reserved.