SlideShare uma empresa Scribd logo
1 de 23
Slides for Chapter 7:
Security


         From Coulouris, Dollimore and Kindberg
         Distributed Systems:
                   Concepts and Design
         Edition 4 © Pearson Education 2005
Figure 7.1
Familiar names for the protagonists in security protocols




              Alice     First participant
              Bob       Second participant
              Carol     Participant in three- and four-party protocols
              Dave      Participant in four-party protocols
              Eve       Eavesdropper
              Mallory   Malicious attacker
              Sara      A server

               Instructor’s Guide for Coulouris, Dollimore
               and Kindberg Distributed Systems: Concepts
               and Design Edn 4
               © Pearson Education 2005
Figure 7.2
Cryptography notations




         KA            Alice’s secret key
         KB            Bob’s secret key
         KAB           Secret key shared between Alice and Bob
         KApriv        Alice’s private key (known only to Alice)
         KApub         Alice’s public key (published by Alice for all to read)
         {M}K          Message M encrypted with key K
         [M]K          Message M signed with key K

                  Instructor’s Guide for Coulouris, Dollimore
                  and Kindberg Distributed Systems: Concepts
                  and Design Edn 4
                  © Pearson Education 2005
Figure 7.3
Alice’s bank account certificate




 1. Certificate type
                   :        Account number
 2. Name:                   Alice
 3. Account:                6262626
 4. Certifying authority
                       :    Bob’s Bank
 5. Signature :             {Digest(field 2 + field 3)} KBpriv


                Instructor’s Guide for Coulouris, Dollimore
                and Kindberg Distributed Systems: Concepts
                and Design Edn 4
                © Pearson Education 2005
Figure 7.4
Public-key certificate for Bob’s Bank




 1. Certificate type
                   :        Public key
 2. Name:                   Bob’s Bank
 3. Public key:             KBpub
 4. Certifying authority
                       :    Fred – The Bankers Federation
 5. Signature:              {Digest(field 2 + field 3)} KFpriv



                  Instructor’s Guide for Coulouris, Dollimore
                  and Kindberg Distributed Systems: Concepts
                  and Design Edn 4
                  © Pearson Education 2005
Figure 7.5
Cipher block chaining




  plaintext blocks      n+3    n+2    n+1     XOR
                                                            E(K, M)

  ciphertext blocks      n-3    n-2    n-1     n




              Instructor’s Guide for Coulouris, Dollimore
              and Kindberg Distributed Systems: Concepts
              and Design Edn 4
              © Pearson Education 2005
Figure 7.6
Stream cipher




                  keystream
   number                           E(K, M)   buffer
   generator    n+3   n+2     n+1
                                                       XOR

                                                              ciphertext
    plaintext
                                                                stream
     stream




                Instructor’s Guide for Coulouris, Dollimore
                and Kindberg Distributed Systems: Concepts
                and Design Edn 4
                © Pearson Education 2005
Figure 7.7
TEA encryption function



void encrypt(unsigned long k[], unsigned long text[]) {
   unsigned long y = text[0], z = text[1];                    1
   unsigned long delta = 0x9e3779b9, sum = 0; int n;          2
   for (n= 0; n < 32; n++) {                                  3
      sum += delta;                                           4
      y += ((z << 4) + k[0]) ^ (z+sum) ^ ((z >> 5) + k[1]);   5
      z += ((y << 4) + k[2]) ^ (y+sum) ^ ((y >> 5) + k[3]);   6
   }
   text[0] = y; text[1] = z;                                  7
}
             Instructor’s Guide for Coulouris, Dollimore
             and Kindberg Distributed Systems: Concepts
             and Design Edn 4
             © Pearson Education 2005
Figure 7.8
TEA decryption function



void decrypt(unsigned long k[], unsigned long text[]) {
   unsigned long y = text[0], z = text[1];
   unsigned long delta = 0x9e3779b9, sum = delta << 5; int n;
   for (n= 0; n < 32; n++) {
      z -= ((y << 4) + k[2]) ^ (y + sum) ^ ((y >> 5) + k[3]);
      y -= ((z << 4) + k[0]) ^ (z + sum) ^ ((z >> 5) + k[1]);
      sum -= delta;
   }
   text[0] = y; text[1] = z;
}
              Instructor’s Guide for Coulouris, Dollimore
              and Kindberg Distributed Systems: Concepts
              and Design Edn 4
              © Pearson Education 2005
