SlideShare a Scribd company logo
1 of 25
Download to read offline
OpenSSL &
MS Cryptography Service
Provider
PKI Certificates with MS Crypto API & OpenSSL
Max Kleiner, 2017
Start with OpenSSL
 The Secure Socket Layer protocol was created by
Netscape to ensure secure transactions between web
servers and browsers. The protocol uses a third party, a
Certificate Authority (CA), to identify one end or both
end of the transactions. This is in short how it works.
http://www.softwareschule.ch/download/maxbox_starter47.pdf
The encryption using a private key/public key pair ensures
that the data can be encrypted by one key but can only be
decrypted by the other key. The trick in a key pair is to
keep one key secret (private key) and to distribute the other
key (public key) to everybody.
2
Install OpenSSL
 Nowadays, you do not have to worry too much about
installing OpenSSL: most distributions use package
management applications (see next).
www.softwareschule.ch/maxbox.htm
https://www.openssl.org/
The directory for all OpenSSL certificates is /var/ssl/.
OpenSSL by default looks for a configuration file
in /usr/lib/ssl/openssl.cnf so always add −config
/etc/openssl.cnf to the commands openssl ca or
openssl req for instance.
3
maXboxDelphiSystem
THE COMMAND TOOL
OpenSSL includes a command line utility openssl.exe that
can be used to perform a variety of cryptography functions
like generating your machine certificate in [/CERT].
 The libraries have no noteworthy dependencies just copy
both DLL files into your application directory
 libeay32.dll / ssleay32.dll
Get the SLL binary download Package:
 https://indy.fulgan.com/SSL/openssl-1.0.2l-i386-
win32.zip
4
Create the Certification Authority
 To create a certification authority, use the following
commands after correctly editing openssl.cnf and open
openssl.exe of OpenSSL v1.0.2l:
 CA.pl −newca
The utility will ask you to select a certificate
file to act as you CA certificate or you are
prompted to create one. Follow the steps to
create one as exercise.
5
maXboxDelphiSystem
Create a Root Certification CA (selfsigned)
 First set a const space:
