SWEN-331: Engineering Secure Software Benjamin S Meyers
Applied Cryptography (Pt. 1)
Engineering Secure Software
Last Revised: October 13, 2020 1
Applied Cryptography (Pt. 1) Engineering Secure Software Last - - PowerPoint PPT Presentation
Applied Cryptography (Pt. 1) Engineering Secure Software Last Revised: October 13, 2020 SWEN-331: Engineering Secure Software Benjamin S Meyers 1 Networks, Cryptography, and You Most application developers Dont implement networking
SWEN-331: Engineering Secure Software Benjamin S Meyers
Last Revised: October 13, 2020 1
SWEN-331: Engineering Secure Software Benjamin S Meyers
2
SWEN-331: Engineering Secure Software Benjamin S Meyers
3
SWEN-331: Engineering Secure Software Benjamin S Meyers
4
SWEN-331: Engineering Secure Software Benjamin S Meyers
5
SWEN-331: Engineering Secure Software Benjamin S Meyers
6
SWEN-331: Engineering Secure Software Benjamin S Meyers
7 Source: https://www.yubico.com/ Source: https://blockspot.io/
SWEN-331: Engineering Secure Software Benjamin S Meyers
8
SWEN-331: Engineering Secure Software Benjamin S Meyers
9
SWEN-331: Engineering Secure Software Benjamin S Meyers
10 10
SWEN-331: Engineering Secure Software Benjamin S Meyers
11 11
Database Server Bobby
Already authenticated set pwd=“xkcd327” SHA512(“xkcd327”) Done! Done! store Bobby:cc4b3...
SWEN-331: Engineering Secure Software Benjamin S Meyers
12 12
Database Server Bobby
Already authenticated set pwd=“xkcd327” SHA512(“xkcd327”) Done! Done! store Bobby:cc4b3...
SWEN-331: Engineering Secure Software Benjamin S Meyers
13 13
Database Server Bobby
login pwd=“xkcd327” Is Bobby SHA512(“xkcd327”)? Yes! Come on in!
SWEN-331: Engineering Secure Software Benjamin S Meyers
14 14
SWEN-331: Engineering Secure Software Benjamin S Meyers
15 15
SWEN-331: Engineering Secure Software Benjamin S Meyers
16 16
SWEN-331: Engineering Secure Software Benjamin S Meyers
17 17
SWEN-331: Engineering Secure Software Benjamin S Meyers
18 18 Source: https://www.101computing.net/symmetric-vs-asymmetric-encryption/
SWEN-331: Engineering Secure Software Benjamin S Meyers
19 19
SWEN-331: Engineering Secure Software Benjamin S Meyers
20 20
Message Encrypted Message Encrypted Message Message
User 2 Public Key User 2 Private Key
User 1 User 2
SWEN-331: Engineering Secure Software Benjamin S Meyers
21 21
Message Signed Message Signed Message
‘Validated’ Message User 1 Private Key User 1 Public Key
User 1 User 2
SWEN-331: Engineering Secure Software Benjamin S Meyers
22 22
Adam Satan Eve
Eve thinks ESatan = EAdam ESatan[m] m=“We should grab lunch.” DSatan[m] EAdam[m] Satan reads message
SWEN-331: Engineering Secure Software Benjamin S Meyers
23 23
SWEN-331: Engineering Secure Software Benjamin S Meyers
24 24 (3) Verify server cert; check crypto. params
SSL Client
(6) Verify client cert (if required)
SSL Server (1) “client hello” -- Cryptographic information
(2) “server hello” -- CipherSuite; Server cert; “client cert request” (optional) (4) Client key exchange -- send secret key info (encrypted w/ server public key)
(5) Send client certificate (7) Client “finished” (8) Server “finished” (9) Exchange messages (encrypted with shared secret key)
SWEN-331: Engineering Secure Software Benjamin S Meyers
the symmetric encryption of messages, which is faster than asymmetric encryption.
handshake are as follows:
the CipherSuites supported by the client. The message also contains a random byte string that is used in subsequent computations. The protocol allows for the client hello to include the data compression methods supported by the client.
session ID, and another random byte string. The server also sends its digital certificate. If the server requires a digital certificate for client authentication, the server sends a client certificate request that includes a list of the types of certificates supported and the Distinguished Names of acceptable Certification Authorities (CAs).
confidentiality, and integrity.
subsequent message data. The random byte string itself is encrypted with the server's public key.
client's digital certificate, or a no digital certificate alert. This alert is only a warning, but with some implementations the handshake fails if client authentication is mandatory.
integrity.
complete.
complete.
25 25
SWEN-331: Engineering Secure Software Benjamin S Meyers
■ Encrypted with a symmetric cipher ■ Requires a “passphrase” to unlock
26 26
SWEN-331: Engineering Secure Software Benjamin S Meyers
27 27
me@client$ ssh-keygen –t rsa Generating public/private rsa1 key pair... Enter file in which to save the key (~/.ssh/identity): Enter passphrase: Enter same passphrase again: Your public key has been saved in ~/.ssh/id_rsa.pub Your private key has been saved in ~/.ssh/id_rsa The key fingerprint is: 22:bc:0b:fe:f5:06:1d:c0:05:ea:59:09:e3:07:8a:8c
SWEN-331: Engineering Secure Software Benjamin S Meyers
28 28
me@client$ ssh-keygen –t rsa Generating public/private rsa1 key pair... Enter file in which to save the key (~/.ssh/identity): Enter passphrase: Enter same passphrase again: Your public key has been saved in ~/.ssh/id_rsa.pub Your private key has been saved in ~/.ssh/id_rsa The key fingerprint is: 22:bc:0b:fe:f5:06:1d:c0:05:ea:59:09:e3:07:8a:8c me@client$ scp ~/id_rsa.pub me@server.edu:~ me@client$ ssh me@server.edu me@server$ cat id_rsa.pub >> ~/.ssh/authorized_keys OR me@client$ ssh-copy-id -i ~/.ssh/id_rsa.pub me@server.edu
SWEN-331: Engineering Secure Software Benjamin S Meyers
29 29
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been
8b:ff:a1:b5:08:2f:8f:fd:2e:2f:67:80:9e:ba:8d:ff. Please contact your system administrator. Add correct host key in /home/bob/.ssh/known_hosts to get rid of this message. Offending key in /home/bob/.ssh/known_hosts:2 RSA host key for 192.168.1.100 has changed and you have requested strict checking. Host key verification failed.
SWEN-331: Engineering Secure Software Benjamin S Meyers
30 30
Source: https://xkcd.com/936/