This is an old revision of the document!
In cryptography, a PKI is an arrangement that binds public keys with respective identities of entities (like people and organizations). The binding is established through a process of registration and issuance of certificates at and by a certificate authority (CA).
PKI is a system for the creation, storage, and distribution of digital certificates which are used to verify that a particular public key belongs to a certain entity. The PKI creates digital certificates which map public keys to entities, securely stores these certificates in a central repository and revokes them if needed. The roles of root certificate, intermediate certificate and end-entity certificate as in the chain of trust can be seen in the picture below:
Using your browser's 'View Certificate' functionality, try to find information about the certificate presented by https://ocw.cs.pub.ro. We are interested in:
Export server and issuer certificates, or download them from here: certificates.tar. We will use openssl
command line tool to investigate certificate files.
openssl s_client -showcerts -connect ocw.cs.pub.ro:443
$ openssl x509 -in ocwcspubro.crt -noout -text $ openssl x509 -in TERENASSLCA3.crt -noout -text
$ openssl x509 -in ocwcspubro.crt -noout -dates $ openssl x509 -in ocwcspubro.crt -noout -issuer $ openssl x509 -in ocwcspubro.crt -noout -subject $ openssl x509 -in ocwcspubro.crt -noout -pubkey
$ openssl verify -CAfile TERENASSLCA3.crt ocwcspubro.crt
The Transport Layer Security protocol aims primarily to provide privacy and data integrity between two communicating computer applications. When secured by TLS, connections between a client (e.g., a web browser) and a server (e.g., wikipedia.org) have one or more of the following properties:
The TLS protocol comprises two layers: the TLS record protocol and the TLS handshake protocol. TLS handshake protocol (both RSA key exchange and Diffie-Hellman key exchange) can be seen in the pictures below:
Using Wireshark, investigate the two traffic captures (traffic-captures.tar). In both cases try to find:
mkdir ca-files server-files
cd ca-files/
)$ cat root-ca.conf [ req ] distinguished_name = req_distinguished_name prompt = no [ req_distinguished_name ] C = RO ST = Bucharest L = Bucharest O = UPB Root CN = UPB Root CA emailAddress = root@root-ca.org
openssl req -config root-ca.conf -new -x509 -sha256 -newkey rsa:2048 -nodes -keyout root-ca.key -days 365 -out root-ca.cert
openssl x509 -in root-ca.cert -text -noout
cd server-files/
)openssl genrsa -out server.key 2048
$ cat server-csr.conf [ req ] distinguished_name = req_distinguished_name prompt = no [ req_distinguished_name ] C = RO ST = Bucharest L = Bucharest O = Applied Cryptography Course CN = applied-cryptography.org emailAddress = office@applied-cryptography.org
openssl req -config server-csr.conf -new -sha256 -key server.key -out server.csr
openssl req -in server.csr -noout -text
mv server.csr && cd ../ca-files/
echo "01" > root-ca.srl openssl x509 -in server.csr -out server.cert -req -CA root-ca.cert -CAkey root-ca.key -days 365 -CAserial root-ca.srl
openssl x509 -in server.cert -text -noout openssl verify -CAfile root-ca.cert server.cert
mv server.csr ../server-files/
sudo apt-get update sudo apt-get install apache2
sudo a2enmod ssl
sudo a2ensite default-ssl
echo "127.0.0.1 applied-cryptography.org" | sudo tee -a /etc/hosts
sudo service apache2 restart
sudo cp server.key /etc/ssl/private/ sudo cp server.cert /etc/ssl/certs/
sudo vim /etc/apache2/sites-available/default-ssl.conf # update SSLCertificate paths
sudo service apache2 restart
navigate to Menu > Preferences > Advanced > Certificates > View Certificates click Import and choose root-ca.cert