Skip to content

Commit b279476

Browse files
committed
Revert self signed cert format to PEM
1 parent 6a400c1 commit b279476

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

generate_winrm_client_cert_self_signed.sh

+4-8
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ PFX_FILE=winrm_client_cert.pfx
99
PFX_PASSWORD=Passw0rd
1010

1111
PEM_FILE=winrm_client_cert.pem
12-
DER_FILE=winrm_client_cert.der
1312

14-
PRIVATE_DIR=`mktemp -d -t openssl`
13+
PRIVATE_DIR=`mktemp -d -t cloudbase-initXXXXXX`
1514
chmod 700 $PRIVATE_DIR
1615

17-
EXT_CONF_FILE=`mktemp -t openssl`
16+
EXT_CONF_FILE=`mktemp -t cloudbase-initXXXXXX.conf`
1817

1918
KEY_FILE=$PRIVATE_DIR/cert.key
2019

@@ -32,17 +31,14 @@ openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -out $PEM_FILE \
3231
-extensions v3_req_client 2> /dev/null
3332

3433
rm $EXT_CONF_FILE
34+
unset OPENSSL_CONF
3535

3636
openssl pkcs12 -export -in $PEM_FILE -inkey $KEY_FILE -out $PFX_FILE \
3737
-password pass:$PFX_PASSWORD
3838

3939
rm -rf $PRIVATE_DIR
4040

41-
# The DER format is easier to manipulate
42-
openssl x509 -inform PEM -in $PEM_FILE -outform DER -out $DER_FILE
43-
rm $PEM_FILE
44-
45-
THUMBPRINT=`openssl x509 -inform DER -in $DER_FILE -fingerprint -noout | \
41+
THUMBPRINT=`openssl x509 -inform PEM -in $PEM_FILE -fingerprint -noout | \
4642
sed -e 's/\://g' | sed -n 's/^.*=\(.*\)$/\1/p'`
4743

4844
echo "Certificate Thumbprint: $THUMBPRINT"

0 commit comments

Comments
 (0)