Figure 7.9
TEA in use


   void tea(char mode, FILE *infile, FILE *outfile, unsigned long k[]) {
   /* mode is ’e’ for encrypt, ’d’ for decrypt, k[] is the key.*/
       char ch, Text[8]; int i;
       while(!feof(infile)) {
           i = fread(Text, 1, 8, infile);      /* read 8 bytes from infile into Text */
           if (i <= 0) break;
           while (i < 8) { Text[i++] = ' ';} /* pad last block with spaces */
           switch (mode) {
           case 'e':
                encrypt(k, (unsigned long*) Text); break;
           case 'd':
                decrypt(k, (unsigned long*) Text); break;
           } Instructor’s Guide for Coulouris, Dollimore
           fwrite(Text, 1, 8, outfile);        /* write 8 bytes from Text to outfile */
       }
                 and Kindberg Distributed Systems: Concepts
   }             and Design Edn 4
               © Pearson Education 2005
RSA Encryption - 1


To find a key pair e, d:
1. Choose two large prime numbers, P and Q (each greater than 10100), and form:
  N=PxQ
  Z = (P–1) x (Q–1)
2. For d choose any number that is relatively prime with Z (that is, such that d has no
  common factors with Z).
      We illustrate the computations involved using small integer values for P and
  Q:
          P = 13, Q = 17 –> N = 221, Z = 192
          d=5
3.    To find e solve the equation:
  e x d = 1 mod Z
That is, e x d is the smallest element divisible by d in the series Z+1, 2Z+1, 3Z+1, ... .
                  Instructor’s Guide for Coulouris, Dollimore
          e x d = 1 mod 192 = 1, 193, 385, ...
                  and Kindberg Distributed Systems: Concepts
          385 is divisible by d
                  and Design Edn 4
          e = 385/5 = 77
                © Pearson Education 2005
RSA Encryption - 2


To encrypt text using the RSA method, the plaintext is divided into equal blocks of length k
  bits where 2k < N (that is, such that the numerical value of a block is always less than N; in
  practical applications, k is usually in the range 512 to 1024).
       k = 7, since 27 = 128
The function for encrypting a single block of plaintext M is:
       E'(e,N,M) = Me mod N
       for a message M, the ciphertext is M77 mod 221
The function for decrypting a block of encrypted text c to produce the original plaintext block
  is:
       D'(d,N,c) = cd mod N
Rivest, Shamir and Adelman proved that E' and D' are mutual inverses
  (that is, E'(D'(x)) = D'(E'(x)) = x) for all values of P in the range 0 ≤ P ≤ N.
The two parameters e,N can be regarded as a key for the encryption function, and similarly
  d,N represent a key for the decryption function.
                    Instructor’s Guide for Coulouris, Dollimore
So we can write Ke = <e,N> and Kd = <d,N>, and we get the encryption function:
E(Ke, M) ={M}K (the notation here indicating that the encrypted message can be decrypted
                    and Kindberg Distributed Systems: Concepts
  only by the holder of the private key Kd) and D(Kd, ={M}K ) = M.
                  and Design Edn 4
                  © Pearson Education 2005
Figure 7.10
Digital signatures with public keys


                            M                                        signed doc

                                     H(M)      h      E(K pri , h)     {h}Kpri
                Signing

                                            128 bits                    M




                           {h}Kpri                               h'
                                       D(Kpub ,{h})

               Verifying    M                                                     h = h'?

                                  H(doc)    h
               Instructor’s Guide for Coulouris, Dollimore
               and Kindberg Distributed Systems: Concepts
               and Design Edn 4
               © Pearson Education 2005
Figure 7.11
Low-cost signatures with a shared secret key


                           M             signed doc

                                H(M+K)         h
                Signing

                                               M
                           K




                           M
                                                   h

               Verifying
              Instructor’s Guide for Coulouris, Dollimore
                                                     h = h'?

              and Kindberg Distributed Systems: Concepts
                         K       H(M+K)    h'

              and Design Edn 4
              © Pearson Education 2005
