Securely Store Information in NetSuite with nlapiEncrypt and nlapiDecrypt

NetSuite Technical

Tags: , , , ,

This article is relevant if you are seeking to store information in NetSuite and the built-in mechanisms for securing sensitive data does not meet your requirements.

Background

In my previous article, How to Use NetSuite’s nlapiRequestURLWithCredentials API, I wrote about NetSuite’s best practice mechanism to secure information in the platform and then use that secure data to communicate with third party systems.  After some discussions with the NetSuite SuiteCloud Developer Network team, it was clear that I had a different usage model where the built-in services were a bit too restrictive.  As such, I needed to produce my own way to secure information and use it later in a safe way to communicate with third parties.

NetSuite Encryption Routines

The commonly understood rule in encryption is to not write your own but to use well-established algorithms proven reliable to encrypt data. NetSuite offers a function called nlapiEncrypt to take any string and encrypt it.  You may want to review this article for background about the different nlapiEncrypt algorithm choices and their implications.

I choose to use the AES algorithm with secure keys.  To generate a key (effectively a password to produce encrypted information), you need to work with an MD5 hashing algorithm.    Consider using this MD5 online generation tool to produce the 128 bit (or greater) keys needed to drive the nlapiEncrypt algorithm.  Remember, this key needs to stay secure (outside the application) or the whole point is compromised.

In order to use the encrypted information, you will need to decrypt it.  You may be able to send encrypted information to trusted third party services and they can decrypt on their side if you are sharing the key.  But you may also need to decrypt within NetSuite to use the data.  Curiously, NetSuite doesn’t write about the accompanying nlapiDecrypt algorithm in the Help pages.   The function takes parameters in the same order as nlapiEncrypt.  I recommend wrapping your own functions around this built-in function just in case NetSuite changes something about the function.

Drive NetSuite Your Way

NetSuite is a great platform for innovators.  If you need help getting more out of your NetSuite system, contact us.

Be Sociable, Share!

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - YouTube

About Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

Biography • Website • X (Twitter) • Facebook • LinkedIn • YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *