The oScript Security Departement: The class "Security" in the Content Server
The Security package provides encryption, decryption and hashing functions. Although quite aged, these are build in as a class and can be used directly from oScript
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.
Class Attributes
Not all of them are new or safe for quantum computers, some of them qre quite old
Advanced Encryption Standard (AES)
AES_128_CBC - 128 bit AES in CBC mode.
AES_128_CFB128 - 128 bit AES in 128 bit CFB mode.
AES_128_CFB8 - 128 bit AES in 8 bit CFB mode.
AES_128_ECB - 128 bit AES in ECB mode.
AES_128_OFB128 - 128 bit AES in 128 bit OFB mode.
AES_192_CBC - 192 bit AES in CBC mode.
AES_192_CFB128 - 192 bit AES in 128 bit CFB mode.
AES_192_CFB8 - 192 bit AES in 8 bit CFB mode.
Recommended by LinkedIn
AES_192_ECB - 192 bit AES in ECB mode.
AES_192_OFB128 - 192 bit AES in 128 bit OFB mode.
AES_256_CBC - 256 bit AES in CBC mode.
AES_256_CFB128 - 256 bit AES in 128 CFB mode.
AES_256_CFB8 - 256 bit AES in 8 bit CFB mode.
AES_256_ECB - 256 bit AES in ECB mode.
AES_256_OFB128 - 256 bit AES in 128 OFB mode.
BlowFish
BF_CBC - 128 bit blowfish in CBC mode.
BF_CFB64 - 128 bit blowfish in 64 bit CFB mode.
BF_ECB - 128 bit blowfish in ECB mode.
BF_OFB64 - 128 bit blowfish in 64 bit OFB mode.
CAST-128 (alternatively CAST5)
CAST5_CBC - 128 bit CAST5 in CBC mode.
CAST5_CFB64 - 128 bit CAST5 in 64 bit CFB mode.
CAST5_ECB - 128 bit CAST5 in ECB mode.
CAST5_OFB64 - 128 bit CAST5 in 64 bit OFB mode.
Data Encryption Standard(DES)
DES_CBC - 56 bit DES in CBC mode.
DES_CFB64 - 56 bit DES in 64 bit CFB mode.
DES_CFB8 - 56 bit DES in 8 bit CFB mode.
DES_ECB - 56 bit DES in ECB mode.
DES_EDE3_CBC - 168 bit 3DES in CBC mode.
DES_EDE3_CFB64 - 168 bit 3DES in 64 bit CFB mode.
DES_EDE3_ECB - 168 bit 3DES in ECB mode.
DES_EDE3_OFB64 - 168 bit 3DES in 64 bit OFB mode.
DES_EDE_CBC - 112 bit 2 key triple DES in ECB mode.
DES_EDE_CFB64 - 112 bit 2 key triple DES in 64 bit CFB mode.
DES_EDE_ECB - 112 bit 2 key triple DES in ECB mode.
DES_EDE_OFB64 - 112 bit 2 key triple DES in 64 bit OFB mode.
DES_OFB64 - 56 bit DES in 64 bit OFB mode.
DESX_CBC- 56 bit DESX in CBC mode.
Message-digest algorithm MD
MD2 - 128 bit
MD4 - 128 bit
MD5 - 128 bit
Rivest Cipher
RC2_40_CBC - 40 bit RC2 in CBC mode.
RC2_64_CBC - 64 bit RC2 in CBC mode.
RC2_CBC - 128 bit RC2 in CBC mode.
RC2_CFB64 - 128 bit RC2 in CFB mode.
RC2_ECB - 128 bit RC2 in ECB mode.
RC2_OFB64 - 128 bit RC2 in OFB mode.
RC4 - 128 bit RC4.
RC4_40 - 40 bit RC4.
RIPE Message Digest (RIPEMD160)
RIPEMD160 - 160 bit
Secure Hash Algorithms
SHA - 160 bit
SHA1 - 160 bit
SHA224 - 224 bit
SHA256 - 256 bit SHA-2 hash.
SHA384 - 384 bit SHA-2 hash.
SHA512 - 512 bit SHA-2 hash.