Const
OpenSSLPath='..pki2017openssl-1.0.2l-i386-win32';
2. Create the Root CA (private key pair)
ExecuteShell(OpenSSLPath+'openssl.exe',
'genrsa -des3 -out
'+OpenSSLPath+'./certs/CA_pvkmX42.pem 2048')
3. Check the key pair
rsa -in .certs3CA_pvkmX42.pem -check
6
We sign with private key to make a certificate
of our CA
 4. We generate CA_Cert with signing of private to make a
certificate of CA
ExecuteShell(OpenSSLPath+'openssl.exe',
'req -new -x509 -days 900 -key
'+OpenSSLPath+'./certs/CA_pvkmX42.pem -out
'+OpenSSLPath+'./certs/CA_crt.pem -config
'+OpenSSLPath+'./openssl.cnf')
//}
5. Check the key cert
rsa -in .certs3CA_crt.pem -check
7
Create a Host Cert key pair
 Second we need the host private key
6. Create the Host (private key pair)
ExecuteShell(OpenSSLPath+'openssl.exe',
'genrsa -des3 -out
'+OpenSSLPath+'./certs/host_pvkmX42.pem 2048')
7. Check the key
rsa -in .certshost_pvkmX42.pem -check
8
Create a Host Cert Request
 We sign the host private from the CA (machine
certificate) and generate and sign a certificate request
 8. Create the Host csr cert sign request
ExecuteShell(OpenSSLPath+'openssl.exe',
'req -new -key
'+OpenSSLPath+'./certs/host_pvkmX42.pem -out
'+OpenSSLPath+'./certs/host_csr.pem -config
'+OpenSSLPath+'./openssl.cnf')
Enter a Common Name (CN) the main usage of the certificate for instance www.max.org if
you want to secure the website www.max.org, or enter max@max.org if you want to use to
secure the e−mails
9
Sign and create the Host Cert
 We let sign the host private request (machine certificate)
and out is the wanted host_crt.pem
 9. Create the Host Cert as a web certificate
ExecuteShell(OpenSSLPath+'openssl.exe',
'ca -out
'+OpenSSLPath+'./certs/host_crt.pem -in
'+OpenSSLPath+'./certs/host_csr.pem -cert
'+OpenSSLPath+'./certs/CA_crt.pem -keyfile
'+OpenSSLPath+'./certs/CA_pvkmX42.pem -config
'+OpenSSLPath+'./openssl.cnf')
10
Verify CA and Host Cert
 10. we verify the cert's chain
ExecuteShell(OpenSSLPath+'openssl.exe',
'verify -verbose -CAfile certs/CA_crt.pem
-CApath certs certs/host_pvkmX42.pem')
Or
writeln(getDosOutput('openssl.exe verify -verbose
-CAfile certs/CA_cert.pem -CApath certs
certs/host_crt.pem',OpenSSLPath));
11
Convert to PKCS#12
 Convert a PEM cert file and a private key to a PKCS#12
(.pfx .p12), you get a file that you import in the Certificate
store by clicking on the file when in Windows.


ExecuteShell('cmd.exe','/k
'+OpenSSLPath+'openssl.exe '+
'pkcs12 -export -out
'+OpenSSLPath+'/certs/CERT_PFX.pfx -inkey
'+OpenSSLPath+'/certs/PVK_host.pem -in
'+OpenSSLPath+'/certs/CERT_host_crt.pem -certfile
'+OpenSSLPath+'/certs/CA_crt.pem') // }
12
THE TEST OVERVIEW
OpenSSL Precompiled Binaries for Win32 test:
sr:= loadfromfile(OpenSSLExe+'openssl.exe')
writeln(getsha256(sr))
sleep(500)
writeln((SHA1(OpenSSLExe+'openssl.exe')))
sr:= loadfromfile(OpenSSLExe+'ssleay32.dll')
writeln('ssleay32.dll sha256: '+getSHA256(sr))
sr:= loadfromfile(OpenSSLExe+'libeay32.dll')
writeln('libeay32.dll sha256: '+getSHA256(sr))
13
Process Overview
// we generate the private key pair of the CA:
1. openssl genrsa -des3 -out ./MyDemo/certs/CA_pvk.pem 2048
// we generate CA_Cert sign the private to make a certificate of CA
2. openssl req -new -x509 -days 365 -key ./MyDemo/certs/CA_pvk.pem -out
./MyDemo/certs/CA_crt.pem -config ./openssl.cnf
// we need the host private key
3. openssl genrsa -des3 -out ./MyDemo/crl/host_pvk.pem 2048
// we sign the host private from the CA (machine certificate)
4. openssl req -new -key ./MyDemo/crl/host_pvk.pem -out
./MyDemo/crl/host_csr.pem -config ./openssl.cnf
5. openssl ca -out ./MyDemo/crl/host_crt.pem -in ./MyDemo/crl/host_csr.pem
-cert ./MyDemo/certs/CA_crt.pem -keyfile ./MyDemo/certs/CA_pvk.pem -config
./openssl.cnf // we verify the cert's
6. openssl verify -verbose -CAfile ./MyDemo/certs/CA_crt.pem -CApath
./MyDemo ./MyDemo/crl/host_crt.pem
the result is: ./MyDemo/crl/host_crt.pem: OK 14
maXboxDelphiSystem
MS Crypto API
We do this with a tool from MS called makecert. Most
certificates in common use are based on the X.509 v3
certificate standard. First I open the shell with the MS
SDK:
C:maXboxEKON_BASTAEKON19Windows
Kits10binx64>
C:Program FilesMicrosoft
SDKsWindowsv7.1Bin> makecert -n
"CN=maXboxCertAuth" -cy authority -a
sha1 -sv "maXboxPrivateKey3.pvk" -r
"maXboxCertAuth3.cer" Succeeded
15
Sign Key for Digital Signing
Ref: maxbox_digital_signature_report.pdf
Next we create the second certificate with the purpose to
sign all files we want. In our case, you remember, we want
to sign an executable:
C:Program FilesMicrosoft
SDKsWindowsv7.1Bin>makecert -n
"CN=maXbox3signer" -ic maxboxcertauth3.cer
-iv maXboxprivatekey3.pvk -a sha1 -sky
exchange -pe -sv
maxbox3signerprivatekey.pvk
maxboxsigner.cer Succeeded
16
maXboxDelphiSystem
COMMONLY USED PFX:
17
maXboxDelphiSystem
You need both the public and private keys for an official SSL
Certificate to function. So, if you need to transfer your SSL
Certificates from one server to another, you need to export is
as a .pfx file. Now we generate that as well with the shell:
C:Program FilesMicrosoft
SDKsWindowsv7.1Bin>pvk2pfx -pvk
"maXboxPrivateKey3 .pvk" -spc
maXboxCertAuth3.cer -pfx
maXboxCertAuth3.pfx -pi password
Sign an executable
So it's time to make the last step namely to sign our
executable with another shell tool called signtool:
C:maXboxEKON_BASTAEKON19Windows
Kits10binx64>signtool sign /f
"maxboxsigner.pfx" /p "password" /tr
http://tsa.starfieldtech.com /td SHA256
C:maxboxmaxbox3work2015maxbox3digisign_
certificatesmaxbox44.exe
Done Adding Additional Store Successfully
signed:
C:maxboxmaxbox3work2015maxbox3digisign_
certificatesmaXbox44.exe
18
Certificate Store
Next I want to stress the chain of certificate (block chain is
one of the next big thing).
http://www.softwareschule.ch/download/maxbox_starter54.pdf
A certificate authority themselves have a certificate with
which they digitally sign all the certificates they issue. My
machine (and pretty much everyone's) has a store of the
certificates (see first picture) of these different certificate
authorities.
The computer then knows that if its sees any certificate that
has been signed by one of these trusted certificate
authorities' certificate, then the machine should trust that
certificate.
19
Regex Test EXAMPLE: Mail Finder
20
maXboxDelphiSystem
procedure delphiRegexMailfinder;
begin
// Initialize a test string to include some email addresses. This
would normally be your eMail.
TestString:= '<one@server.domain.xy>, another@otherserver.xyz';
PR:= TPerlRegEx.Create;
try
PR.RegEx:= 'b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}b';
PR.Options:= PR.Options + [preCaseLess];
PR.Compile;
PR.Subject:= TestString; // <-- tell PR where to look for matches
if PR.Match then begin
WriteLn(PR.MatchedText); // Extract first address
while PR.MatchAgain do
WriteLn(PR.MatchedText); // Extract subsequent addresses
end;
finally
PR.Free;
end;
//Readln;
end;
EXAMPLE: HTTP RegEx[ ]
21
maXboxDelphiSystem
% cat get russian rouble rate - datafile
procedure getHttpREGEX(Sender: TObject);
var http1: TIDHTTP;
htret: string;
begin
http1:= TIDHTTP.Create(self);
htret:= HTTP1.Get('http://win.www.citycat.ru/finance/finmarket/_CBR/');
//writeln(htret);
with TRegExpr.Create do try
Expression:= russTemplate;
if Exec(htret) then begin
//if output success
writeln(Format ('Russian rouble rate at %s.%s.%s: %s',
[Match [2], Match [1], Match [3], Match [4]]));
end;
//writeln(dump)
finally Free;
end;
//text2html
//writeln('deco: '+#13+#10+DecorateURLs(htret,[durlAddr, durlPath]))
end;
EXAMPLE: Extract Phones<city code 812
22
maXboxDelphiSystem
% cat grep-delphi-maXbox_datafile
procedure ExtractPhones(const AText: string; APhones: TStrings);
begin
with TRegExpr.Create do try
Expression := '(+d*)?(((d+))*)?(d+(-d*)*)';
if Exec (AText) then
REPEAT
if Match[3] = '812'
then APhones.Add(Match [4]);
UNTIL not ExecNext;
finally Free;
end;
end;
writeln('Formula Gauss : '+
floatToSTr(maXcalc('1/SQRT(2*PI*3^2)*EXP((-
0.0014^2)/(2*3^2))')));
23
Regex Atoms
An atom specifies what text is to be matched and where
it is to be found.
24
Example: Classes
SUMMARY
 OpenSSL Certificates
 MS Crypto API Certificates
 Regex Test Examples
 Certificate Store
https://maxbox4.wordpress.com/
25
maXboxDelphiSystem

More Related Content

What's hot

Issue certificates with PyOpenSSL
Issue certificates with PyOpenSSLIssue certificates with PyOpenSSL
Issue certificates with PyOpenSSLPau Freixes
 
DPAPI AND DPAPI-NG: Decryption toolkit. Black Hat 2017
DPAPI AND DPAPI-NG: Decryption toolkit. Black Hat 2017DPAPI AND DPAPI-NG: Decryption toolkit. Black Hat 2017
DPAPI AND DPAPI-NG: Decryption toolkit. Black Hat 2017Paula Januszkiewicz
 
Mobile Programming - 3 UDP
Mobile Programming - 3 UDPMobile Programming - 3 UDP
Mobile Programming - 3 UDPRiza Fahmi
 
OSSEC @ ISSA Jan 21st 2010
OSSEC @ ISSA Jan 21st 2010OSSEC @ ISSA Jan 21st 2010
OSSEC @ ISSA Jan 21st 2010wremes
 
Mise en place d'un client VPN l2tp IPsec sous docker
Mise en place d'un client VPN l2tp IPsec sous dockerMise en place d'un client VPN l2tp IPsec sous docker
Mise en place d'un client VPN l2tp IPsec sous dockerNicolas Trauwaen
 
[文件] 華創造型SERVER安裝過程記錄 -V6R2016X 安裝流程
[文件] 華創造型SERVER安裝過程記錄 -V6R2016X 安裝流程[文件] 華創造型SERVER安裝過程記錄 -V6R2016X 安裝流程
[文件] 華創造型SERVER安裝過程記錄 -V6R2016X 安裝流程Jimmy Chang
 
Vault - Secret and Key Management
Vault - Secret and Key ManagementVault - Secret and Key Management
Vault - Secret and Key ManagementAnthony Ikeda
 
Hack any website
Hack any websiteHack any website
Hack any websitesunil kumar
 
SSL/TLS for Mortals (J-Fall)
SSL/TLS for Mortals (J-Fall)SSL/TLS for Mortals (J-Fall)
SSL/TLS for Mortals (J-Fall)Maarten Mulders
 
SSL/TLS for Mortals (GOTO Berlin)
SSL/TLS for Mortals (GOTO Berlin)SSL/TLS for Mortals (GOTO Berlin)
SSL/TLS for Mortals (GOTO Berlin)Maarten Mulders
 
CQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slidesCQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slidesZuzannaKornecka
 
BlockChain implementation by python
BlockChain implementation by pythonBlockChain implementation by python
BlockChain implementation by pythonwonyong hwang
 
Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Alexander Polce Leary
 
Breach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with Osquery
Breach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with OsqueryBreach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with Osquery
Breach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with OsqueryUptycs
 
Hiding secrets in Vault
Hiding secrets in VaultHiding secrets in Vault
Hiding secrets in VaultNeven Rakonić
 
Passwords#14 - mimikatz
Passwords#14 - mimikatzPasswords#14 - mimikatz
Passwords#14 - mimikatzBenjamin Delpy
 
OpenSSL Basic Function Call Flow
OpenSSL Basic Function Call FlowOpenSSL Basic Function Call Flow
OpenSSL Basic Function Call FlowWilliam Lee
 
HashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin InfrastructureHashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin InfrastructureNicolas Corrarello
 
Fosdem10
Fosdem10Fosdem10
Fosdem10wremes
 

What's hot (20)

Issue certificates with PyOpenSSL
Issue certificates with PyOpenSSLIssue certificates with PyOpenSSL
Issue certificates with PyOpenSSL
 
DPAPI AND DPAPI-NG: Decryption toolkit. Black Hat 2017
DPAPI AND DPAPI-NG: Decryption toolkit. Black Hat 2017DPAPI AND DPAPI-NG: Decryption toolkit. Black Hat 2017
DPAPI AND DPAPI-NG: Decryption toolkit. Black Hat 2017
 
Mobile Programming - 3 UDP
Mobile Programming - 3 UDPMobile Programming - 3 UDP
Mobile Programming - 3 UDP
 
OSSEC @ ISSA Jan 21st 2010
OSSEC @ ISSA Jan 21st 2010OSSEC @ ISSA Jan 21st 2010
OSSEC @ ISSA Jan 21st 2010
 
Mise en place d'un client VPN l2tp IPsec sous docker
Mise en place d'un client VPN l2tp IPsec sous dockerMise en place d'un client VPN l2tp IPsec sous docker
Mise en place d'un client VPN l2tp IPsec sous docker
 
[文件] 華創造型SERVER安裝過程記錄 -V6R2016X 安裝流程
[文件] 華創造型SERVER安裝過程記錄 -V6R2016X 安裝流程[文件] 華創造型SERVER安裝過程記錄 -V6R2016X 安裝流程
[文件] 華創造型SERVER安裝過程記錄 -V6R2016X 安裝流程
 
Vault - Secret and Key Management
Vault - Secret and Key ManagementVault - Secret and Key Management
Vault - Secret and Key Management
 
Hack any website
Hack any websiteHack any website
Hack any website
 
SSL/TLS for Mortals (J-Fall)
SSL/TLS for Mortals (J-Fall)SSL/TLS for Mortals (J-Fall)
SSL/TLS for Mortals (J-Fall)
 
SSL/TLS for Mortals (GOTO Berlin)
SSL/TLS for Mortals (GOTO Berlin)SSL/TLS for Mortals (GOTO Berlin)
SSL/TLS for Mortals (GOTO Berlin)
 
CQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slidesCQURE_BHAsia19_Paula_Januszkiewicz_slides
CQURE_BHAsia19_Paula_Januszkiewicz_slides
 
BlockChain implementation by python
BlockChain implementation by pythonBlockChain implementation by python
BlockChain implementation by python
 
Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017Building Better Backdoors with WMI - DerbyCon 2017
Building Better Backdoors with WMI - DerbyCon 2017
 
Breach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with Osquery
Breach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with OsqueryBreach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with Osquery
Breach > ATT&CK > Osquery: Cross-platform Endpoint Monitoring with Osquery
 
Hiding secrets in Vault
Hiding secrets in VaultHiding secrets in Vault
Hiding secrets in Vault
 
Passwords#14 - mimikatz
Passwords#14 - mimikatzPasswords#14 - mimikatz
Passwords#14 - mimikatz
 
OpenSSL Basic Function Call Flow
OpenSSL Basic Function Call FlowOpenSSL Basic Function Call Flow
OpenSSL Basic Function Call Flow
 
HashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin InfrastructureHashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin Infrastructure
 
Fosdem10
Fosdem10Fosdem10
Fosdem10
 
Da APK al Golden Ticket
Da APK al Golden TicketDa APK al Golden Ticket
Da APK al Golden Ticket
 

Similar to Open SSL and MS Crypto API EKON21

Seattle C* Meetup: Hardening cassandra for compliance or paranoia
Seattle C* Meetup: Hardening cassandra for compliance or paranoiaSeattle C* Meetup: Hardening cassandra for compliance or paranoia
Seattle C* Meetup: Hardening cassandra for compliance or paranoiazznate
 
Hardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoiaHardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoiazznate
 
The Last Pickle: Hardening Apache Cassandra for Compliance (or Paranoia).
The Last Pickle: Hardening Apache Cassandra for Compliance (or Paranoia).The Last Pickle: Hardening Apache Cassandra for Compliance (or Paranoia).
The Last Pickle: Hardening Apache Cassandra for Compliance (or Paranoia).DataStax Academy
 
Types of ssl commands and keytool
Types of ssl commands and keytoolTypes of ssl commands and keytool
Types of ssl commands and keytoolCheapSSLsecurity
 
Travis and fastlane
Travis and fastlaneTravis and fastlane
Travis and fastlaneSteven Shen
 
Making the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocolMaking the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocolArmenuhi Abramyan
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Conrad Cruz
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringConrad Cruz
 
Various Types of OpenSSL Commands and Keytool
Various Types of OpenSSL Commands and KeytoolVarious Types of OpenSSL Commands and Keytool
Various Types of OpenSSL Commands and KeytoolCheapSSLsecurity
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingMax Kleiner
 
Securing the tunnel with Raccoon
Securing the tunnel with RaccoonSecuring the tunnel with Raccoon
Securing the tunnel with RaccoonGloria Stoilova
 
SSL/TLS for Mortals (JavaZone)
SSL/TLS for Mortals (JavaZone)SSL/TLS for Mortals (JavaZone)
SSL/TLS for Mortals (JavaZone)Maarten Mulders
 
Component pack 6006 install guide
Component pack 6006 install guideComponent pack 6006 install guide
Component pack 6006 install guideRoberto Boccadoro
 
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsPVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsAndrey Karpov
 
3 level cert tomcat
3 level cert tomcat3 level cert tomcat
3 level cert tomcatSuraj Pratap
 
Cloud stack vs openstack vs eucalyptus
Cloud stack vs openstack vs eucalyptusCloud stack vs openstack vs eucalyptus
Cloud stack vs openstack vs eucalyptusAshok Kumar
 
Security and dev ops for high velocity organizations
Security and dev ops for high velocity organizationsSecurity and dev ops for high velocity organizations
Security and dev ops for high velocity organizationsChef
 
When Securing Access to Data is About Life and Death
When Securing Access to Data is About Life and DeathWhen Securing Access to Data is About Life and Death
When Securing Access to Data is About Life and DeathHostedbyConfluent
 

Similar to Open SSL and MS Crypto API EKON21 (20)

Seattle C* Meetup: Hardening cassandra for compliance or paranoia
Seattle C* Meetup: Hardening cassandra for compliance or paranoiaSeattle C* Meetup: Hardening cassandra for compliance or paranoia
Seattle C* Meetup: Hardening cassandra for compliance or paranoia
 
Hardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoiaHardening cassandra for compliance or paranoia
Hardening cassandra for compliance or paranoia
 
The Last Pickle: Hardening Apache Cassandra for Compliance (or Paranoia).
The Last Pickle: Hardening Apache Cassandra for Compliance (or Paranoia).The Last Pickle: Hardening Apache Cassandra for Compliance (or Paranoia).
The Last Pickle: Hardening Apache Cassandra for Compliance (or Paranoia).
 
Rhel5
Rhel5Rhel5
Rhel5
 
Types of ssl commands and keytool
Types of ssl commands and keytoolTypes of ssl commands and keytool
Types of ssl commands and keytool
 
Radius
RadiusRadius
Radius
 
Travis and fastlane
Travis and fastlaneTravis and fastlane
Travis and fastlane
 
Making the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocolMaking the secure communication between Server and Client with https protocol
Making the secure communication between Server and Client with https protocol
 
Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)Aeon mike guide transparent ssl filtering (1)
Aeon mike guide transparent ssl filtering (1)
 
Aeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filteringAeon mike guide transparent ssl filtering
Aeon mike guide transparent ssl filtering
 
Various Types of OpenSSL Commands and Keytool
Various Types of OpenSSL Commands and KeytoolVarious Types of OpenSSL Commands and Keytool
Various Types of OpenSSL Commands and Keytool
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
 
Securing the tunnel with Raccoon
Securing the tunnel with RaccoonSecuring the tunnel with Raccoon
Securing the tunnel with Raccoon
 
SSL/TLS for Mortals (JavaZone)
SSL/TLS for Mortals (JavaZone)SSL/TLS for Mortals (JavaZone)
SSL/TLS for Mortals (JavaZone)
 
Component pack 6006 install guide
Component pack 6006 install guideComponent pack 6006 install guide
Component pack 6006 install guide
 
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsPVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
 
3 level cert tomcat
3 level cert tomcat3 level cert tomcat
3 level cert tomcat
 
Cloud stack vs openstack vs eucalyptus
Cloud stack vs openstack vs eucalyptusCloud stack vs openstack vs eucalyptus
Cloud stack vs openstack vs eucalyptus
 
Security and dev ops for high velocity organizations
Security and dev ops for high velocity organizationsSecurity and dev ops for high velocity organizations
Security and dev ops for high velocity organizations
 
When Securing Access to Data is About Life and Death
When Securing Access to Data is About Life and DeathWhen Securing Access to Data is About Life and Death
When Securing Access to Data is About Life and Death
 

More from Max Kleiner

EKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfEKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfMax Kleiner
 
EKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfEKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfMax Kleiner
 
maXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementmaXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementMax Kleiner
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Max Kleiner
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4Max Kleiner
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87Max Kleiner
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapMax Kleiner
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detectionMax Kleiner
 
BASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationBASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationMax Kleiner
 
EKON 24 ML_community_edition
EKON 24 ML_community_editionEKON 24 ML_community_edition
EKON 24 ML_community_editionMax Kleiner
 
EKON 23 Code_review_checklist
EKON 23 Code_review_checklistEKON 23 Code_review_checklist
EKON 23 Code_review_checklistMax Kleiner
 
EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP Max Kleiner
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures CodingMax Kleiner
 
NoGUI maXbox Starter70
NoGUI maXbox Starter70NoGUI maXbox Starter70
NoGUI maXbox Starter70Max Kleiner
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIIMax Kleiner
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VIMax Kleiner
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning VMax Kleiner
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3Max Kleiner
 
EKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsEKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsMax Kleiner
 
Ekon22 tensorflow machinelearning2
Ekon22 tensorflow machinelearning2Ekon22 tensorflow machinelearning2
Ekon22 tensorflow machinelearning2Max Kleiner
 

More from Max Kleiner (20)

EKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfEKON26_VCL4Python.pdf
EKON26_VCL4Python.pdf
 
EKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfEKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdf
 
maXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementmaXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_Implement
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmap
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detection
 
BASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationBASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data Visualisation
 
EKON 24 ML_community_edition
EKON 24 ML_community_editionEKON 24 ML_community_edition
EKON 24 ML_community_edition
 
EKON 23 Code_review_checklist
EKON 23 Code_review_checklistEKON 23 Code_review_checklist
EKON 23 Code_review_checklist
 
EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures Coding
 
NoGUI maXbox Starter70
NoGUI maXbox Starter70NoGUI maXbox Starter70
NoGUI maXbox Starter70
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VII
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VI
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning V
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3
 
EKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsEKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_Diagrams
 
Ekon22 tensorflow machinelearning2
Ekon22 tensorflow machinelearning2Ekon22 tensorflow machinelearning2
Ekon22 tensorflow machinelearning2
 

Recently uploaded

Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad EscortsCall girls in Ahmedabad High profile
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysismanisha194592
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 

Recently uploaded (20)

VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 

Open SSL and MS Crypto API EKON21

  • 1. OpenSSL & MS Cryptography Service Provider PKI Certificates with MS Crypto API & OpenSSL Max Kleiner, 2017
  • 2. Start with OpenSSL  The Secure Socket Layer protocol was created by Netscape to ensure secure transactions between web servers and browsers. The protocol uses a third party, a Certificate Authority (CA), to identify one end or both end of the transactions. This is in short how it works. http://www.softwareschule.ch/download/maxbox_starter47.pdf The encryption using a private key/public key pair ensures that the data can be encrypted by one key but can only be decrypted by the other key. The trick in a key pair is to keep one key secret (private key) and to distribute the other key (public key) to everybody. 2
  • 3. Install OpenSSL  Nowadays, you do not have to worry too much about installing OpenSSL: most distributions use package management applications (see next). www.softwareschule.ch/maxbox.htm https://www.openssl.org/ The directory for all OpenSSL certificates is /var/ssl/. OpenSSL by default looks for a configuration file in /usr/lib/ssl/openssl.cnf so always add −config /etc/openssl.cnf to the commands openssl ca or openssl req for instance. 3 maXboxDelphiSystem
  • 4. THE COMMAND TOOL OpenSSL includes a command line utility openssl.exe that can be used to perform a variety of cryptography functions like generating your machine certificate in [/CERT].  The libraries have no noteworthy dependencies just copy both DLL files into your application directory  libeay32.dll / ssleay32.dll Get the SLL binary download Package:  https://indy.fulgan.com/SSL/openssl-1.0.2l-i386- win32.zip 4
  • 5. Create the Certification Authority  To create a certification authority, use the following commands after correctly editing openssl.cnf and open openssl.exe of OpenSSL v1.0.2l:  CA.pl −newca The utility will ask you to select a certificate file to act as you CA certificate or you are prompted to create one. Follow the steps to create one as exercise. 5 maXboxDelphiSystem
  • 6. Create a Root Certification CA (selfsigned)  First set a const space: Const OpenSSLPath='..pki2017openssl-1.0.2l-i386-win32'; 2. Create the Root CA (private key pair) ExecuteShell(OpenSSLPath+'openssl.exe', 'genrsa -des3 -out '+OpenSSLPath+'./certs/CA_pvkmX42.pem 2048') 3. Check the key pair rsa -in .certs3CA_pvkmX42.pem -check 6
  • 7. We sign with private key to make a certificate of our CA  4. We generate CA_Cert with signing of private to make a certificate of CA ExecuteShell(OpenSSLPath+'openssl.exe', 'req -new -x509 -days 900 -key '+OpenSSLPath+'./certs/CA_pvkmX42.pem -out '+OpenSSLPath+'./certs/CA_crt.pem -config '+OpenSSLPath+'./openssl.cnf') //} 5. Check the key cert rsa -in .certs3CA_crt.pem -check 7
  • 8. Create a Host Cert key pair  Second we need the host private key 6. Create the Host (private key pair) ExecuteShell(OpenSSLPath+'openssl.exe', 'genrsa -des3 -out '+OpenSSLPath+'./certs/host_pvkmX42.pem 2048') 7. Check the key rsa -in .certshost_pvkmX42.pem -check 8
  • 9. Create a Host Cert Request  We sign the host private from the CA (machine certificate) and generate and sign a certificate request  8. Create the Host csr cert sign request ExecuteShell(OpenSSLPath+'openssl.exe', 'req -new -key '+OpenSSLPath+'./certs/host_pvkmX42.pem -out '+OpenSSLPath+'./certs/host_csr.pem -config '+OpenSSLPath+'./openssl.cnf') Enter a Common Name (CN) the main usage of the certificate for instance www.max.org if you want to secure the website www.max.org, or enter max@max.org if you want to use to secure the e−mails 9
  • 10. Sign and create the Host Cert  We let sign the host private request (machine certificate) and out is the wanted host_crt.pem  9. Create the Host Cert as a web certificate ExecuteShell(OpenSSLPath+'openssl.exe', 'ca -out '+OpenSSLPath+'./certs/host_crt.pem -in '+OpenSSLPath+'./certs/host_csr.pem -cert '+OpenSSLPath+'./certs/CA_crt.pem -keyfile '+OpenSSLPath+'./certs/CA_pvkmX42.pem -config '+OpenSSLPath+'./openssl.cnf') 10
  • 11. Verify CA and Host Cert  10. we verify the cert's chain ExecuteShell(OpenSSLPath+'openssl.exe', 'verify -verbose -CAfile certs/CA_crt.pem -CApath certs certs/host_pvkmX42.pem') Or writeln(getDosOutput('openssl.exe verify -verbose -CAfile certs/CA_cert.pem -CApath certs certs/host_crt.pem',OpenSSLPath)); 11
  • 12. Convert to PKCS#12  Convert a PEM cert file and a private key to a PKCS#12 (.pfx .p12), you get a file that you import in the Certificate store by clicking on the file when in Windows.   ExecuteShell('cmd.exe','/k '+OpenSSLPath+'openssl.exe '+ 'pkcs12 -export -out '+OpenSSLPath+'/certs/CERT_PFX.pfx -inkey '+OpenSSLPath+'/certs/PVK_host.pem -in '+OpenSSLPath+'/certs/CERT_host_crt.pem -certfile '+OpenSSLPath+'/certs/CA_crt.pem') // } 12
  • 13. THE TEST OVERVIEW OpenSSL Precompiled Binaries for Win32 test: sr:= loadfromfile(OpenSSLExe+'openssl.exe') writeln(getsha256(sr)) sleep(500) writeln((SHA1(OpenSSLExe+'openssl.exe'))) sr:= loadfromfile(OpenSSLExe+'ssleay32.dll') writeln('ssleay32.dll sha256: '+getSHA256(sr)) sr:= loadfromfile(OpenSSLExe+'libeay32.dll') writeln('libeay32.dll sha256: '+getSHA256(sr)) 13
  • 14. Process Overview // we generate the private key pair of the CA: 1. openssl genrsa -des3 -out ./MyDemo/certs/CA_pvk.pem 2048 // we generate CA_Cert sign the private to make a certificate of CA 2. openssl req -new -x509 -days 365 -key ./MyDemo/certs/CA_pvk.pem -out ./MyDemo/certs/CA_crt.pem -config ./openssl.cnf // we need the host private key 3. openssl genrsa -des3 -out ./MyDemo/crl/host_pvk.pem 2048 // we sign the host private from the CA (machine certificate) 4. openssl req -new -key ./MyDemo/crl/host_pvk.pem -out ./MyDemo/crl/host_csr.pem -config ./openssl.cnf 5. openssl ca -out ./MyDemo/crl/host_crt.pem -in ./MyDemo/crl/host_csr.pem -cert ./MyDemo/certs/CA_crt.pem -keyfile ./MyDemo/certs/CA_pvk.pem -config ./openssl.cnf // we verify the cert's 6. openssl verify -verbose -CAfile ./MyDemo/certs/CA_crt.pem -CApath ./MyDemo ./MyDemo/crl/host_crt.pem the result is: ./MyDemo/crl/host_crt.pem: OK 14 maXboxDelphiSystem
  • 15. MS Crypto API We do this with a tool from MS called makecert. Most certificates in common use are based on the X.509 v3 certificate standard. First I open the shell with the MS SDK: C:maXboxEKON_BASTAEKON19Windows Kits10binx64> C:Program FilesMicrosoft SDKsWindowsv7.1Bin> makecert -n "CN=maXboxCertAuth" -cy authority -a sha1 -sv "maXboxPrivateKey3.pvk" -r "maXboxCertAuth3.cer" Succeeded 15
  • 16. Sign Key for Digital Signing Ref: maxbox_digital_signature_report.pdf Next we create the second certificate with the purpose to sign all files we want. In our case, you remember, we want to sign an executable: C:Program FilesMicrosoft SDKsWindowsv7.1Bin>makecert -n "CN=maXbox3signer" -ic maxboxcertauth3.cer -iv maXboxprivatekey3.pvk -a sha1 -sky exchange -pe -sv maxbox3signerprivatekey.pvk maxboxsigner.cer Succeeded 16 maXboxDelphiSystem
  • 17. COMMONLY USED PFX: 17 maXboxDelphiSystem You need both the public and private keys for an official SSL Certificate to function. So, if you need to transfer your SSL Certificates from one server to another, you need to export is as a .pfx file. Now we generate that as well with the shell: C:Program FilesMicrosoft SDKsWindowsv7.1Bin>pvk2pfx -pvk "maXboxPrivateKey3 .pvk" -spc maXboxCertAuth3.cer -pfx maXboxCertAuth3.pfx -pi password
  • 18. Sign an executable So it's time to make the last step namely to sign our executable with another shell tool called signtool: C:maXboxEKON_BASTAEKON19Windows Kits10binx64>signtool sign /f "maxboxsigner.pfx" /p "password" /tr http://tsa.starfieldtech.com /td SHA256 C:maxboxmaxbox3work2015maxbox3digisign_ certificatesmaxbox44.exe Done Adding Additional Store Successfully signed: C:maxboxmaxbox3work2015maxbox3digisign_ certificatesmaXbox44.exe 18
  • 19. Certificate Store Next I want to stress the chain of certificate (block chain is one of the next big thing). http://www.softwareschule.ch/download/maxbox_starter54.pdf A certificate authority themselves have a certificate with which they digitally sign all the certificates they issue. My machine (and pretty much everyone's) has a store of the certificates (see first picture) of these different certificate authorities. The computer then knows that if its sees any certificate that has been signed by one of these trusted certificate authorities' certificate, then the machine should trust that certificate. 19
  • 20. Regex Test EXAMPLE: Mail Finder 20 maXboxDelphiSystem procedure delphiRegexMailfinder; begin // Initialize a test string to include some email addresses. This would normally be your eMail. TestString:= '<one@server.domain.xy>, another@otherserver.xyz'; PR:= TPerlRegEx.Create; try PR.RegEx:= 'b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}b'; PR.Options:= PR.Options + [preCaseLess]; PR.Compile; PR.Subject:= TestString; // <-- tell PR where to look for matches if PR.Match then begin WriteLn(PR.MatchedText); // Extract first address while PR.MatchAgain do WriteLn(PR.MatchedText); // Extract subsequent addresses end; finally PR.Free; end; //Readln; end;
  • 21. EXAMPLE: HTTP RegEx[ ] 21 maXboxDelphiSystem % cat get russian rouble rate - datafile procedure getHttpREGEX(Sender: TObject); var http1: TIDHTTP; htret: string; begin http1:= TIDHTTP.Create(self); htret:= HTTP1.Get('http://win.www.citycat.ru/finance/finmarket/_CBR/'); //writeln(htret); with TRegExpr.Create do try Expression:= russTemplate; if Exec(htret) then begin //if output success writeln(Format ('Russian rouble rate at %s.%s.%s: %s', [Match [2], Match [1], Match [3], Match [4]])); end; //writeln(dump) finally Free; end; //text2html //writeln('deco: '+#13+#10+DecorateURLs(htret,[durlAddr, durlPath])) end;
  • 22. EXAMPLE: Extract Phones<city code 812 22 maXboxDelphiSystem % cat grep-delphi-maXbox_datafile procedure ExtractPhones(const AText: string; APhones: TStrings); begin with TRegExpr.Create do try Expression := '(+d*)?(((d+))*)?(d+(-d*)*)'; if Exec (AText) then REPEAT if Match[3] = '812' then APhones.Add(Match [4]); UNTIL not ExecNext; finally Free; end; end; writeln('Formula Gauss : '+ floatToSTr(maXcalc('1/SQRT(2*PI*3^2)*EXP((- 0.0014^2)/(2*3^2))')));
  • 23. 23 Regex Atoms An atom specifies what text is to be matched and where it is to be found.
  • 25. SUMMARY  OpenSSL Certificates  MS Crypto API Certificates  Regex Test Examples  Certificate Store https://maxbox4.wordpress.com/ 25 maXboxDelphiSystem