Generate BKS File( Bouncy Castle KeyStore)

FrankYou發表於2018-05-14
echo "Enter BKS output file name : \c"
read filename

echo "Enter BKS Password : \c"
read BKSPWD

echo "Enter P12 or PFX file : \c"
read p12File

if [ ! -f $p12File ]
then
  echo "$p12File file is missing"
  exit 2
fi

echo "Enter P12 or PFX password : \c"
read p12FilePWD




if [ -f "bcprov-jdk15on-152.jar" ]
then
  
  echo "Please wait ...."
  
  keytool -importkeystore -destkeystore $filename.bks -deststoretype BKS -providerpath "bcprov-jdk15on-152.jar" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -deststorepass $BKSPWD -srcstorepass $p12FilePWD -srckeystore $p12File -srcstoretype pkcs12


  echo "Pleaes copy the following base64 \n\n"
  openssl base64 -in $filename.bks -out b64.txt && cat b64.txt
  rm b64.txt
  
else
  echo "bcprov-jdk15on-152.jar is missing"
fi

 

相關文章