Figure 7.12
X509 Certificate format




      Subject                       Distinguished Name, Public Key
      Issuer                        Distinguished Name, Signature
      Period of validity            Not Before Date, Not After Date
      Administrative information    Version, Serial Number
      Extended Information




                 Instructor’s Guide for Coulouris, Dollimore
                 and Kindberg Distributed Systems: Concepts
                 and Design Edn 4
                 © Pearson Education 2005
Figure 7.13
Performance of encryption and secure digest algorithms



                               Key size/hash size   Extrapolated PRB optimized
                                     (bits)            speed       (kbytes/s)
                                                    (kbytes/sec.)
    TEA                                 128            700              -
    DES                                   56           350          7746
    Triple-DES                          112            120          2842
    IDEA                                128            700          4469
    RSA                                 512               7             -
    RSA                                2048              1              -
    MD5          Instructor’s Guide for 128
                                        Coulouris, 1740
                                                   Dollimore 62425
    SHA          and Kindberg Distributed Systems: Concepts
                                        160         750      25162
                 and Design Edn 4
                 © Pearson Education 2005
Figure 7.14
The Needham–Schroeder secret-key authentication protocol



   Header     Message              Notes
   1. A->S:   A, B, NA             A requests S to supply a key for communication
                                   with B.
   2. S->A:   {NA , B, KAB,        S returns a message encrypted in A’s secret key,
                                   containing a newly generated key KAB and a
                   {KAB, A}KB}KA   ‘ticket’ encrypted in B’s secret key. The nonce NA
                                   demonstrates that the message was sent in response
                                   to the preceding one. A believes that S sent the
                                   message because only S knows A’s secret key.
   3. A->B:                        A sends the ‘ticket’ to B.
              {KAB, A}KB
   4. B->A:                   B decrypts the ticket and uses the new key KAB to
              {NB}KAB
                              encrypt another nonce NB.
   5. A->B:    Instructor’s Guide for Coulouris, Dollimore of the
              {NB - 1}KAB     A demonstrates to B that it was the sender
               and Kindberg previous message by returning an agreed
                               Distributed Systems: Concepts
                              transformation of NB.
                and Design Edn 4
                © Pearson Education 2005
Figure 7.15
System architecture of Kerberos


                       Kerberos Key Distribution Centre

                                            Authentication
      Step A                                  database           Ticket-
                                 Authen-                        granting
      1. Request for             tication
                                service A                       service T
         TGS ticket
      2. TGS
         ticket
                                   Step B
                                   3. Request for
                                      server ticket
              Login            4. Server ticket           Step C
           session setup                                  5. Service
              Server                                         request
 Client    session setup                                                     Service   Server
   C                              Request encrypted with session key        function
                                                                                         S
            DoOperation
                  Instructor’sReply encrypted Coulouris, Dollimore
                               Guide for with session key
                  and Kindberg Distributed Systems: Concepts
                  and Design Edn 4
                  © Pearson Education 2005
Figure 7.16
SSL protocol stack




          SSL
       Handshake SSL Change SSL Alert         HTTP     Telnet
                 Cipher Spec Protocol
        protocol

                             SSL Record Protocol

                                    Transport layer (usually TCP)

                                     Network layer (usually IP)


        SSL protocols:
              Instructor’s             Other protocols:
                         Guide for Coulouris, Dollimore
              and Kindberg Distributed Systems: Concepts
              and Design Edn 4
              © Pearson Education 2005
Figure 7.17
TLS handshake protocol


                                                  Establish protocol version, session ID,
                       ClientHello                cipher suite, compression method,
                      ServerHello                 exchange random values


                       Certificate
                   Certificate Request
                                                  Optionally send server certificate and
                                                  request client certificate
                    ServerHelloDone


          Client       Certificate       Server   Send client certificate response if
                    Certificate Verify            requested



                   Change Cipher Spec
                                                  Change cipher suite and finish
                        Finished                  handshake

              Instructor’s Guide for Coulouris, Dollimore
                   Change Cipher Spec

              and Kindberg Distributed Systems: Concepts
                       Finished

              and Design Edn 4
              © Pearson Education 2005
Figure 7.18
TLS handshake configuration options




 Component         Description                        Example
 Key exchange      the method to be used for          RSA with public-key
 method            exchange of a session key          certificates
 Cipher for data   the block or stream cipher to be   IDEA
 transfer          used for data
 Message digest    for creating message               SHA
 function          authentication codes (MACs)

                Instructor’s Guide for Coulouris, Dollimore
                and Kindberg Distributed Systems: Concepts
                and Design Edn 4
                © Pearson Education 2005
