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. Once this is done, you would then Base64 encode the data. Not the most secure of methods, but it will work and make the data look like something it is not.

A different method would be to write a piece of ECMAScript code or compile your own Java Class to actually encrypt the data using a known seed. The problem with the ECMAScript method is that the seed and the encryption algorithm is open and could enable a malicious User to figure out the method used; it’s ‘in the clear’ ECMAScript source code after all. Of course, the seed could be stored in a Named Password on the IDM Driver or IDM DriverSet, but this does not provide an uncrackable solution. The Java Class method is one Belkast has used in the past, but this requires yet another JAR file to be placed on the IDM server. When moving code from Development to Test and from Test to Production, things get left behind and this can often lead to broken code. I think everyone has been in that situation before!

The method that Belkast prefers when working with data encryption is to use the Public Key from a self-signed certificate. It does involve writing a little bit of ECMAScript code, but what it means is that:

  • The encrypted output of the same value is different every time (just like SSL)
  • The original cleartext value cannot be retrieved unless a malicious User has the certificates Private Key

As a use case, we encrypted the value Belkast123 (a valid password) two times, and the resultant encrypted values are shown below. As you can see, the results are different; therefore making it more difficult for a malicious User to determine what the initial value was.

iI1t+CmUYQRBiA4FxB01svuS+zTmDpSgabiUghktzQRc3aYNlpILS8Zh+ptoegraDM0avD/AGJNlbbUWxv5oYdjRMAuJA/sm7cHVxiasb9W9Wd8qWCefSVUil/eO+S2rX2kUB949dcLYBK4BuTDY/bs/ah7PYmPi/te+w5cLL1iyvpzjr+acFwRXo/71XLQJ46NYZFdeDShlk8eqOLTjL5Dq/RyTTgz4AgLCg/0L9Zp1QxrEPiqogIlHzMu2AszuYcW6VyNhNUeeM6mXIXvRJx4nKQaK73tefowj0oXLXrDj0aMeIQ7IHowVNOFbWBzeQ64XAQn+eE1Q3ORFUKc8y5WrTmJwWMV1SB72F57HhOgF99DxBeWo0cujVMcE9ZPP0cX7KUSHg+BPuoO3I58OmcxcdThBPG3e18K1+XvZMIe8yz6y6yTvPaluTlXdf8UUSWwXu66HRpi64Z1wQD1MpWFtIlocMwijR6pM5pAwB9ytm7U/VJ19s55GxSAuZG5ZDb87arqgwyOajt1UeQ67xmafbd6dlpQQwOrnbg0qYl7t8fF8dreHekye6g7w4PMGVKpmvfBizv2t1zsj/MpjDfWkK2Gis07DL1lRAPaqlep0CR8VQkD/G9NwyD1yTtdn3rHV9H9xjWicLXstSvrc86ztDPH19N3hFC5b5oJ6SbI=

NTSFB9viWn5ym4nNxKvezim/YI9N411yxJboeYcfRqoSaL9MepU+5JzwpyX5eaWG09jeQjBlh41WEmBUqIYUTeLwGzWujZOan8+/YCcfeyAxkFbpHNayLoygw5r7pzOU4JupboPCwYx+xhIvqUroDO67NMG+4Qr1Q09JcrpwR5Jof5neh4561OH8G+hZepMPVfBOSItVfNs1uHm0OYsQdP5qBCIFzsgfESe/JofhoK5PG4sP7Zf8HExov2VngI7IeoS1S6f0BHL41yXJuJoAfBC4cvJsMlBFv/KpujUIhJMQ2CpaB+5kwvIdsAnkbj4dhy8AGPJEZOV3RHJWxuXyZlZMsO3ELhWyQ3GwvRL0P2GMhBA8afGw0MpbfAOuzb7vUEKKyUEbPPECx4jXJ9QztA4jH10PittTO/ibQS0EbLqAGsO48gRygUmAAQElXNKnXP4PazSuQ8bXrRLqhobhotdLTjVA+1ViD3OC1B5jfk2y7n9CcgNJ0ThZYSkDbzpbQI9aLlzdB8CpRrhdNKw1w5D7vQCrsdxwJrDDhnKWbKGqjlggjPdKypCs/k1oFlWZMmSqiu5qYOm81Ufjn3jnxMjKSR3jETJ4JXkve3G8uufcsm40vMCuBKCRMoHAFyPoU66xhKYHnKUBPRRgJ3e9/4gQTPGsUvqeRjDKDeK0rms=

Please contact Belkast if you want more information in relation to this preferred method of encryption.  Contact Us