Key Manager Developers Guide


To get an overview of Key Manager, refer Key Manager.

Below is a list of tools required in Key Manager:

  1. JDK 11

  2. Any IDE (like Eclipse, IntelliJ IDEA)

  3. Apache Maven (zip folder)

  4. PostgreSQL

  5. Any DB client (like DBeaver, pgAdmin)

  6. Postman (any HTTP Client)

  7. Git

  8. Any Editor (like Vscode, Notepad++ etc optional)

  9. lombok.jar (jar file)

  10. settings.xml (document)

Software setup

1. Download lombok.jar and settings.xml.

2. Unzip Apache Maven and move settings.xml to "conf" folder <apache maven unzip path>\conf.

4. Check the Eclipse installation folder to see if the lombok.jar is added.

5. Configure the JDK (Standard VM) with your Eclipse by traversing through Preferences → Java → Installed JREs.

Source code setup

For the code setup, clone the repository and follow the guidelines mentioned in the Code Contributions.

Importing and building

  1. Open the project folder where pom.xml is present.

  2. Open the command prompt from the same folder.

  3. Run the command mvn clean install -Dgpg.skip=true -DskipTests=true to build the project.

  4. After building, open Eclipse and select Import Projects → Maven → Existing Maven Projects → Next → Browse to project directory → Finish.

  5. After successful importing of project, update the project by right-click on Project → Maven → Update Project.

Environment setup

  1. Download Auth adapter and add to project Libraries → Classpath → Add External JARs → Select Downloaded JAR → Add → Apply and Close.

  1. Refer KeyManager-DB-deploy to deploy local DB.

  2. Key Manager uses two property files, kernel-default and application-default, configure them accordingly. For instance,

  • Key Manager needs a Keystore to store keys. Supported Keystore types: PKCS11, PKCS12, Offline, JCE.

    # For PKCS11 provide Path of config file.
    # For PKCS12 keystore type provide the p12/pfx file path. P12 file will be created internally so provide only file path and file name.
    # For Offline & JCE property can be left blank, specified value will be ignored.
    # Passkey of keystore for PKCS11, PKCS12
    # For Offline & JCE property can be left blank. JCE password use other JCE specific properties.
  • Secrets can be encrypted using config server.

  • Update URL's in property files.(It can be either pointed to any remotely or locally deployed services)

  1. Download kernel-config-server.jar. For Windows, download config-server-start.bat, Linux users can run java -jar{mosip-config-mt_folder_path}/config {jarName} .

  2. Run the server by opening the config-server-start.bat file.

  3. To verify the config-server, hit the below URL:

http://localhost:51000/config/{}/{}/{} for instance http://localhost:51000/config/kernel/env/master.

Initialization and utilization of module

  1. Key Manager REST service consists of file in src/main/resources.

  2. Below properties needed to be modified in order to connect to the config server:<config server uri><branch of config repo>
  3. Services can be run using Run As -> Spring Boot App/Java Application.

  4. For API documentation, refer here.

  5. The API's can be tried with the help of Swagger-UI and Postman.

  6. Swagger-UI service can be accessed from (https/http)://(<domain>/<host>:<port>)/<context-path>/swagger-ui/index.html?configUrl=<contect-path>/v3/api-docs/swagger-config for instance

  7. The API's can be tried using Postman. URLs and Body structures can be found in swagger or curl command can be copied and imported in Postman.

Last updated

Copyright © 2021 MOSIP. This work is licensed under a Creative Commons Attribution (CC-BY-4.0) International License unless otherwise noted.