Skip to content

Commit

Permalink
chore: make local setup work with openssl v3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Dec 24, 2024
1 parent 54b7c8d commit b257752
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/codesign/generate_selfsigned_certificate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,14 @@ EOL
openssl genrsa -out $certificateFile.key 2048
# generate self-signed certificate
openssl req -x509 -new -config $certificateFile.conf -nodes -key $certificateFile.key -extensions extensions -sha256 -out $certificateFile.crt

openssl_version=$(openssl version)
# openssl v3.x requires to pass -legacy
# see https://www.misterpki.com/openssl-pkcs12-legacy/
if [[ $openssl_version == OpenSSL\ 3* ]]; then
flag="-legacy"
else
flag=""
fi
# wrap key and certificate into PKCS12
openssl pkcs12 -export -inkey $certificateFile.key -in $certificateFile.crt -out $certificateFile.p12 -passout pass:$certificatePassword
openssl pkcs12 $flag -export -inkey $certificateFile.key -in $certificateFile.crt -out $certificateFile.p12 -passout pass:$certificatePassword

0 comments on commit b257752

Please sign in to comment.