Figure 7.19
TLS record protocol


           Application data                   abcdefghi

                          Fragment/combine

           Record protocol units        abc       def     ghi

                          Compress
           Compressed units

                          Hash
           MAC
                          Encrypt

           Encrypted
              Instructor’s Guide for Coulouris, Dollimore
                         Transmit
              and Kindberg Distributed Systems: Concepts
           TCP packet
              and Design Edn 4
              © Pearson Education 2005
Figure 7.20
Use of RC4 stream cipher in IEEE 802.11 WEP


            Encryption                                        Decryption

               IV        Increment
                                                                IV
               K                                                K


               RC4                                              RC4

                    keystream

plaintext      XOR         cipher text IV    cipher text IV     XOR         plaintext


                                                                     IV : initial value
                                                                     K : shared key
                    Instructor’s Guide for Coulouris, Dollimore
                    and Kindberg Distributed Systems: Concepts
                    and Design Edn 4
                    © Pearson Education 2005

Mais conteúdo relacionado

Mais procurados

Advanced OpenSplice Programming - Part I
Advanced OpenSplice Programming - Part IAdvanced OpenSplice Programming - Part I
Advanced OpenSplice Programming - Part IAngelo Corsaro
 
Diametrical Mesh of Tree (D2D-MoT) Architecture: A Novel Routing Solution for...
Diametrical Mesh of Tree (D2D-MoT) Architecture: A Novel Routing Solution for...Diametrical Mesh of Tree (D2D-MoT) Architecture: A Novel Routing Solution for...
Diametrical Mesh of Tree (D2D-MoT) Architecture: A Novel Routing Solution for...IDES Editor
 
A Novel Technique for Image Steganography Based on DWT and Huffman Encoding
A Novel Technique for Image Steganography Based on DWT and Huffman EncodingA Novel Technique for Image Steganography Based on DWT and Huffman Encoding
A Novel Technique for Image Steganography Based on DWT and Huffman EncodingCSCJournals
 
A project on advanced C language
A project on advanced C languageA project on advanced C language
A project on advanced C languagesvrohith 9
 
Core Based Group Communication with Qos Support
Core Based Group Communication with Qos SupportCore Based Group Communication with Qos Support
Core Based Group Communication with Qos SupportIOSR Journals
 
Programacion multiobjetivo
Programacion multiobjetivoProgramacion multiobjetivo
Programacion multiobjetivoDiego Bass
 
A METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILES
A METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILESA METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILES
A METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILESIJNSA Journal
 
Neural network based energy efficient clustering and routing
Neural network based energy efficient clustering and routingNeural network based energy efficient clustering and routing
Neural network based energy efficient clustering and routingambitlick
 
Pal gov.tutorial2.session12 2.architectural solutions for the integration issues
Pal gov.tutorial2.session12 2.architectural solutions for the integration issuesPal gov.tutorial2.session12 2.architectural solutions for the integration issues
Pal gov.tutorial2.session12 2.architectural solutions for the integration issuesMustafa Jarrar
 
The Realization of Agent-Based E-mail automatic Handling System
The Realization of Agent-Based E-mail automatic Handling SystemThe Realization of Agent-Based E-mail automatic Handling System
The Realization of Agent-Based E-mail automatic Handling Systembutest
 

Mais procurados (17)

47 50
47 5047 50
47 50
 
Advanced OpenSplice Programming - Part I
Advanced OpenSplice Programming - Part IAdvanced OpenSplice Programming - Part I
Advanced OpenSplice Programming - Part I
 
Diametrical Mesh of Tree (D2D-MoT) Architecture: A Novel Routing Solution for...
Diametrical Mesh of Tree (D2D-MoT) Architecture: A Novel Routing Solution for...Diametrical Mesh of Tree (D2D-MoT) Architecture: A Novel Routing Solution for...
Diametrical Mesh of Tree (D2D-MoT) Architecture: A Novel Routing Solution for...
 
50 55
50 5550 55
50 55
 
A Novel Technique for Image Steganography Based on DWT and Huffman Encoding
A Novel Technique for Image Steganography Based on DWT and Huffman EncodingA Novel Technique for Image Steganography Based on DWT and Huffman Encoding
A Novel Technique for Image Steganography Based on DWT and Huffman Encoding
 
12 15
12 1512 15
12 15
 
A project on advanced C language
A project on advanced C languageA project on advanced C language
A project on advanced C language
 
Core Based Group Communication with Qos Support
Core Based Group Communication with Qos SupportCore Based Group Communication with Qos Support
Core Based Group Communication with Qos Support
 
159 163
159 163159 163
159 163
 
Fuzzy causal order
Fuzzy causal orderFuzzy causal order
Fuzzy causal order
 
Programacion multiobjetivo
Programacion multiobjetivoProgramacion multiobjetivo
Programacion multiobjetivo
 
A METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILES
A METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILESA METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILES
A METHOD FOR ENCRYPTING AND DECRYPTINGWAVE FILES
 
1.Routing-eng
1.Routing-eng1.Routing-eng
1.Routing-eng
 
CIS246
CIS246CIS246
CIS246
 
Neural network based energy efficient clustering and routing
Neural network based energy efficient clustering and routingNeural network based energy efficient clustering and routing
Neural network based energy efficient clustering and routing
 
Pal gov.tutorial2.session12 2.architectural solutions for the integration issues
Pal gov.tutorial2.session12 2.architectural solutions for the integration issuesPal gov.tutorial2.session12 2.architectural solutions for the integration issues
Pal gov.tutorial2.session12 2.architectural solutions for the integration issues
 
The Realization of Agent-Based E-mail automatic Handling System
The Realization of Agent-Based E-mail automatic Handling SystemThe Realization of Agent-Based E-mail automatic Handling System
The Realization of Agent-Based E-mail automatic Handling System
 

Destaque

Chapter 6 slides
Chapter 6 slidesChapter 6 slides
Chapter 6 slideslara_ays
 
Chapter 5 slides
Chapter 5 slidesChapter 5 slides
Chapter 5 slideslara_ays
 
Chapter 4 slides
Chapter 4 slidesChapter 4 slides
Chapter 4 slideslara_ays
 
Chapter 3 slides
Chapter 3 slidesChapter 3 slides
Chapter 3 slideslara_ays
 
Stij5014 distributed systems
Stij5014 distributed systemsStij5014 distributed systems
Stij5014 distributed systemslara_ays
 
Chapter 3 slides (Distributed Systems)
Chapter 3 slides (Distributed Systems)Chapter 3 slides (Distributed Systems)
Chapter 3 slides (Distributed Systems)soe sumijan
 
Chapter 2 system models
Chapter 2 system modelsChapter 2 system models
Chapter 2 system modelsAbDul ThaYyal
 
Chapter 9 slides
Chapter 9 slidesChapter 9 slides
Chapter 9 slideslara_ays
 
Chapter 3 a
Chapter 3 aChapter 3 a
Chapter 3 alara_ays
 
Chapter 1 slides
Chapter 1 slidesChapter 1 slides
Chapter 1 slidessoe sumijan
 
Chapter 2 slides
Chapter 2 slidesChapter 2 slides
Chapter 2 slideslara_ays
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Peter R. Egli
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed SystemsRupsee
 

Destaque (16)

Chapter 6 slides
Chapter 6 slidesChapter 6 slides
Chapter 6 slides
 
Chapter 5 slides
Chapter 5 slidesChapter 5 slides
Chapter 5 slides
 
Chapter 4 slides
Chapter 4 slidesChapter 4 slides
Chapter 4 slides
 
Chapter 3 slides
Chapter 3 slidesChapter 3 slides
Chapter 3 slides
 
Stij5014 distributed systems
Stij5014 distributed systemsStij5014 distributed systems
Stij5014 distributed systems
 
Chapter 3 slides (Distributed Systems)
Chapter 3 slides (Distributed Systems)Chapter 3 slides (Distributed Systems)
Chapter 3 slides (Distributed Systems)
 
Chapter 2 system models
Chapter 2 system modelsChapter 2 system models
Chapter 2 system models
 
Ch12
Ch12Ch12
Ch12
 
Chapter 9 slides
Chapter 9 slidesChapter 9 slides
Chapter 9 slides
 
Chapter 3 a
Chapter 3 aChapter 3 a
Chapter 3 a
 
Chapter 1 slides
Chapter 1 slidesChapter 1 slides
Chapter 1 slides
 
Chapter 2 slides
Chapter 2 slidesChapter 2 slides
Chapter 2 slides
 
Chapter 1 slides
Chapter 1 slidesChapter 1 slides
Chapter 1 slides
 
Remote Method Invocation (RMI)
Remote Method Invocation (RMI)Remote Method Invocation (RMI)
Remote Method Invocation (RMI)
 
Arboles03
Arboles03Arboles03
Arboles03
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 

Semelhante a Chapter 7 slides

Semelhante a Chapter 7 slides (20)

Security
Security Security
Security
 
C0211822
C0211822C0211822
C0211822
 
International Journal of Computational Engineering Research(IJCER)
 International Journal of Computational Engineering Research(IJCER)  International Journal of Computational Engineering Research(IJCER)
International Journal of Computational Engineering Research(IJCER)
 
Homomorphic Encryption
Homomorphic EncryptionHomomorphic Encryption
Homomorphic Encryption
 
20CS2008 Computer Networks
20CS2008 Computer Networks 20CS2008 Computer Networks
20CS2008 Computer Networks
 
Cupdf.com public key-cryptography-569692953829a
Cupdf.com public key-cryptography-569692953829aCupdf.com public key-cryptography-569692953829a
Cupdf.com public key-cryptography-569692953829a
 
Lec1
Lec1Lec1
Lec1
 
Cordination&amp;agreement
Cordination&amp;agreementCordination&amp;agreement
Cordination&amp;agreement
 
Cybersecurity Research Paper
Cybersecurity Research PaperCybersecurity Research Paper
Cybersecurity Research Paper
 
Threshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random PermutationsThreshold and Proactive Pseudo-Random Permutations
Threshold and Proactive Pseudo-Random Permutations
 
Internet security
Internet securityInternet security
Internet security
 
Crystallite size nanomaterials
Crystallite size   nanomaterialsCrystallite size   nanomaterials
Crystallite size nanomaterials
 
D0111720
D0111720D0111720
D0111720
 
Nov 02 P2
Nov 02 P2Nov 02 P2
Nov 02 P2
 
Ecc2
Ecc2Ecc2
Ecc2
 
OS ppt Modified.pptx
OS ppt Modified.pptxOS ppt Modified.pptx
OS ppt Modified.pptx
 
encryption and decryption
encryption and decryptionencryption and decryption
encryption and decryption
 
How to Share a Secret
How to Share a SecretHow to Share a Secret
How to Share a Secret
 
2024.03.22 - Mike Heddes - Introduction to Hyperdimensional Computing.pdf
2024.03.22 - Mike Heddes - Introduction to Hyperdimensional Computing.pdf2024.03.22 - Mike Heddes - Introduction to Hyperdimensional Computing.pdf
2024.03.22 - Mike Heddes - Introduction to Hyperdimensional Computing.pdf
 
public-key cryptography Shamir
public-key cryptography Shamirpublic-key cryptography Shamir
public-key cryptography Shamir
 

Chapter 7 slides

  • 1. Slides for Chapter 7: Security From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 4 © Pearson Education 2005
  • 2. Figure 7.1 Familiar names for the protagonists in security protocols Alice First participant Bob Second participant Carol Participant in three- and four-party protocols Dave Participant in four-party protocols Eve Eavesdropper Mallory Malicious attacker Sara A server Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 3. Figure 7.2 Cryptography notations KA Alice’s secret key KB Bob’s secret key KAB Secret key shared between Alice and Bob KApriv Alice’s private key (known only to Alice) KApub Alice’s public key (published by Alice for all to read) {M}K Message M encrypted with key K [M]K Message M signed with key K Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 4. Figure 7.3 Alice’s bank account certificate 1. Certificate type : Account number 2. Name: Alice 3. Account: 6262626 4. Certifying authority : Bob’s Bank 5. Signature : {Digest(field 2 + field 3)} KBpriv Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 5. Figure 7.4 Public-key certificate for Bob’s Bank 1. Certificate type : Public key 2. Name: Bob’s Bank 3. Public key: KBpub 4. Certifying authority : Fred – The Bankers Federation 5. Signature: {Digest(field 2 + field 3)} KFpriv Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 6. Figure 7.5 Cipher block chaining plaintext blocks n+3 n+2 n+1 XOR E(K, M) ciphertext blocks n-3 n-2 n-1 n Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 7. Figure 7.6 Stream cipher keystream number E(K, M) buffer generator n+3 n+2 n+1 XOR ciphertext plaintext stream stream Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 8. Figure 7.7 TEA encryption function void encrypt(unsigned long k[], unsigned long text[]) { unsigned long y = text[0], z = text[1]; 1 unsigned long delta = 0x9e3779b9, sum = 0; int n; 2 for (n= 0; n < 32; n++) { 3 sum += delta; 4 y += ((z << 4) + k[0]) ^ (z+sum) ^ ((z >> 5) + k[1]); 5 z += ((y << 4) + k[2]) ^ (y+sum) ^ ((y >> 5) + k[3]); 6 } text[0] = y; text[1] = z; 7 } Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 9. Figure 7.8 TEA decryption function void decrypt(unsigned long k[], unsigned long text[]) { unsigned long y = text[0], z = text[1]; unsigned long delta = 0x9e3779b9, sum = delta << 5; int n; for (n= 0; n < 32; n++) { z -= ((y << 4) + k[2]) ^ (y + sum) ^ ((y >> 5) + k[3]); y -= ((z << 4) + k[0]) ^ (z + sum) ^ ((z >> 5) + k[1]); sum -= delta; } text[0] = y; text[1] = z; } Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 10. Figure 7.9 TEA in use void tea(char mode, FILE *infile, FILE *outfile, unsigned long k[]) { /* mode is ’e’ for encrypt, ’d’ for decrypt, k[] is the key.*/ char ch, Text[8]; int i; while(!feof(infile)) { i = fread(Text, 1, 8, infile); /* read 8 bytes from infile into Text */ if (i <= 0) break; while (i < 8) { Text[i++] = ' ';} /* pad last block with spaces */ switch (mode) { case 'e': encrypt(k, (unsigned long*) Text); break; case 'd': decrypt(k, (unsigned long*) Text); break; } Instructor’s Guide for Coulouris, Dollimore fwrite(Text, 1, 8, outfile); /* write 8 bytes from Text to outfile */ } and Kindberg Distributed Systems: Concepts } and Design Edn 4 © Pearson Education 2005
  • 11. RSA Encryption - 1 To find a key pair e, d: 1. Choose two large prime numbers, P and Q (each greater than 10100), and form: N=PxQ Z = (P–1) x (Q–1) 2. For d choose any number that is relatively prime with Z (that is, such that d has no common factors with Z). We illustrate the computations involved using small integer values for P and Q: P = 13, Q = 17 –> N = 221, Z = 192 d=5 3. To find e solve the equation: e x d = 1 mod Z That is, e x d is the smallest element divisible by d in the series Z+1, 2Z+1, 3Z+1, ... . Instructor’s Guide for Coulouris, Dollimore e x d = 1 mod 192 = 1, 193, 385, ... and Kindberg Distributed Systems: Concepts 385 is divisible by d and Design Edn 4 e = 385/5 = 77 © Pearson Education 2005
  • 12. RSA Encryption - 2 To encrypt text using the RSA method, the plaintext is divided into equal blocks of length k bits where 2k < N (that is, such that the numerical value of a block is always less than N; in practical applications, k is usually in the range 512 to 1024). k = 7, since 27 = 128 The function for encrypting a single block of plaintext M is: E'(e,N,M) = Me mod N for a message M, the ciphertext is M77 mod 221 The function for decrypting a block of encrypted text c to produce the original plaintext block is: D'(d,N,c) = cd mod N Rivest, Shamir and Adelman proved that E' and D' are mutual inverses (that is, E'(D'(x)) = D'(E'(x)) = x) for all values of P in the range 0 ≤ P ≤ N. The two parameters e,N can be regarded as a key for the encryption function, and similarly d,N represent a key for the decryption function. Instructor’s Guide for Coulouris, Dollimore So we can write Ke = <e,N> and Kd = <d,N>, and we get the encryption function: E(Ke, M) ={M}K (the notation here indicating that the encrypted message can be decrypted and Kindberg Distributed Systems: Concepts only by the holder of the private key Kd) and D(Kd, ={M}K ) = M. and Design Edn 4 © Pearson Education 2005
  • 13. Figure 7.10 Digital signatures with public keys M signed doc H(M) h E(K pri , h) {h}Kpri Signing 128 bits M {h}Kpri h' D(Kpub ,{h}) Verifying M h = h'? H(doc) h Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 14. Figure 7.11 Low-cost signatures with a shared secret key M signed doc H(M+K) h Signing M K M h Verifying Instructor’s Guide for Coulouris, Dollimore h = h'? and Kindberg Distributed Systems: Concepts K H(M+K) h' and Design Edn 4 © Pearson Education 2005
  • 15. Figure 7.12 X509 Certificate format Subject Distinguished Name, Public Key Issuer Distinguished Name, Signature Period of validity Not Before Date, Not After Date Administrative information Version, Serial Number Extended Information Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 16. Figure 7.13 Performance of encryption and secure digest algorithms Key size/hash size Extrapolated PRB optimized (bits) speed (kbytes/s) (kbytes/sec.) TEA 128 700 - DES 56 350 7746 Triple-DES 112 120 2842 IDEA 128 700 4469 RSA 512 7 - RSA 2048 1 - MD5 Instructor’s Guide for 128 Coulouris, 1740 Dollimore 62425 SHA and Kindberg Distributed Systems: Concepts 160 750 25162 and Design Edn 4 © Pearson Education 2005
  • 17. Figure 7.14 The Needham–Schroeder secret-key authentication protocol Header Message Notes 1. A->S: A, B, NA A requests S to supply a key for communication with B. 2. S->A: {NA , B, KAB, S returns a message encrypted in A’s secret key, containing a newly generated key KAB and a {KAB, A}KB}KA ‘ticket’ encrypted in B’s secret key. The nonce NA demonstrates that the message was sent in response to the preceding one. A believes that S sent the message because only S knows A’s secret key. 3. A->B: A sends the ‘ticket’ to B. {KAB, A}KB 4. B->A: B decrypts the ticket and uses the new key KAB to {NB}KAB encrypt another nonce NB. 5. A->B: Instructor’s Guide for Coulouris, Dollimore of the {NB - 1}KAB A demonstrates to B that it was the sender and Kindberg previous message by returning an agreed Distributed Systems: Concepts transformation of NB. and Design Edn 4 © Pearson Education 2005
  • 18. Figure 7.15 System architecture of Kerberos Kerberos Key Distribution Centre Authentication Step A database Ticket- Authen- granting 1. Request for tication service A service T TGS ticket 2. TGS ticket Step B 3. Request for server ticket Login 4. Server ticket Step C session setup 5. Service Server request Client session setup Service Server C Request encrypted with session key function S DoOperation Instructor’sReply encrypted Coulouris, Dollimore Guide for with session key and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 19. Figure 7.16 SSL protocol stack SSL Handshake SSL Change SSL Alert HTTP Telnet Cipher Spec Protocol protocol SSL Record Protocol Transport layer (usually TCP) Network layer (usually IP) SSL protocols: Instructor’s Other protocols: Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 20. Figure 7.17 TLS handshake protocol Establish protocol version, session ID, ClientHello cipher suite, compression method, ServerHello exchange random values Certificate Certificate Request Optionally send server certificate and request client certificate ServerHelloDone Client Certificate Server Send client certificate response if Certificate Verify requested Change Cipher Spec Change cipher suite and finish Finished handshake Instructor’s Guide for Coulouris, Dollimore Change Cipher Spec and Kindberg Distributed Systems: Concepts Finished and Design Edn 4 © Pearson Education 2005
  • 21. Figure 7.18 TLS handshake configuration options Component Description Example Key exchange the method to be used for RSA with public-key method exchange of a session key certificates Cipher for data the block or stream cipher to be IDEA transfer used for data Message digest for creating message SHA function authentication codes (MACs) Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005
  • 22. Figure 7.19 TLS record protocol Application data abcdefghi Fragment/combine Record protocol units abc def ghi Compress Compressed units Hash MAC Encrypt Encrypted Instructor’s Guide for Coulouris, Dollimore Transmit and Kindberg Distributed Systems: Concepts TCP packet and Design Edn 4 © Pearson Education 2005
  • 23. Figure 7.20 Use of RC4 stream cipher in IEEE 802.11 WEP Encryption Decryption IV Increment IV K K RC4 RC4 keystream plaintext XOR cipher text IV cipher text IV XOR plaintext IV : initial value K : shared key Instructor’s Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn 4 © Pearson Education 2005