ΥΣ13 computer security pgp › csec › assets › slides › pgp.pdf · intro how does...

38
ΥΣ13 Computer Security PGP

Upload: others

Post on 30-Jun-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

ΥΣ13 Computer SecurityPGP

Page 2: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Intro

How does cryptography work?

A cryptographic algorithm, or cipher, is a mathematical function used in the encryption and decryption process. A cryptographic algorithm works in combination with a key — a word, number, or phrase — to encrypt the plaintext. The same plaintext encrypts to different ciphertext with different keys.

The security of encrypted data is entirely dependent on two things: ● the strength of the cryptographic algorithm● the secrecy of the key

2

Page 3: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Symmetric vs Asymmetric Encryption

● Symmetric encryption uses a single key that needs to be shared among the people who need to receive the message while asymmetrical encryption uses a pair of public key and a private key to encrypt and decrypt messages when communicating.

● Asymmetric encryption was introduced to complement the inherent problem of the need to share the key in symmetrical encryption model, eliminating the need to share the key by using a pair of public-private keys.

● Asymmetric encryption takes relatively more time than the symmetric encryption.

3

Page 4: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Symmetric vs Asymmetric Encryption

4

Page 5: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Symmetric vs Asymmetric Encryption

5

Page 6: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Symmetric vs Asymmetric Encryption

Symmetric Encryption Algorithms● Blowfish, AES, RC4, DES, RC5, RC6● Most commonly used AES-128, AES-192, and AES-256

Asymmetric Encryption Algorithms● EIGamal, RSA, DSA, Elliptic curve techniques, PKCS, Diffie-Hellman

6

Page 7: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

What is PGP ?

● Created by Phil Zimmermann on 1991.● PGP uses a private-key that must be kept secret and a public-key that sender and receiver

must share.● GPG (Gnu Privacy Guard) is an independent implementation of the OpenPGP standards.● Stores pubic-keys on public key servers ( https://pgp.mit.edu/ )● Other uses:

○ Web of trust○ Digital signatures○ A digital certificate contains the user’s identifying information, their public key and one

or more digital signatures.○ Digital Certificates

7

Page 8: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

8

Page 9: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

9

Page 10: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

10

Page 11: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --full-generate-key

11

Page 12: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --full-generate-key

12

Page 13: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --list-keys

13

Page 14: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --list-secret-keys

14

Page 15: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --output ~/revocation.crt --gen-revoke [email protected]

15

Page 16: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --list-keys --keyid-format SHORT

16

Page 17: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --output mygpg.key --armor --export 776F4468

17

Page 18: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --fingerprint 776F4468

18

Page 19: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --sign-key key_id or [email protected]

19

Page 20: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --keyserver pgp.mit.edu --send-keys 776F4468

gpg --keyserver pgp.mit.edu --recv-keys 776F4468

20

Page 21: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg -a --encrypt --recipient key_id or [email protected]

21

Page 22: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --encrypt --sign --armor -r key_id or [email protected]

22

Page 23: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

23

Page 24: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --decrypt

24

Page 25: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

25

Page 26: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --clearsign

26

Page 27: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

PGP

gpg --verify

27

Page 28: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Next slides are from some topics that we talked about + ssh key creation.

28

Page 29: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

SSH

ssh-keygen -f test_key -t rsa -b 4096-f <filename_to_save_private_key>-t <algorithm_to_use> rsa, dsa, ecdsa, ed25519 -b <key_size> differs to each algorithm

More info: https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys 29

Page 30: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

SSH

Private key

30

Page 31: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

SSH

Public key (store this to the remote computer that you want to connect to)

31

Page 32: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Openssl, x509, CA

Creating certificate authority ca.key and ca.cer

32

Page 33: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Openssl, x509, CA

Generating our server’s private key

33

Page 34: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Openssl, x509, CA

Generating a certificate signing request that we send to our ca .

34

Page 35: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Openssl, x509, CA

CA receives our request and generates our x509 certificate.

35

Page 36: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Openssl, x509, CA

We need to enable apache2 to use our ssl certificate.After that we have One way SSL authentication to our web server.

More info on configuring apache to use a certificate: https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-16-04https://www.digitalocean.com/community/tutorials/openssl-essentials-working-with-ssl-certificates-private-keys-and-csrs

https://www.digitalocean.com/community/tutorials/how-to-create-a-ssl-certificate-on-apache-for-debian-8

36

Page 37: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Openssl, x509, CA

Finally, our web server with our certificate.

37

Page 38: ΥΣ13 Computer Security PGP › csec › assets › slides › pgp.pdf · Intro How does cryptography work? A cryptographic algorithm, or cipher, is a mathematical function used

Openssl, x509, CA

Finally, our web server with our certificate.Our certificate information that we can get from any browser.

38