Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
NetSuite has launched SuiteSuccess Wholesale Distribution Edition, in Japan. Please join us the webinar on February 12 that introduces NetSuite solution with demos and case studies for Wholesale Industry.
Register Now
Convert Java code to Netsuite Script for Two factor Security Protocol Authentication for API Integra
We are trying to implement 2 factor authentication for third party REST API in Netsuite. I keep running into issues with AES decryption part. Please see the example of the code below in Java. I need to convert it into suitescript.
public static String decrypt(String encryptedData, String key) throws Exception
{
byte[] keyData = new byte[16];
System.arraycopy(key.getBytes(Charset.forName("UTF-8")), 0, keyData, 0, key.length());
Key secretKey = new SecretKeySpec(keyData, ALGO);
Cipher c = Cipher.getInstance(ALGO);
c.init(2, secretKey);
return new String(c.doFinal(Base64.decodeBase64(encryptedData)));
}
and this is the test data
decrypt("BjlDBJPu9VkmRJqOy5EgaA==","Test12");
/******challenge******/
BjlDBJPu9VkmRJqOy5EgaA==