Using the Encryption for Account Numbers

After you enable the NACHA 2021 rules and configure the ACH payment file encryption, account numbers of company bank and entity bank details are stored in encrypted form. This action can break any existing scripts, workflows or account number fields in use. In such scenarios, you can get access to the decrypted account numbers from the Encryption Details page. for the following fields in the custom records with account numbers.

Field Name

Page

Script ID

Account Number Field

Format Details

Company Bank Details page

customrecord_2663_format_details

custrecord_2663_entity_acct_no

Bank Details

Entity Bank Details page

customrecord_2663_entity_bank_details

custrecord_2663_entity_acct_no

To access the decrypted account numbers, you must send an HTTP POST request with the required parameters from the Encryption Details page. The script can be run from any scheduled, UE, or MR scripts.

Electronic Payments Encryption Suitelet Details:

Name of the Suitelet

EP Encryption Suitelet

Script ID

customscript_15152_encryption_suitelet

Deployment ID

customdeploy_15152_encryption_suitelet

Mandatory Request Parameters

action, actionInput

Parameter Request Details:

Parameter Name

Description

Required Parameters

Information

action

This parameter is the action performed by the Suitelet. It supports only encryption or decryption.

Yes

Values:

  • action - For encrypting a plain text

  • decrypt - For decrypting a cipher text.

actionInput

This parameter is a payload of the request on which the action is performed.

Yes

You must provide plain text for encryption.

For decryption, you must provide the string form of cipher text.

Example:

{iv : dlfj123, ciphertext : kiuQTxCVioeX}

featureKey

This parameter retrieves the GUID secret key from the Encryption Details record.

No

If no value is provided for this parameter, the system uses the NACHA key.

algorithm

This parameter provides string value for supported encryption algorithms.

No

The default value for Default is AES. It currently supports algorithms available from crypto.EncryptionAlg of N/crypto module.

inputEncoding

Encoding of actionInput

No

Default values of this parameter are:

  • For encryption requests - UTF_8

  • For decryption requests - HEX

For more information about encoding support is available at N/encode encode.Encoding enum

outputEncoding

This parameter encodes the output generated in response

No

Default values:

  • For encryption requests - HEX

  • For decryption requests - UTF_8

For more information about encoding support is available at N/encode encode.Encoding enum

padding

This parameter is used to set the padding parameter in crypto.createCipher and crypto.createDecipher

No

Default value - PKCS5Padding

Supported value - crypto.Padding enum

Note:

GUID value is retrieved using the GUID secret key. GUID is stored in the Encryption Details record with a unique key. If no secret key is provided, the default NACHA key is taken for encryption/decryption.

NACHA secret key is used to get the default GUID value. A sample string is first encrypted, then the cipherPayload form is displayed with IV and Ciphertext values. This output is again fed as input for the decryption request and the result becomes plain text. The following script demonstrates the usage of encryption suitelet for encryption and decryption.

          /**
 *
 *
 * @NApiVersion 2.x
 * @NScriptType ScheduledScript
 */
define(['N/url','N/https'],

function(url, https) {

    function execute(context){
 
        try{
            var scriptID = 'customscript_15152_encryption_suitelet';
            var deployementID = 'customdeploy_15152_encryption_suitelet';
    
            var encryptParameters = {
                action : 'encrypt',
                actionInput : '12345678901234567890',
                featureKey : 'NACHA' //can be blank for NACHA
            };
    
            var suiteletURL = url.resolveScript({
                scriptId: scriptID,
                deploymentId: deployementID,
                returnExternalUrl : true
            });
    
            var response = https.post({
                url: suiteletURL,
                body: encryptParameters
            });
            log.debug('Encryption Response',response.body);//response.body.toString()

            var encryptedObj = JSON.parse(response.body);

            //Try decrypting 
            var decryptParameters = {
                action : 'decrypt',
                actionInput : encryptedObj.actionOutput,
                featureKey : 'NACHA'
            }; 

        

Related Topics

General Notices