Last active
March 1, 2023 15:34
-
-
Save after-the-sunrise/10889451 to your computer and use it in GitHub Desktop.
Revisions
-
after-the-sunrise revised this gist
Apr 16, 2014 . 2 changed files with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ # Check the alias keytool -list -keystore ${MYKEY}.jks This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,8 @@ import socket, ssl s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ssl_sock = ssl.wrap_socket(s, certfile="${MYKEY}.pem") ssl_sock.connect(('example.com', 443)) -
after-the-sunrise created this gist
Apr 16, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # Check the alias keytool -list -keystore ${MYKEY}.jks # Export to PKCS12 keytool -importkeystore -srckeystore ${MYKEY}.jks -destkeystore ${MYKEY}.pkcs -srcstoretype JKS -deststoretype PKCS12 -alias ${MYALIAS} # Convert to PEM openssl pkcs12 -in ${MYKEY}.pkcs -out ${MYKEY}.pem This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ import socket, ssl s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ssl_sock = ssl.wrap_socket(s,certfile="${MYKEY}.pem") ssl_sock.connect(('example.com', 443)) ssl_sock.send(bytes('test\n', 'UTF-8')) ssl_sock.recv(512) ssl_sock.close s.close