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. Pick 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. Press 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. Enter the encryption type into the Default Value box from the list below:
      • MD2
      • MD5
      • SHA-1
      • SHA-256
      • SHA-384
    7. Click Save and Return to External Objects Parameters
    8. Click Create New Parameter
    9. Pick a description and length that matches your field to encrypt
    10. Set Required Field to Yes
    11. Click Save and Return to External Objects Parameters
  3. Finally, register 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. Then, select a before location (*BEFOREACT, *BEFOREADD, *BEFOREUPD, *BEFOREDLT)
    5. 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

    6. Click Save and Review External Objects
    7. Recompile your application

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

Related Posts:

Leave a Reply

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