Encrypting Passwords

m-Power can easily be configured to use any existing encrypted column for password values when securing your applications against a flat file. For more on how to do this, see this page.

While this works great for existing encryptions, it is also possible to use m-Power to encrypt new values as well. To do so, you can use a built-in m-Power external object in any maintainer, which the following steps list in detail.

  1. First, register the external object needed for your maintainer to m-Power.
    1. Navigate to Admin Menu -> Custom Code -> External Objects
    2. Click ‘Create New Object’ on top right of screen
    3. Choose an Object name and description, and leave Object Type set at Java Method
    4. The Class name is com.mrc.ext.SHAEncode and the Method Name is encode
    5. Click ‘Save and Return to External Objects’
  2. Next, register the two parameters needed for this object:
    1. Click the Parms icon for this object
    2. Click ‘Create New Parameter’
    3. Set Parameter Description to Encryption Type
    4. Set Parameter Length to 10
    5. Leave Required Field set to ‘No’
    6. Leave the Default Value box blank
    7. Click ‘Save and Return to External Objects Parameters’
    8. Click ‘Create New Parameter’
    9. Choose a description and length that matches your password field to encrypt
    10. Set Required Field to ‘Yes’
    11. Click ‘Save and Return to External Objects Parameters’
  3. Finally, add this object to your maintainer:
    1. Find your application and click the Edit button
    2. Click the ‘External Objects’ button
    3. On the Add External Object screen, select the object created in step 1 from the dropdown
    4. Select a before location (*BEFOREACT, *BEFOREADD, *BEFOREUPD, *BEFOREDLT)
    5. Set the Encryption Type parameter to ‘Map a constant’. Enter the appropriate encryption type:
      • MD2
      • MD5
      • SHA-1
      • SHA-256
      • SHA-384
    6. Finally, map your field to the second parameter by selecting it from the dropdown
      Note: If your field does not show up in the dropdown, you have incorrectly defined the length of this parameter and will need to return to step 2i to fix
    7. Click Save and Review External Objects
  4. Recompile your application

    Note: Overwriting is not required when adding/modifying external objects

  5. Don’t forget to set the encryption_type in the Sign On configuration as well.

Related Posts:

Leave a Reply

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