Thanks to visit codestin.com
Credit goes to www.scribd.com

100% found this document useful (1 vote)
164 views26 pages

TP Pki: Open SSL

The document describes the steps to set up a TLS/SSL certificate authority and certificates for securing communication on an Apache web server and for S/MIME email signing and encryption using OpenSSL. It involves generating certificate authority and server certificates, exporting certificates to PKCS#12 format, and testing signed and encrypted emails.

Uploaded by

Camélia Khadra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
164 views26 pages

TP Pki: Open SSL

The document describes the steps to set up a TLS/SSL certificate authority and certificates for securing communication on an Apache web server and for S/MIME email signing and encryption using OpenSSL. It involves generating certificate authority and server certificates, exporting certificates to PKCS#12 format, and testing signed and encrypted emails.

Uploaded by

Camélia Khadra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

TP PKI

Open SSL

- Extract OpenSSL.rar on C :\
- Copy libeay32.dll and ssleay32.dll to C:\Windows\system32
- Go to the Environment Variable and add to the Path variable C:\OpenSSL\out32dll
o Control Panel → System → Advanced System Settings → Environment Variables → Path
- Open the command prompt and type openssl genrsa

- Copy the file openssl.cnf from C:\OpenSSL\openssl.cnf to C:\TP\openssl.cnf


- Edit the file C:\TP\openssl.cnf and add ca_root

- Apache
o Download
▪ https://ftp.icm.edu.pl/packages/replay.old/mirror/ftp.modssl.org/mod_ssl_contrib/
▪ Apache-1.3.23-mod_ssl-2.8.6-openssl-0.9.6c-mod_jk-1.2.0-mod_ntlm-1.3.1-
WIN32.zip
o Run
▪ cd C:\Apache
▪ apache.exe -D SSL
o Shutdown
▪ cd C:\Apache
▪ apache.exe -k shutdown

- edit the file httpd.conf


o servername: www.openssl.local
- Add the server name to the etc/hosts file

- Interpretation: the certificate is not valid


Création de la clé privée

openssl genrsa -des3 -out C:\tp\ca\ca.key 1024

Création du certificat

openssl req -x509 -new -key C:\tp\ca\ca.key -out C:\tp\ca\ca.crt -days 365 -config openssl.cnf -
extensions CA_ROOT

Vérification de la création du certificat

openssl x509 -purpose -in C:\tp\ca\ca.crt -noout


openssl x509 -noout -text -in C:\tp\ca\ca.crt

Génération de la paire de clés RSA CA SSL

openssl genrsa -out C:\tp\ca\ca-ssl.key -des3 -passout pass:elie 1024

Génération de la demande du certificat

openssl req -new -key C:\tp\ca\ca-ssl.key -out C:\tp\ca\ca-ssl.crs -config openssl.cnf -extensions CA_SSL
Signature de la demande de certificat de CA SSL par CA Root

openssl ca -config openssl.cnf -extensions CA_SSL -out C:\tp\ca\ca-ssl.crt -infiles C:\tp\ca\ca-ssl.crs

Vérification

openssl x509 -purpose -in C:\tp\ca\ca-ssl.crt -noout


openssl x509 -noout -text -in C:\tp\ca\ca-ssl.crt

Conversion en format DER

openssl x509 -in C:\tp\ca\ca-ssl.crt -inform PEM -out C:\tp\ca\ca-ssl.cer -outform DER

Génération de la paire de clés RSA CA MIME

openssl genrsa -out C:\tp\ca\ca-mime.key -des3 -passout pass:elie 1024

Génération de la demande de certificat CA MIME

openssl req -new -key C:\tp\ca\ca-mime.key -out C:\tp\ca\ca-mime.crs -config openssl.cnf -extensions
CA_MIME
Signature de la demande de certificat de CA MIME par CA Root

openssl ca -config openssl.cnf -extensions CA_MIME -out C:\tp\ca\ca-mime.crt -infiles C:\tp\ca\ca-


mime.crs

Vérification

openssl x509 -purpose -in C:\tp\ca\ca-mime.crt -noout

openssl x509 -noout -text -in C:\tp\ca\ca-mime.crt


Conversion en format DER

openssl x509 -in C:\tp\ca\ca-mime.crt -inform PEM -out C:\tp\ca\ca-mime.cer -outform DER

Génération de la paire de clés RSA (Serveur SSL)

openssl genrsa -out C:\tp\ca\server-ssl.key 1024

Génération de la demande de certificat Serveur SSL

openssl req -new -key C:\tp\ca\server-ssl.key -out C:\tp\ca\s.crs -config openssl.cnf -extensions
SERVER_SSL

Signature de la demande de certificat Serveur SSL par CA SSL

openssl ca -config openssl.cnf -extensions SERVER_SSL -cert C:\tp\ca\ca-ssl.crt -keyfile C:\tp\ca\ca-


ssl.key -out C:\tp\ca\server-ssl.crt -infiles C:\tp\ca\s.crs
Vérification

openssl x509 -purpose -in C:\tp\ca\server-ssl.crt -noout

