Previous Next JavaScript must be enabled to correctly display this content

## 3.3 Implementing a custom Cryptography Provider

The base product provides a symmetric key cryptography framework that enables the implementation team to implement its own custom symmetric key encryption/decryption mechanism.

The product is shipped out with an out of the box Cryptography Provider that will be invoked if no custom implementation is found.

If you wish to write your own custom Cryptography Provider, the required steps are as follows:

1. Write the custom cryptography provider class such that it implements the interface `com.ofss.digx.infra.crypto.spi.ICryptographyProvider` .

   The interface defines methods as shown below:

   Description of the illustration security19.png
2. Implement the `encrypt()` and `decrypt()` methods to encrypt and decrypt the data passed to the methods, using the key passed along with the data.
3. Implement the `getVersion()` method to simply return a number greater than 1.

   For example:

   Description of the illustration security201.png
4. Implement the method to simply return the symmetric encryption algorithm name.

   For example:

   Description of the illustration security21.png
5. You can leave the implementations of the other two methods blank.
6. In the custom jar file that contains the custom Cryptography Provider, create a file with the name `com.ofss.digx.infra.crypto.spi.ICryptographyProvider` under the folder structure META-INF/services.
   Description of the illustration security22.png
7. Open the file for editing.
8. Type out the fully qualified class name of your custom Cryptography Provider class.

   For example:

   Description of the illustration security231.png

   Deploy your custom jar on the WebLogic server and you should be all set.

   The Cryptography Provider will be invoked when the system invokes the encryption framework for the following actions:

   1. Encrypting the SMTP Server password entered by the OBAPI Admin, before storing it in the Database.
   2. Encrypting the system generated password for first time users, before storing it in the Database. This is will be relevant to the function of Password Printing.
   3. Encrypting the Identification Number for the selected Identification Type (Driver’s License, Passport etc.) during originating a loan application online.

Parent topic: Guidance for Implementation Teams