Pramod Raghavendra Jayathirth | a0865ee | 2018-08-27 09:05:45 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # This script takes 4 arguments |
| 4 | key_label=$1 |
| 5 | SoftHSMv2SlotID=$2 |
| 6 | upin=$3 |
| 7 | cert_id=$4 |
| 8 | |
| 9 | # Location to fecth SoftHSM library required by application |
| 10 | applicationlibrary="/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 |
| 14 | touch /tmp/pkcs11.cfg |
| 15 | chmod 755 /tmp/pkcs11.cfg |
| 16 | echo "name = ${key_label}" >> /tmp/pkcs11.cfg |
| 17 | echo "The location of applicationms library is ${applicationlibrary}" |
| 18 | echo "library = ${applicationlibrary}" >> /tmp/pkcs11.cfg |
| 19 | echo "slot = ${SoftHSMv2SlotID}" >> /tmp/pkcs11.cfg |
| 20 | |
| 21 | # 2. Compile the Application |
| 22 | cd /tmp/files |
| 23 | cp test.csr /tmp/test.csr |
| 24 | javac CaSign.java |
| 25 | |
| 26 | # 3. Run the Application |
| 27 | java CaSign ${upin} 0x${cert_id} |
| 28 | |
| 29 | # 4. Verify the generated certificate |
| 30 | openssl verify -verbose -CAfile ca.cert /tmp/test.cert |