Skip to content

rsatrio/SoftHSM2-REST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SoftHSM2 REST API

A simple REST API for SoftHSM2. This project is build with dropwizard 2.x,Java 8, SoftHSM2, and Docker.

Features

  • REST Endpoint
  • Swagger page to test the API
  • Create RSA Key on Initialized Slot at SoftHSM2
  • Signing Base64 data with Key stored in SoftHSM2. Signing Mechanism is using SHA256withRSA
  • Retrieve RSA Public Key from HSM
  • Dockerized

Build

  • Use mvn package to build the module into jar file
mvn clean package
  • Run docker build
docker build -t softhsm-rest .
  • Run the docker image from previous step:
docker run -p 9080:9080 softhsm-rest
  • Go to the CLI of the container and initialized Slot 0. Take note of the Slot ID created and User PIN that you've entered
softhsm2-util --init-token --slot 0 --label "TestSlot1"
  • Go to the swagger page (http://localhost:9080/swagger), and test creating key in the SlotID created before. Use the /v1/softhsm/create-key endpoint
  • If key successfully created, then try to sign Base64 data with that key. For convenience, you can use the swagger interface earlier. Use the /v1/softhsm/sign-data endpoint

Feedback

For feedback, please raise issues in the issue section of the repository. Periodically, I will update the example with more real-life use case example. Enjoy!!.

About

REST API for SoftHSM2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published