Génération de la paire de clés RSA (Client SSL)

openssl genrsa -out C:\tp\ca\client-ssl.key -des3 -passout pass:elie 1024


Génération de la demande de certificat Client SSL

openssl req -new -key C:\tp\ca\client-ssl.key -out C:\tp\ca\c.crs -config openssl.cnf -extensions
CLIENT_SSL

Signature de la demande de certificat Client SSL par CA SSL

openssl ca -config openssl.cnf -extensions CLIENT_SSL -cert C:\tp\ca\ca-ssl.crt -keyfile C:\tp\ca\ca-ssl.key


-out C:\tp\ca\client-ssl.crt -infiles C:\tp\ca\c.crs

Vérification

openssl x509 -purpose -in C:\tp\ca\client-ssl.crt -noout


Edit the file httpd.conf and change the following
Génération du hash des certificats

openssl x509 -hash -noout -in C:\tp\ca\ca-ssl.crt

openssl x509 -hash -noout -in C:\tp\ca\ca.crt

copy ca-ssl.crt 197b6030.0

copy ca.crt 1d4850be.0

Vérification de la validité du certificat présenté


Configuration des paramètres de sécurité dans IE concernant les protocoles SSL et TLS

Importation des certificats


Exportation des certificats clients en format PKCS12

openssl pkcs12 -export -inkey C:\tp\ca\client-ssl.key -in C:\tp\ca\client-ssl.crt -out C:\tp\ca\client-ssl.p12


-name "Certificat Client SSL"
Importation du certificat personnel en format PKCS12

Création du répertoire C:\Apache\htdocs\secure


Copiage du fichier index.htm.en htdocs → htdoc/secure
Configuration du fichier httpd.conf pour vérifier l’accès au www.openssl.local/secure via le certificat
Génération de la paire de clés RSA S/MIME

openssl genrsa -out C:\tp\ca\client-mime.key -des3 -passout pass:elie 1024


Création de la demande de certificat

openssl req -new -key C:\tp\ca\client-mime.key -out C:\tp\ca\cm.crs -config openssl.cnf -extensions
CLIENT_MIME

Signature de la demande de certificat par CA MIME

openssl ca -config openssl.cnf -extensions CLIENT_MIME -cert C:\tp\ca\ca-mime.crt -keyfile C:\tp\ca\ca-


mime.key -out C:\tp\ca\cm.crt -infiles C:\tp\ca\cm.crs

ren cm.crt client-mime.crt


Vérification

openssl x509 -text -in C:\tp\ca\client-mime.crt -noout

Génération de la paire de clés RSA S/MIME (dummy)

openssl genrsa -out C:\tp\ca\client-mime2.key -des3 -passout pass:elie 1024

openssl req -new -key C:\tp\ca\client-mime2.key -out C:\tp\ca\cm2.crs -config openssl.cnf -extensions
CLIENT_MIME
Signature de la demande de certificat par CA MIME

openssl ca -config openssl.cnf -extensions CLIENT_MIME -cert C:\tp\ca\ca-mime.crt -keyfile C:\tp\ca\ca-


mime.key -out C:\tp\ca\cm2.crt -infiles C:\tp\ca\cm2.crs

ren cm2.crt client-mime2.crt


openssl x509 -text -in C:\TP\ca\client-mime2.crt -noout

echo ceci est un test >message.txt

openssl smime -sign -in message.txt -out mail.msg -text -signer client-mime.crt -inkey client-mime.key
Génération du hash des certificats

openssl x509 -hash -in ca.crt -noout

copy ca.crt 1d4850be.0

openssl x509 -hash -in ca-mime.crt -noout

copy ca-mime.crt 14db4a52.0

Vérifier de la validation du certificat

openssl smime -verify -CApath ca -in C:\tp\ca\mail.msg Content-Type: text/plain

openssl smime -verify -CApath ca -in C:\tp\ca\mail.msg -signer C:\tp\ca\signataire.crt


Vérification

openssl x509 -text -noout -in C:\tp\ca\signataire.crt

echo ceci est un test >message.txt

Chiffrement du message

openssl smime -encrypt -in C:\tp\ca\message.txt -des3 -out C:\tp\ca\mail.msg C:\tp\ca\client-mime2.crt


Déchiffrement du message

openssl smime -decrypt -in C:\tp\ca\mail.msg -recip C:\tp\ca\client-mime2.crt -inkey C:\tp\ca\client-


mime2.key

Exportation des certificats clients messagerie en format PKCS12

openssl pkcs12 -export -inkey C:\tp\ca\client-mime.key -in C:\tp\ca\client-mime.crt -out C:\tp\ca\client-


mime.p12 -name "Certificate Mail 1024"

Importation du certificat personnel en format PKCS12


Mot de passe utilisé lors de l'importation du certificat et définissez la sécurité sur HIGH
Configuration du client messagerie

Configuration des paramètres de sécurité

Utilisation de la publication sur GAL (liste d'adresses globale) dans les nouvelles versions d'Outlook
Envoi de courier signé et chiffré

E-mail reçu signé avec certificat

You might also like