samantha
12/14/2018, 5:49 PMvar guid = "4ab23a136dc347d";
var inputString = "sometext";
// Create the key
var key = crypto.createSecretKey({guid:guid, encoding:encode.Encoding.UTF_8});
// Encrypt
var cipher = crypto.createCipher({algorithm: crypto.EncryptionAlg.AES, key: key});
cipher.update({input: inputString, inputEncoding: encode.Encoding.UTF_8});
var cipherout = cipher.final({outputEncoding: encode.Encoding.HEX});
SECONDFILE.JS
// Decrypt
var decipher = crypto.createDecipher({algorithm: crypto.EncryptionAlg.AES, key: key, iv:cipherout.iv}); //asking here
decipher.update({input: cipherout.ciphertext, inputEncoding: encode.Encoding.HEX});
var decipherout = decipher.final({outputEncoding: encode.Encoding.UTF_8});
samantha
12/14/2018, 6:37 PMVaid
12/14/2018, 7:11 PMsamantha
12/14/2018, 7:23 PMVaid
12/14/2018, 7:44 PMVaid
12/14/2018, 7:48 PMsamantha
12/14/2018, 8:07 PMsamantha
12/14/2018, 8:16 PMform.addSecretKeyField({id: 'guidkey', label: 'password', restrictToScriptIds :[runtime.getCurrentScript().id,'customscript_setup_token'] , restrictToCurrentUser: false}).maxLength = 200;
. So for all values which need encryption we can generate a single guid correct ? , with a restriction that guid should only be used by scripts mentioned in attribute restrictToScriptIdssamantha
12/14/2018, 8:17 PMVaid
12/15/2018, 7:22 PMsamantha
12/16/2018, 4:32 AM