blob: 1a723ea290eacd9aa00e453164b75bdaeb0c8362 [file] [log] [blame]
Pramod Raghavendra Jayathirtha0865ee2018-08-27 09:05:45 -07001#!/bin/bash
2
3# This script takes 4 arguments
4key_label=$1
5SoftHSMv2SlotID=$2
6upin=$3
7cert_id=$4
8
9# Location to fecth SoftHSM library required by application
10applicationlibrary="/usr/local/lib/softhsm/libsofthsm2.so"
11
12# Setting up the java application and running the application
13# 1. Create the configuration pkcs11.cfg for the application
14touch /tmp/pkcs11.cfg
15chmod 755 /tmp/pkcs11.cfg
16echo "name = ${key_label}" >> /tmp/pkcs11.cfg
17echo "The location of applicationms library is ${applicationlibrary}"
18echo "library = ${applicationlibrary}" >> /tmp/pkcs11.cfg
19echo "slot = ${SoftHSMv2SlotID}" >> /tmp/pkcs11.cfg
20
21# 2. Compile the Application
22cd /tmp/files
23cp test.csr /tmp/test.csr
24javac CaSign.java
25
26# 3. Run the Application
27java CaSign ${upin} 0x${cert_id}
28
29# 4. Verify the generated certificate
30openssl verify -verbose -CAfile ca.cert /tmp/test.cert