Netsuite | nlapiEncrypt – Is there a way to decrypt string value created by nlapiEncrypt?
As per Netsuite documentation, we can use nlapiEncrypt(s) and this will create and return string value using SHA-1 method.
HelpGuide > SuiteFlex (Customization, Scripting, and Web Services) > SuiteScript > SuiteScript API > SuiteScript Functions > Encryption APIs
By default, the nlapiEncrypt(s) will return a string sha-1 value, when you used the API by passing only the string to be encrypt, there is no way to decrypt the value.
However, if you want to use an encryption using the nlapiEncrypt API and decrypt it back you can use the nlapiDecrypt API.
Here is the step to implement encryption and decryption.
- Encryption – Use the nlapiEncrypt API, but make sure to pass three parameters:
- Decryption – use the nlapiDecrypt(s, type, key) API
nlapiEncrypt(s, type, key)
s = the string value that you want to encrypt.
type = base64, aes, xor
key = Unique string value that would serve as a ‘password’ in the decryption.
Here is a sample implementation:
nlapiEncrypt(“Eliseo”, “base64″, “Netsuite”);
Result: “RWxpc2Vv”
s = the string value returned by the nlapiEncrypt
type = the encryption type used on the nlapiEncrypt (can only be: sha1, base64, aes and xor)
key = Unique string value used on the nlapiEncrypt.
Here is a sample implementation:
nlapiDecrypt(“RWxpc2Vv”, “base64″, “Netsuite”)
Result: “Eliseo”
Note: nlapiDecrypt is not documented in the official helpguide but it does exist.
No related posts.
Connect!
Enter your WordPress.com blog URL
http://.wordpress.com
Proceed