Shell script to create self singed certificate for ibm http server by using gsk

 


#!/bin/bash


# Define variables

KDB_PATH="/tmp/kdb.kdb"

KDB_PASSWORD="password"

CER_PATH="/tmp/cert.cer"


# Prompt for certificate details

printf "Enter the certificate label: " 

read CERT_LABEL

printf "Enter the certificate subject (e.g. /C=US/ST=California/L=San Francisco/O=Your Organization/CN=Your Domain): " 

read CERT_SUBJECT

printf "Enter the certificate expiration (in days): " 

read CERT_EXPIRATION


# Create a new kdb file

./gsk8capicmd_64 -keydb -create -db $KDB_PATH -pw $KDB_PASSWORD -stash


# Generate a self-signed certificate

./gsk8capicmd_64 -cert -create -db $KDB_PATH -pw $KDB_PASSWORD -label $CERT_LABEL -dn "$CERT_SUBJECT" -size 2048 -expire $CERT_EXPIRATION


# Extract the .cer file

./gsk8capicmd_64 -cert -extract -db $KDB_PATH -pw $KDB_PASSWORD -label $CERT_LABEL -target $CER_PATH


Comments

Popular posts from this blog

Shell script to find out aliases and their expiration in cacerts

shell script to scp multiple file to multiple destinations

How to resolve port conflict in websphere