Professional Documents
Culture Documents
Fonctionnement des
PKI
Franck Davy
<Franck.Davy@hsc.fr>
Fonctionnement des PKI
-1-
Bases de cryptographie
Plan
Introduction Mcanismes
Notions de base Chiffrement
Signature
Algorithmes
clef secrte
En pratique
Messagerie lectronique
Fonctions de hachage
scurise avec S/MIME
Intgrit
Authentification
Non rpudiation
Mcanismes
Mcanismes mettant en oeuvre les services prcdents, fonds sur les algorithmes
cryptographiques
Chiffrement
Signature
Scellement
Algorithmes
Algorithmes symtriques, clef secrte
Destinataire n1
zno!
DI/. Message
@ ml en
metteur <;L_am clair
du message lZcY
vB
Message Destinataire n2
en
clair CXi^L-
s7Rs:' Message
V}aI en
clair
#@U#E
@lCtlJ
Exemple de la Montique :
Montant de la transaction
Identifiant du commerant
Signature
Message Message Message
en en en
clair clair clair
Clef
de session
zno!
DI/.
@ ml Message
Clef publique <;L_am en
lZcY clair
destinataire
vB
Clef prive
destinataire
Schma
1.On choisit p, q deux grands nombres premiers
2.On calcule n=p.q
3.Un entier e est choisi tel que premier avec (p-1) et (q-1)
4.L'entier d tel que ed = 1 [(p-1)(q-1)] est calcul, avec l'algorithme
d'Euclide
le couple d'entier (n, e) reprsente la clef publique
1. Executive Summary
This document defines message encryption and authentication
procedures, in order to provide privacy-enhanced mail (PEM) services
for electronic mail transfer in the Internet. It is intended to
become one member of a related set of four RFCs. The procedures
defined in the current document are intended to be compatible with a
wide range of key management approaches, including both symmetric
(secret-key) and asymmetric (public-key) approaches for encryption of
data encrypting keys.
Messages chiffrs PEM Part III : Algorithms, Modes, and Identifiers (RFC1423)
Exemple : Chiffrement DES-CBC
En-tte Proc-Type
En-tte DEK-Info :
http://www.ietf.org/rfc/rfc2437.txt
Anciennement : PKCS#1 RSA Cryptography Standard
Structure ASN.1
Clef RSA obtenue par encodage DER de la structure ASN.1 (fichier binaire)
%&$
!
12
"
*+
-.
/
01
,
( '
)
3
Encodage en base64 du fichier binaire avec enc(1ssl)
$ cat ./rsa.DER | openssl base64 -e
MIIBOQIBAAJBALGWJEoGAC6fYqpG9vCx1LEcjFtrhw2WDZ71Ne+Q2ZvgbqDE9j8S
IsjEStKc2UZ/w2bnPc8k+3LTTGCTQ9SAdsMCAwEAAQJAT9VlXvmvn0X7vvzECpSH
P0/MMVT3k73/RZSKuLXvfcj5Lsmce/rMWQkNxC2a5G32UzNvDbOrRIW1O3QCXZNh
kQIhAOGrWfk4bnjjejGSGwVVAQ3ynTyOIrfl79iEnKcZKv7lAiEAyXRk9uUa+veK
uL1Oad2kONdzrQdb0sNuOHepinz3HIcCIFTmcmMgp+8zJbWgkinfYRYuQJmXn9gv
2ZxLx+PVxCdBAiAaD4KYJd8tpCQ/7c1dCJ0b9VMziQYp57o0d9Zo4e2dtQIgbxdY
Fsf591Z/Q9sZkoxgUMpuSxBBC8qxWyUGHcEF+DY=
Tripwire
Stockage non rversible de mots de passe
Fichier shadow(5), fond sur l'algorithme md5
$ sudo grep davy /etc/shadow
davy:$1$zdgjjRrg$b9oxpVEDX8I4KgWanwbpd.:11924:0:99999:7:::
$1 : Algorithme MD5
$2 : Piment
Protection contre les attaques par dictionnaire prcalcul
Piment en clair (diffrent d'un MAC)
$3 : Empreinte rsultante
Utilisations multiples !
Pile ou face
Influence du changement d'un caractre de texte clair sur l'empreinte rsultante
$ cat message.txt
Contrle d'intgrit
$ cat message.txt | openssl md5 -c
ef:79:ca:b5:4f:9b:2a:d9:8e:79:ef:46:46:e4:93:63
$ cat message.txt | tr C c | openssl md5 -c
c5:f1:bf:54:2a:7f:27:04:d2:65:78:a1:bc:47:7c:e7
Objectifs
Mise en oeuvre des protocoles SSL (Secure Socket Layer)
Protocole de scurisation rseau TCP/IP qui opre au niveau session du modle OSI
Opre au dessus d'un protocole de transport de donnes fiable (TCP RFC793)
Opre au dessus du niveau transport (4) -> applications spcifiques
Ports ddis, attribus par l'IANA : HTTP 80/tcp, mais HTTPS 443/tcp
http://www.cs.auckland.ac.nz/~pgut001/dumpasn1.c
Fichier de configuration (OID)
http://www.cs.auckland.ac.nz/~pgut001/dumpasn1.cfg
Auteur : Peter Gutmann <pgut001@cs.auckland.ac.nz>
OID = 06 09 2A 86 48 86 F7 0D 01 01 01
Comment = PKCS #1
Description = rsaEncryption (1 2 840 113549 1 1 1)
GET / HTTP/1.0
Host: www.webserver.com
Signature
Mcanisme de chiffrement de l'empreinte avec la clef RSA prive de l'metteur
(
(
Authentification de l'metteur
+ service de non-rpudiation
Confidentialit des donnes
Vrification de la signature
Verification Successful
- 59 - Franck Davy - Herv Schauer Consultants 2001-2003 - Reproduction Interdite
Messagerie scurise avec S/MIME
(3/6)
Format d'un message sign au format S/MIME
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature";
micalg=sha1; boundary="----D53ABC9FB71E03185AE729DA6DAD1931"
This is an S/MIME signed message
------D53ABC9FB71E03185AE729DA6DAD1931
Content-Type: text/plain
------D53ABC9FB71E03185AE729DA6DAD1931
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
MIIGuwYJKoZIhvcNAQcCoIIGrDCCBqgCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3
[...]
6BmKU1IbbuR363HVCM/dsPTGQtJHRCDH+b41NneKWBCqJcs+T8Bn0OIhcr2RFLw=
------D53ABC9FB71E03185AE729DA6DAD1931--
MIME-Version:
MIME-Version: 1.0
Content-Disposition: attachment; filename="smime.p7m"
Content-Type: application/x-pkcs7-mime;
application/x-pkcs7-mime; name="smime.p7m"
Content-Transfer-Encoding: base64
MIIMvwYJKoZIhvcNAQcDoIIMsDCCDKwCAQAxggE0MIIBMAIBADCBmDCBkjELMAkG
[...]
8YMC6VlBeF8VCoBjrP8At7P3ELCdfs812RZB1Dxw2Jddjgwce67eFmsRd8stX9pk
Pax1
Structure ASN.1
RFC822 (franck.davy@hsc.fr)
Ct serveur
Authentification par clef publique (RSA/DSA)
Sauvegarde ct client
1024 35 12312312312315016364622805541210905036255388057669
8961735325312313245435645645671203023278678280118194562709
6939937220982467588574628302525586302775483291130879549507
8961735325312313245435645645671203023278678280118194562709
3619651231243454354367454574568832342435454596754237631856
093442973835538980270174901 root@darkstar
$ ssh darkstar
Ct serveur
$ ssh-keygen -l -f ssh_host_rsa_key.pub
1024 5a:51:41:de:62:0c:d8:e9:c4:00:e1:19:f5:61:57:8c ssh_host_rsa_key.pub
192.168.0.253
00:48:54:3d:7d:e7
- 71 - Franck Davy - Herv Schauer Consultants 2001-2003 - Reproduction Interdite
Premire approche :
SSH et drivs (4/5)
Problme de l'authenticit de la clef publique prsente
Contact de l'administrateur
Tiers certifiant le lien entre clef publique et adresse IP ou un nom pleinement qualifi
Premire approche
canal sr
Dans l'exemple prcdent (changement de clef d'hte SSH) :
Contact de l'administrateur systme par tlphone
Administrateur
tiers de confiance
Exemple d'une recherche mene sur le nom Zimmerman sur le dpt keyserver.pgp.com
Public Key Server Error
Search failed
The number of certificates returned by this search exceeds
the maximum set for this server.
- 75 - Franck Davy - Herv Schauer Consultants 2001-2003 - Reproduction Interdite
PGP et le Web of Trust (3/5)
Solutions retenues en pratique
Tlchargement une URL, en HTTP par exemple
Empreinte diffuse par courrier lectronique (en-tte SMTP : X-GPG-Fingerprint)
GnuPG Party
Procdures dcrites dans le GnuPG Keysigning Party HOW-TO
$ ./pgpdump ~/.gnupg/Franck.Davy.asc
[...]
Old: Public Key Packet(tag 6)(418 bytes)
Ver 4 new
Public key creation time - Fri Aug 31 16:52:54 CEST 2001
Pub alg - DSA Digital Signature Standard(pub 17)
DSA p(1024 bits) - ...
DSA q(160 bits) - ...
DSA g(1024 bits) - ...
DSA y(1020 bits) - ...
Old: User ID Packet(tag
Packet(tag 13)(32 bytes)
User ID - Franck DAVY <Franck.Davy@hsc.fr>
<Franck.Davy@hsc.fr>
Communication hors-bande
Communication en ligne
SSL handshake has read 4104 bytes and written 268 bytes
--
New, TLSv1/SSLv3, Cipher is EDH-RSA-DES-CBC3-SHA
Server public key is 1024 bit
SSL-Session:
Protocol : TLSv1
Cipher : EDH-RSA-DES-CBC3-SHA
Session-ID: 269BC84135E313F12A9E624065FAC6FA9452D2F728AE518FEB17E009B8E3FF8B
Session-ID-ctx:
Master-Key: 95F39BE9741D3B55B418A3B6BC8B0F9B3649CF \
F629B2259DEA36C4EAF16D4AB011FE6F62D914A679F7E915344AE8938E
Key-Arg : None
Start Time: 1008002520
Timeout : 300 (sec)
Verify return code: 0 (ok)
---
GET / HTTP/1.0 200 ok
Content-type: text/html[...]
basicContraints
keyUsage
Etc.
Certificate:
Data: tBSCertificate
Version: 1 (0x0)
Serial Number:
32:50:33:cf:50:d1:56:f3:5c:81:ad:65:5c:4f:c8:25
Signature Algorithm: md2WithRSAEncryption
Issuer: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority
Validity
Not Before: Jan 29 00:00:00 1996 GMT
Not After : Jan 7 23:59:59 2020 GMT
Subject: C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):
00:e5:19:bf:6d:a3:56:61:2d:99:48:71:f6:67:de:
[...]
2a:2f:31:aa:ee:a3:67:da:db
Exponent: 65537 (0x10001)
Signature Algorithm: md2WithRSAEncryption signatureAlgorithm
4b:44:66:60:68:64:e4:98:1b:f3:b0:72:e6:95:89:7c:dd:7b:
[...] signatureValue
f8:45
Reprsentation ASN.1
: . . SEQUENCE {
: . . . SET {
: . . . . SEQUENCE {
: . . . . . OBJECT IDENTIFIER countryName (2 5 4 6)
: . . . . . PrintableString 'US'
: . . . . . }
: . . . . }
: . . . SET {
: . . . . SEQUENCE {
: . . . . . OBJECT IDENTIFIER organizationName (2 5 4 10)
: . . . . . PrintableString 'VeriSign, Inc.'
: . . . . . }
: . . . . }
: . . . SET {
: . . . . SEQUENCE {
: . . . . . OBJECT IDENTIFIER organizationalUnitName (2 5 4 11)
: . . . . . PrintableString
: . . . . . . 'Class 1 Public Primary Certification Authority'
: . . . . . }
: . . . . }
: . . . }
2.5.4.6 id-at-countryName
countryName ATTRIBUTE ::= {
SUBTYPE OF name
WITH SYNTAX PrintableString (SIZE (2))
SINGLE VALUE TRUE
ID id-at-countryName
}
Avec :
2.5.4 - X.500 attribute types
2.5 - X.500 Directory Services
2 - ISO/ITU-T jointly assigned OIDs
Top of OID tree
Composantes
Instanciation des certificats X.509v3 et des listes de rvocations X.509 pour une
infrastructure adapte l'Internet (RFC3280)
Protocoles d'exploitation (RFC2559, RFC2585)
Distributions des certificats et listes de rvocation
Protocoles de gestion (RFC2510)
Dialogues entre le diffrentes entits de la PKI
Rgles d'usage et considrations pratiques (RFC2527)
Exigences de scurit
En matire d'identification des sujets, de rvocation des certificats
X509v3 extensions:
2.5.29.1:
0i.....[...*.9..b.S2.R0P1.0...U....US1^M0...U.
0i.....[...*.9..b.S2.R0P1.0...U....US1^M0...U.
..MSFT1200..U...)Microsoft Authenticode(tm) Root Authority...
En pratique : version 3
Numro de Srie
Identifiant unique d'un certificat (pour une autorit signataire donne)
En pratique :
Incrment alatoirement (estimation du nombre de certificats mis ?)
Champs "Subject" et "Issuer"
Comportent respectivement les Distinguished Names (DN) de l'metteur et du signataire du
certificat
Pour le certificat d'une autorit de certification racine, ces deux champs sont gaux
En thorie, constitue un chemin unique vers l'entit possdant le DN rfrenc dans le DIT
- 97 - Franck Davy - Herv Schauer Consultants 2001-2003 - Reproduction Interdite
Champs standards et X.500 (2/3)
En pratique : inexistence d'annuaire X.500...
Peu de sens en pratique (sauf contexte LDAP !)
Seul le commonName est gnralement utilis
Cas des serveurs HTTPS notamment
Tous les RDN peuvent importer dans le cas d'un certificat client
Gestion des autorisations par exemple
Les RDN sont gnralement sans grand rapport avec leur fonction originale
$ ls -al RSASecureServer*
-rw------- 1 davy davy 822074 sep 20 09:01 RSASecureServer.crl
-rw------- 1 davy davy 841986 sep 20 09:01 RSASecureServer.crl.0710
-rw------- 1 davy davy 766740 sep 20 09:01 RSASecureServer-p.crl.old
-rw------- 1 davy davy 768420 sep 20 09:01 RSASecureServer-p.crl.save
Exigences de scurit
Informations diverses
Points de distribution des listes de rvocation, de la politique de certification etc.
Extensions propritaires
En pratique :
Considration laisse la discrtion de l'application
Peu d'extensions reconnues ou prises en compte
Avec de potentielles failles de scurit en consquence
CryptoAPI MS02-050
CA OP 1
10 autorits peuvent
apparatre sous CA ROOT
CA OP 10
Entit Entit
terminale terminale
Exemple :
X509v3 Certificate Policies:
Policy: 2.16.840.1.113733.1.7.1.1
CPS: https://www.verisign.com/CPS
User Notice:
Organization: VeriSign, Inc.
Number: 1
X509v3 extensions:
2.5.29.10:
0.....
commonName:
Authority
.)Microsoft Authenticode(tm) Root Authorit
2.5.29.1:
0i.....[...*.9..b.S2.R0P1.0...U....US1^M0...U.
..MSFT1200..U...)Microsoft Authenticode(tm) Root Authority...
basicContraints
Exemple : X509v3 Basic Constraints : CA:TRUE, pathlen:10
Signification :
terminales : pathlen:10
Ces options n'ont de signification que pour le client manipulant le certificat
= possibilit pour la clef prive associe la clef publique dans le certificat de dlivrer
un certificat
Un certificat terminal peut se comporter comme une autorit de certification
Un certificat serveur SSL/TLS valide peut donc certifier une clef publique
confiance connue
- 108 - Franck Davy - Herv Schauer Consultants 2001-2003 - Reproduction Interdite
Faille CryptoAPI (2/2)
Scnario d'exploitation
Attaque de type Man-in-the-Middle
http://www.hsc.fr/ressources/presentations/mitm/index.html.fr
Certificate chain
0 s:/C=FR/ST=Hauts de Seine/L=CLICHY/O=WEBSERVER Company.../CN=www.webserver.com
i:/O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3
/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
1 s:/O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign International Server CA - Class 3
/OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign
i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority
s:/CN=www.gimmecard .tld
i:/C=FR/ST=Hauts de Seine/L=CLICHY/O=WEBSERVER Company.../CN=www.webserver.com
Commutateur www.gimmecard.tld
Gestion de l'entreprise
Intgration aux ERP
Pays AU BE BR CH DE ES FI FR GB HK HU IT JP MX NL US UY ZA Ind.
4 2 4 1 7 4 2 7 1 4 3 2 3 2 1 41 1 6 11
44 0 62
(1000) Issuer: C=US, O=RSA Data Security, Inc., OU=Secure Server Certification
Authority
(2046) Issuer: C=FR, O=Certiposte, CN=Certiposte Classe A Personne
Issuer: C=FR, O=Certiposte, CN=Certiposte Serveur
Certificate Sign : 40
CRL Sign : 38
Digital Signature : 11
Non Repudiation : 7
CA:TRUE : 60
Pathlen : 15
Pathlen 1 3 4 5 8 10
1 3 3 2 1 5
X509v3 CRL Distribution Points : 22
URI : 13
DirName : 10
200 OK :5
Plages horaires
Configuration
Serveur Apache + Mod_SSL
L'adresse IP
Limitation
Le nom prsent via le RDN 'CN' dans le certificat X.509 ne concide pas forcment avec le nom de
domaine pleinement qualifi (FQDN) par lequel le serveur HTTPS est accd
HTTP/1.0 200 ok
Content-type: text/html
Gnration classique
GET / HTTP/1.0
Host: www1.webserver.com
CN=www.webserver.com
192.0.20.1
GET / HTTP/1.0
Host: www1.webserver.com
CN=www1.webserver.com
192.0.20.1
192.0.20.2
...
- 125 - Franck Davy - Herv Schauer Consultants 2001-2003 - Reproduction Interdite
Dmonstrations : HTTPS (6/8)
Mthodes de validation des certificats
Netscape
Gestion des wildcards et expressions rationnelles dans le champ CN
http://www.netscape.com/eng/security/ssl_2.0_certificate.html
Internet Explorer
Gestion des subjectAltName multivalus de type dNSName
Solution
Certificat hybride
Valeur du commonName
(foo|bar).webserver.com ou *.webserver.com
DNS:foo.webserver.com, DNS:bar.webserver.com
http://www.rtfm.com/sslbook/
AC intermdiaire n2
O=DIRECTION GENERALE DES IMPOTS,
CN=AC DIRECTION GENERALE DES IMPOTS USAGER
pathlen=0
Entit terminale
C=fr, O=DIRECTION GENERALE DES IMPOTS, OU=DIRECTION GENERALE DES IMPOTS USAGER,
OU=AD - 1, OU=D - 0, CN=XXXXXXXXXXXXX DAVY FRANCK
OID description:
-- VeriSign defined certificate extension sub tree -- (2.16.840.1.113733.1.6) --
id-extensions OBJECT IDENTIFIER ::= {id-pki extensions(6)}
Commissariat de Police
Prfecture/sous-prfecture
Fichier ou chemin pointant vers les fichiers, au format PEM, contenant les certificats des
autorits considres comme tant dignes de confiance par le serveur.
Les clefs publiques de ces certificats servent la validation, au sens cryptographique
http://www.hsc.fr/~davy/certs/trustees.pem
2. Autoriser les utilisateurs sur la base des variables d'environnement drives du
certificat client
Exemple d'utilisation : architecture de type SSO
Session SSLv3/TLS
Authentification mutuelle
par certificat X509v3 Propagation du DN auprs des applications
Ex. Rcriture de la QUERY_STRING par
mod_rewrite
Modle hybride
Ct client : Autorit Locale d'Enregistrement
Champ Data
http://wp.netscape.com/eng/security/ca-interface.html
Tag HTML 'KEYGEN'
<KEYGEN NAME="name" CHALLENGE="challenge string">
Une clef RSA de 512 (export), 768 ou 1024 bits est gnre
La clef prive RSA est conserve dans la base de donne locale des certificats
La clef publique et le challenge sont signs par la clef prive
Protection contre le rejeu (les donnes soumises ne sont pas signes !)
Encodage DER de la structure PublicKeyAndChallenge
Autres...
...spcifiques aux applications
.cer application/x-x509-ca-cert
.crl application/pkcs-crl
.crt application/pkix-cert
.crt application/x-x509-ca-cert
.crt application/x-x509-user-cert
etc.
Points de publication
CRL (Protocole HTTP gnralement, mthode GET classiquement)
Extension cRLDistributionPoints
URI:http://bar/crl/foobar.crl
OCSP (Protocole HTTP, mthode POST)
Extension Authority Information Access
OCSP URI:http://foobar/
- 159 - Franck Davy - Herv Schauer Consultants 2001-2003 - Reproduction Interdite
Publication de certificat (4/4)
Dmonstrations
Messagerie scurise avec S/MIME, avec des certificats clients publis dans un
annuaire LDAP
FAQ du DCSSI
http://www.ssi.gouv.fr/fr/faq/faq_igc.html
Mcanisme de CRL
Publication d'une liste priodiquement mise jour des certificats rvoqus
X509v3 extensions:
X509v3 Subject Alternative Name:
DirName:/CN=OCSP 1-4
X509v3 CRL Distribution Points:
URI:http://crl.verisign.com/RSASecureServer-p.crl
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Digital Signature, Key Encipherment
X509v3 CRL Distribution Points:
URI:http://crl.verisign.com/RSASecureServer.crl
X509v3 Certificate Policies:
Policy: 2.16.840.1.113733.1.7.1.1
CPS: https://www.verisign.com/CPS
User Notice:
Organization: VeriSign, Inc.
Number: 1
Explicit Text: VeriSign's CPS incorp. by reference liab. ltd. (c)97 VeriSign
X509v3 Extended Key Usage:
TLS Web Server Authentication, TLS Web Client Authentication
Authority Information Access:
OCSP - URI:http://ocsp.verisign.com
195.101.88.66 : www.certplus.com
216.168.253.32 : crl.verisign.net
Politique d'mission des certificats, qui prcise dans quel cadre le certificat peut tre
utilis
Vrification est la charge de l'utilisateur
Ce document nonce les pratiques utilises par l'IGC dans la gestion des certificats,
pratiques qui dpendent de la politique de certification mise en oeuvre. Une IGC doit
publier cette dclaration afin de dcrire les modalits de fonctionnement des services
qu'elle rend
PC2
Procdures et politiques de certification de cls
www.ssi.gouv.fr/fr/documents/pc2.pdf
Autre...