Action | Notes |
---|---|
hold down the 'Windows' key while you hit the 'r' key | the RUN dialog will appear |
type cmd then click the OK button | c:\WINDOWS\system32\cmd32.exe will open |
type cd c:/ then hit the <enter> key | move to root of c drive |
type cd openss* then hit the <enter> key | drop into a folder |
type cd bin then hit the <enter> key | openssl.exe lives here |
type openssl then hit the <enter> key |
The following examples shows how to start a test server (you may need to create a certificate) then start a test client ON THE SAME MACHINE for educational purposes
sequence description ------------- ------------------------------------- :: remarks beginning of remarks (to end of line) rem remarks beginning of remarks (to end of line) %= remarks =% embedded remarks ^ line continuation character echo yada display variable "yada" echo ON display commands as they are executed (script tracing) echo OFF disable script tracing
@echo ON
:: =============================================================
:: title : ssl-prep1.bat
:: purpose : create a self-signed certificate for ssl-server.bat
:: notes : ONLY DO THIS if file "openssl.cnf" is missing
:: platform: DOS/Windows
:: author : Neil Rieck
:: created : 2018-01-30
:: =============================================================
copying the OpenSSL template file
:: copy the file and change the extension
copy c:\OpenSSL-Win32\bin\openssl.cfg openssl.cnf
echo Done
@echo ON
:: =============================================================
:: title : ssl-prep2.bat
:: purpose : create a self-signed certificate for ssl-server.bat
:: platform: DOS/Windows
:: author : Neil Rieck
:: created : 2018-01-30
::==============================================================
echo Creating Self-Signed Certificate
setlocal
IF EXIST c:\OpenSSL-Win32\bin SET PATH=%PATH%;c:\OpenSSL-Win32\bin
openssl req %= a circumflex continues the line =% ^
-new ^
-nodes ^
-x509 %= x509 as a switch indicates "self signed" =% ^
-config openssl.cnf ^
-days 365 %= will expire in one year =% ^
-set_serial 20180130 %= any big number (here I used ccyymmdd) =% ^
-keyout hack123.key %= I could have created/used a new key with -keyout =% ^
-out hack123.crt %= certificate data will be written here =%
echo Done
endlocal
@echo ON
:: =====================================================
:: title : ssl-server1.bat
:: purpose: ssl server demo for DOS/Windows
:: author : Neil Rieck
:: created: 2018-01-30
:: =====================================================
echo Starting OpenSSL Server1 (simple)
setlocal
IF EXIST c:\OpenSSL-Win32\bin SET PATH=%PATH%;c:\OpenSSL-Win32\bin
openssl s_server ^
-accept 5000 %= listen on port 5000 =% ^
-cert hack123.crt ^
-key hack123.key ^
-debug %= this line is optional =% ^
-www %= barely simulate a webserver =%
echo Done
@echo ON
:: =====================================================
:: title : ssl-server2.bat
:: purpose: ssl server demo for DOS/Windows
:: author : Neil Rieck
:: created: 2018-01-30
:: =====================================================
echo Starting OpenSSL Server1 (simple)
setlocal
IF EXIST c:\OpenSSL-Win32\bin SET PATH=%PATH%;c:\OpenSSL-Win32\bin
openssl s_server ^
-accept 5000 %= listen on port 5000 =% ^
-cert hack123.crt ^
-key hack123.key ^
-debug %= this line is optional =% ^
-WWW %= fully simulate a webserver =%
echo Done
@echo ON
:: =====================================================
:: title : ssl-client.bat
:: purpose: ssl client demo for DOS/Windows
:: author : Neil Rieck
:: created: 2018-01-30
:: =====================================================
echo Starting OpenSSL client on port 5000
setlocal
IF EXIST c:\OpenSSL-Win32\bin SET PATH=%PATH%;c:\OpenSSL-Win32\bin
openssl s_client ^
-debug %= this is optional =% ^
-connect 127.0.0.1:5000
echo Done
<!DOCTYPE html> <html> <head> <title>index.html</title> </head> <body> <p>This is a test</p> </body> </html>
Legend: <ur> user response <sr> system response <enter> hit the enter key
session #1 (server) | session #2 (client) |
---|---|
<sr> C:\Users\Neil>
<ur> ssl-server1.bat <enter>
<sr> bla...bla...bla...
<sr> bla...bla...bla...
<sr> bla...bla...bla...
|
<sr> C:\Users\Neil> <ur> ssl-client.bat <enter> <sr> bla...bla...bla... <ur> GET / HTTP/1.0<enter> <sr> bla...bla...bla... |
session #1 (server) | session #2 (client) |
---|---|
<sr> C:\Users\Neil>
<ur> ssl-server2.bat <enter>
<sr> bla...bla...bla...
<sr> bla...bla...bla...
<sr> bla...bla...bla...
|
<sr> C:\Users\Neil>
<ur> ssl-client.bat <enter>
<sr> bla...bla...bla...
<ur> GET index.html HTTP/1.0<enter>
<sr> bla...bla...bla...
|
SSL (general)
Free OpenSSL books
OpenSSL Tutorials
OpenSSL for Windows
Other