OScript API/Built-in Package Index |
The Security package provides encryption, decryption and hashing functions. The major functionalities offered in the Security Package are the following:
Deprecated hash and encryption family types will be removed from Content Server 22.2. Any solution using these types should immediately remove usage and switch to a more secure algorithm provided by the system.
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
224 bit
256 bit SHA-2 hash.
384 bit SHA-2 hash.
512 bit SHA-2 hash.
Check the password against the encrypted password.
Converts an old password using the SHA512 algorithm.
Decrypts 'value' with a key generated with 'key' using the encryptionType constant ( see above for constants ). Value should a base64 encoded string of bytes
Decrypts the Bytes 'value' with a key generated with 'key' using the encryptionType constant ( see above for constants ). Returns a string.
Encrypts 'value' with a key generated with 'key' using the encryptionType constant ( see above for constants ). Returns a base64 encoded string of bytes
Encrypts the String 'value' with a key generated with 'key' using the encryptionType constant ( see above for constants ). Returns a Bytes object
Hashes 'value' with the algorithm specified, returning a hex-encoded string.
Hashes the contents of a file with the algorithm specified, returning a hex-encoded string.
Hashes 'value' with the SHA512 algorithm, returning a hex-encoded string.
Generates a random byte string.
Check the password against the encrypted password. The check is done after hashing 'password' using the SHA512 algorithm.
the plaintext password.
the encrypted password.
TRUE if matched; FALSE otherwise. Note that FALSE will be returned in case of error.
String plaintextPwd = 'livelink122'
String cryptedPwd = Security.HashPassword(plaintextPwd)
Boolean isSame = Security.CheckPassword( plaintextPwd, cryptedPwd )
Echo( isSame ) // True
Converts an old password using the SHA512 algorithm.
the password generated with the old hash algorithm.
The password encrypted with the SHA512 algorithm. Note that the original input will be returned if it is not a legacy password generated with the old hash algorithm.
String plaintextPwd = 'livelink122'
String legacyPwd = Str.CryptOneWay(plaintextPwd)
Echo( legacyPwd ) //LLZb7NW/T6Y4xXrUPH.7p
String newCryptedPwd = Security.ConvertLegacyHash( legacyPwd )
Echo( newCryptedPwd ) //0$TExd9d7uNDuyCFTaUM43dxrvl|C53yy|7u+3XmgJgdpyRz1KC6rtKTfnOEdzW1F|7FR6kNk9AM4f1tFaYAyGFA==$xySlitgeI2OmQRxfvhuU8Gcz1QgyR2N|u4YU8nXrAF4yAujq1PnYE9IQXTkwm|MH+D|SFClYvr7oqWF5K1AUig==
Decrypts value with key using encryptionType
String containing the base64 encoded value to be decrypted.
String containing the text used to generate the key to decrypt the value with.
Type of encryption to use
A hex encoded string of the decrypted value.
Decrypts value with key using encryptionType
Bytes containing the value to be decrypted.
String containing the text used to generate the key to decrypt the value with.
Type of encryption to use
A String object of the decrypted value.
Encrypt value with key using encryptionType
String containing the value to be encrypted.
String containing the text used to generate the key to encrypt the value with.
Type of encryption to use
A base64 encoded string of the encrypted value.
Encrypts value with key using encryptionType
String containing the value to be encrypted.
String containing the text used to generate the key to encrypt the value with.
Type of encryption to use
A Bytes object of the encrypted value.
Hash value using hashType. Note that Security.SHA is not supported any more.
String containing the value to be decrypted.
Type of hash algorithm to use
A hex encoded string of the hash; an error if Security.SHA is used.
String text = 'some-string-to-be-hashed'
String hashedValue = Security.Hash( text, Security.SHA256 )
Hash the contents of theFile using hashType.
Either an open File object, or a String containing the path of a file to be hashed.
Type of hashing algorithm to use.
A hex-encoded string of the hash.
File theFile = File.Open( 'input.txt', File.ReadMode ) String hashedValue = Security.HashFile( theFile, Security.SHA256 ) File.Close( theFile )
Hashes 'value' with the SHA512 algorithm, returning a hex-encoded string.
String containing the value to be decrypted.
A hex encoded string of the hash if successful; Empty string otherwise.
String plaintextPwd = 'Livelink1!'
String encryptedPwd = Security.Hash( plaintextPwd )
Generates a random byte string from the input 'text', with length as specified by 'outputLength'.
The input string based on which the random text will be generated.
The length of desired output string.
A Bytes object of a random text if successful; Error otherwise.
Copyright © 2023 OpenText Corporation. All rights reserved. |