Hashing with SHA-256 in Javascript

importPackage(java.io); importPackage(Packages.java.lang); importClass(java.security.MessageDigest); importClass(java.nio.charset.StandardCharsets); importClass(java.lang.StringBuffer); var varMyString = “JIMBO”; var varDigest = MessageDigest.getInstance(“SHA-256”); var varOriginalString = new java.lang.String(varMyString); var varHashedString = varDigest.digest(varOriginalString.getBytes(StandardCharsets.UTF_8)); var varFinalString = new StringBuffer(); for (i = 0; i < varHashedString.length; i++) { varFinalString.append(Integer.toString((varHashedString[i] & 0xff) + 0x100, 16).substring(1)); } print (“hash: ” + varFinalString);

Encrypt data using Public Key

Often times you will want to scramble data before you store it in an LDAP directory or a database. The quickest method is to simply obfuscate the data by replacing each character in the original data with different ones, of course by using a known algorithm. For example, shifting the characters over two places on the ASCII scale before replacement. … Read More

JDE Julian Date conversion

Below you will find a JavaScript program which will convert JD Edwards Julian Dates to Java dates. The output format can be tweaked to your liking.

The code handles LEAP year conversion, as the following examples show. 2004 is a LEAP year, 1971 is not. Kekes-MacBook-Pro:Downloads karmst$ rhino -f jimbo.js JDE Date: 104138 Out Date: 20040517 Kekes-MacBook-Pro:Downloads karmst$ rhino … Read More

Call PowerShell from IDM engine (Windows only)

If you have your NetIQ IDM Engine on eDirectory which is running on a Windows Server, then you might just want to call PowerShell directly from the Engine; at least you have the capability of doing so. The following code snippets (both DirXML Script and ECMAScript) will allow you to do just that. Of course, this only works on Windows, … Read More

ECMAScript to compare two arrays

It is sometimes useful to be able to compare two arrays before loading the result into an MVEditor or a list. A few scenarios of when you might want to use this code are: When you want to determine which Groups to display to a User on a Workflow form, knowing that some Groups are restricted and should not be … Read More

Manipulate a string as XML

I was recently asked to provide code which satisfied the following specification: In flowdata for a PRD I am trying to do the following in a mapping activity. I have a string, which looks like this (example): “<data><startdate>2012-06-20T12:26:32.000+02:00</startdate><enddate>2012-07-17T12:26:32.000+02:00</enddate><udlaaner>24222</udlaaner><modtager>24300</modtager><initiator>cn=ADMKEVRAS,ou=sa,o=data</initiator><desc><value>Test 11</value></desc><A1>[DN on a group]</A1></data>” This string is just a stringified XML stored on a String attribute in edirectory. In clean XML it … Read More

ECMAScript to generate a UUID

The code shown below was used in a recent project in order to generate a Unique Identifier when a User created a new Service Provider definition from within a User Application Workflow. When the Service Provider feed was consumed by the JMS Connector, the Connector checked the metadata present in the Identity Vault against the UUID sent as part of … Read More

Keep track of comments in the RBPM workflow

This article describes how one can keep track of comments which have been entered into one or more forms during the NetIQ User Application request process. This is helpful if you want to display a ‘running commentary’ of the previously entered comments on each new form when it is presented to the User. For instance, during the request process, the … Read More