Skip to main content
Skip table of contents

StoreEncryptionService

be.securit.trustbuilder.service.StoreEncryptionService

Same as the encryption service but uses key/truststores to encrypt/decrypt/sign/verify

Properties

encoding Sets the character encoding , default is UTF-8

Functions

function

Description

encrypt(cipher,keyname,data,format)

Encrypt the data and return the encrypted data in the format (base64,hex,y64) using the public key from the certificate found in the truststore

decrypt(cipher,keyname,encryptedString,format)

Decrypt the encryptedString by decoding in format (base64,hex,y64) and return the original string using the private key from the keystore

sign(algorithm,keyname,data,decodingFormat,encodingFormat)

Sign the data decoded with decodingFormat and return the signature in the encodingFormat (base64,hex,y64) using the private key found in the keystore.

verify(algorithm,keyname,data,signature,decodingFormat)

Verify the data by decoding in decodingFormat (base64,hex,y64) using the public key of the certificate found in the truststore.

generateHMac(cipher,keyname,data,inputformat, outputformat)

Encrypt the data with hmac and return the result in the outputformat (base64,hex, y64).
Inputformat : null, base64, hex, y64

Available ciphers can be found for the sun at jdk6 jdk7

Example

CODE
var encryptionService = tb.getService("encryption"); // encryption is the name of the service
var pwd_hash_user = encryptionService.hash("SHA-512",workItem.input.credentials.password+salt,"base64");
// Encrypts the signaturebase with HMAC-SHA1 and returns a BASE64 encoded string
var signature = encryptionService.generateHMac( "HmacSHA1", signaturebase, null, "base64");

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.