-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from Mahesh-Binayak/release-1.2.0.1
Added expected name changes and convert.sh.
- Loading branch information
Showing
6 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
path=$1 | ||
partner_name=$( printenv PARTNER_KC_USERNAME ) | ||
cert_path=$path/certs/$partner_name | ||
|
||
|
||
keystore_file=$cert_path/keystore.p12 | ||
|
||
# Prompt for keystore password | ||
keystore_password=$(cat key.pwd) | ||
|
||
|
||
openssl pkcs12 -in "$keystore_file" -clcerts -nokeys -out temp.pem -passin pass:"$keystore_password" | ||
openssl x509 -in temp.pem -out output.cer | ||
rm temp.pem | ||
|
||
echo "User certificate exported successfully to output.cer" | ||
|
||
# Convert newline escape sequences to actual newlines | ||
sed 's/\\n/\n/g' output.cer > input.pem | ||
|
||
# Extract the public key from the certificate in PEM format | ||
CERTIFICATE_FILE=./input.pem | ||
openssl x509 -in "${CERTIFICATE_FILE}" -pubkey -noout > pubkey.pem | ||
|
||
# Convert the PEM public key to JWK format using the pem-jwk tool | ||
#npm install -g pem-jwk | ||
pem-jwk pubkey.pem > ./publickey.jwk | ||
cat publickey.jwk | ||
mv ./publickey.jwk $cert_path/publickey.jwk | ||
|
||
# Clean up temporary files | ||
rm input.pem pubkey.pem | ||
|
||
echo "Public key converted to JWK format and saved as pubkey.jwk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters