Chapter 10 - Understanding Cryptography and PKI
Chapter 10 - Understanding Cryptography and PKI
Keys
• Cannot keep the cipher itself secret
• Key ensures ciphertext remains protected
even when the operation of the cipher is
known
• Key size determines how difficult it is for a
computer to guess (brute force) the key
• Most ciphers use a key to increase the
security of the encryption process. For
example, if you consider the Caesar cipher
rot13 described above, you should realize
that the key is 13. You could use 17 to
achieve a different ciphertext from the
same method.
Possible Key Values
Possible Key Values
• An algorithm contains a keyspace, which is a range of values that can be used to construct a key. The key is made up of random values within
the keyspace range. The larger the keyspace, the more available values can be used to represent different keys, and the more random the keys
are, the harder it is for intruders to figure them out.
• A large keyspace allows for more possible keys. The encryption algorithm should use the entire keyspace and choose the values to make up
the keys as randomly as possible. If a smaller keyspace were used, there would be fewer values to choose from when forming a key. This
would increase an attacker’s chance of figuring out the key value and deciphering the protected information.
• A random number generator will generate random values evenly distributed across a full bit space of the key length. A poor random number
generator will tend to select certain values, or the process will choose only certain areas within the resulting keyspace, which reduces the
overall randomness of the process.
Key Lengths
• 40-bit key length = 240 = over 1,000,000,000,000 possibilities
• 64-bit key length = 264 = over 20,000,000,000,000,000,000
• 128-bit key length = 2128 = over 340,000,000,000,000,000,000,000,000,000,000,000,000
• Longer keys require more processing power to break
• The key length should be chosen to provide the right level protection while using an acceptable amount of resources
Keys
c • Block cipher
• Split plaintext into equal-size blocks (usually 64 or 128)
Slide 20
Digital Envelopes
• Alice encrypts the message using a secret-key
cipher such as AES or Blowfish
• The secret key itself is encrypted using public key
cryptography (Bob’s public key) then attacked t the
encrypted message and sent to Bob. In this context,
the secret key is often referred to as a session key
• Bob uses is private key to decrypt the secret key
• Bob uses the secret key to decrypt the message
Slide 21
Asymmetric Encryption Algorithms
ACTION W H O S E K E Y TO U S E W H I C H K E Y TO U S E E X P L A N AT I O N
Bob wants to send Alice an Alice’s Key Public Key When an encrypted message is to be sent, the
Encrypted message recipient’s key is used and not the sender’s keys
Alice wants to read an encrypted Alice’s Key Private Key An encrypted message can only be read by
message sent by bob using the recipient’s private key
Bob wants to send a copy to Bob’s Key Public key to encrypt An encrypted message can only be read by the
himself of the encrypted Private key to decrypt recipient’s private key; Bob would need to
message that he sent to Alice encrypt it with his own public key and then use
his private key to decrypt it
Asymmetric Encryption Algorithms
Bob receives an encrypted reply message Bob’s key Private key The recipient’s private key is used to decrypt
from Alice received messages
Bob wants Susan to read Alice’s reply Susan’s key Public key The message should be encrypted with
message that he received Susan's key for her to decrypt and read it with
her private key
Bob wants to send Alice a message with Bob’s Key Private key Bob’s private key is used to encrypt the hash
a digital signature
Alice wants to see Bob’s digital signature Bob’s key Public key Because Bob’s public and private keys work in
both directions, Alice can use his public key to
decrypt the hash
Asymmetric Encryption Algorithms
Diffie-Hellman
• Diffie Hellman was the first key exchange protocol.
• It allows for two parties, without any prior knowledge of each other, to exchange keys securely over an insecure channel.
• Does not provide data encryption or digital signatures
• However, because the protocol is not authenticated, it is susceptible to a number of attacks, including man-in-the-middle.
• In this attack, someone replaces a legitimate key with his own.
• If someone then uses the attacker’s key to encrypt a message, the attacker will be able to read it.
• If the attacker can replace the public keys of two or more of the communicants, he can effectively read all
communications without anyone knowing he is doing so.
• By adding authentication to Diffie Hellman, it becomes a very secure protocol, and it is used as the foundation for a
number of other cryptographic protocols.
• EDH – Ephemeral Diffie Hellman – temporary key is used in the key exchange instead of reusing the same key over and
overused to create PFS (perfect forward secrecy)
Diffie-Hellman
Asymmet • Diffie-Hellman Versions
ric • EDH – Ephemeral Diffie Hellman – temporary
key is used in the key exchange instead of
Encryptio reusing the same key over and overused to
create PFS (perfect forward secrecy) or may be
referred to as DHE – use ephemeral keys,
n generating different keys for each session
• ECDHE – uses ephemeral keys generated using
Algorithm ECC
s
Asymmetric
Encryption
Algorithms
• Secure Sockets Layer (SSL)
• Commonly used to encrypt
web HTTP traffic
• Uses both asymmetric and
symmetric encryption
• Asymmetric encryption used
to securely share the session
key
• Symmetric encryption used
to encrypt the session data
• Operates at the Session layer
of the OSI Model
Asymmet • Transport Layer Security (TLS)
• Designed as a replacement for SSL
ric • Uses both asymmetric and symmetric
encryption
Algorithm
• Shares private keys using Diffie-Hellman
algorithm
• Operates on the Transport layer of the OSI
s Model
• Encrypting data sent over network
• SSH
• HTTPS
• IPsec
Transport
• SSL / TLS
• In-band versus out-of-band key exchange
Term Definition
Stream Cipher For symmetric cryptography encrypting one bit at a time.
Block Cipher For symmetric cryptography, where messages are encrypted by blocks and the ciphertext output is a block of
the same size.
Hybrid Cryptography Combines asymmetric and symmetric cryptography. Asymmetric cryptography authenticates, then
symmetric keys are used as session keys.
Session Key A unique key generated one time for an individual session.
Avalanche Where changing a single bit in the plaintext will change 50 percent of the bits in the resulting ciphertext.
Cryptanalysis Attacks
Attack Characteristics
Replay Attack Capturing sessions and repeating transmissions.
Ciphertext Only Attack attempts to crack key using ciphertext only.
Known Plaintext Plaintext is known and attacker uses cryptanalysis to decipher key.
Chosen Plaintext Chosen plaintext is known and attacker uses cryptanalysis to decipher key.
Chosen Ciphertext Attacker attempts to decrypt known ciphertext.
Frequency Analysis If inadequate confusion or diffusion, attacker can analyze the frequency of encrypted characters to determine their value.
Mathematical attacks Weaknesses in the cipher, Weaknesses in the keyspace, Weaknesses in the implementation (software)
Man-in-the-Middle Inadequate authentication (secure keys with certificates)
Replay attacks
Inadequate session control / timestamping (prevent by using once-only session tokens or timestamp sessions)
Side channel Monitor power consumption, timing, etc. obtain a physical copy of the crypto system or extreme monitoring software installed.
(studying physical properties of the crypto system)
Implement Certificates and Certificate Authorities
PKI
Certificate Repository
Certificate Revocation System (CRL)
Key Backup and Recovery System (KRA)
RA Certificate Database Certificate
Management System
Automatic Key Update (OCSP)
Time Stamping
Client-side Software
Certificate Authorities
• The certificate authority is responsible for the generation and publication of certificates to be used within the PKI.
• To act as a trusted third party, the CA signs the generated certificate using its private key.
• The CA can then be used to verify the authenticity of an entity’s public key as well as to tie the public key to the
entity’s identity.
• A single certificate can contain multiple signatures. Multiple individuals might sign the key/identification pair to
declare to their own assurance that the public key definitely belongs to the specified owner.
• Third party/public certificate authorities such as VeriSign and Thawte are trusted worldwide and their
certificates are installed by browser vendors such as Microsoft and Google.
• Private certificate authorities such as the Department of Defense create their own certificates to save money
and to have more control over certificates. Their certificates are pushed out to their users using group policy,
although their certificates can be manually imported by other users.
• Usually public and even private certificate authorities are arranged in a hierarchy where the root CA authorizes
subordinate certificate authorities that issue certificates. The chain of trust/root of trust concept allows for this
delegation of certificate responsibilities from the root CA to the subordinate CAs.
Registration Authority (RA)
• A registration authority acts as an intermediary between PKI clients and the CA.
• Its role is to receive requests from the client, validate them, and, if validated, send the
request to the CA.
• The CA then sends the response to the RA who forwards it to the client.
• The RA has no real power within the PKI and simply acts to help scale the infrastructure
by handling processing for the CA.
Understanding a Certificate
• A certificate
• A file used for a variety of security purposes
• Includes:
• Who it was issued to
• Who issued it
• Its purpose(s)
• Validity dates (including an expiration date)
• Its unique serial number
• Public key
Digital
Certificates
• Contains information
about the subject and the
certificate’s issuer.
• Based on x.509 standard –
which defines the fields
that must be present in
the certificate.
• Uses DER (Digital
Encoding Rule)
Field Usage
Version The X.509 version supported (V1, V2, or V3).
Serial Number A number uniquely identifying the certificate within the
domain of its CA.
Signature The algorithm used by the CA to sign the certificate.
Certifica Algorithm
Issuer The name of the CA, expressed as a Distinguished Name
(DN).
6 Entity notified
• N of M control
• Number of administrators that are permitted to access the
system
Key Recovery
Agents (KRA)
• Keys can be backed up to
protect against data loss
• Anyone with access to backup
keys could impersonate the
true key holder
• Key recovery processes (eg M
of N control) make this
difficult
• Escrow – placing archived keys
with a trusted third party
Private Key
Replacement
Process
1. Recover key
2. Decrypt data
3. Destroy original key Original Key
Replacement Key
4. Obtain new key pair
5. Encrypt data with new key
Key Status
and
Revocation
• A CA can use any of the
following reasons to
revoke a certificate
• Key compromise
• CA compromise
• Change of affiliation
• Cease of operation
• Certificate hold
•Revocation versus suspension
• Renewal
• Expiration
•Certificate Revocation List (CRL)
• Distribution Point – where CRL are published
Revocation •
queries the CA about the revocation status of a certificate.
This method has a number of advantages and disadvantages over CRLs.
• One advantage is that revoked certificates are immediately unused by
OCSP clients. With CRL, the revoked certificate may be used until the
cache is refreshed.
• A disadvantage of OCSP is that the client must always be online in order
to query the CA.