Cns Unit 4
Cns Unit 4
Network Security
Course Objectives
Understand security concepts, goals, threats and Security services, mechanisms to counter them. (L2)
Comprehend and apply Classical Encryption Techniques. (L3)
Understand various symmetric cryptographic techniques. (L2)
Learn number theory related to Modern Cryptography. (L2)
Learn different kinds of Message Authentication Techniques. (L2)
Course Outcomes
After completion of this course, the student will be able to:
distinguish between Symmetric and Asymmetric cryptosystems (L4)
analyze and implement Symmetric Classical Ciphers (L4)
explain Hash functions and its algorithms (L2)
apply Digital signature and its algorithms (L3)
discuss public key distribution, Kerberos (L6)
understand security at application and transportation layers. (L2)
Module-4 Syllabus
Cryptographic Hash Functions:
• Applications of hash Functions
• Secure Hash Algorithm (SHA) SHA-512
• SHA
4. Confidentiality can be added to the approach of method (c) by encrypting the entire message
plus the hash code.
• When confidentiality is not required, method (2) has an advantage over methods (1) and (4),
which encrypts the entire message, in that less computation is required.
Applications of Cryptographic Hash Functions
• Message Authentication is achieved using a message authentication code (MAC), also known as
a keyed hash function.
• MACs are used between two parties that share a secret key to authenticate information
exchanged between those parties.
• A MAC function takes as input a secret key and a data block and produces a hash value, referred
to as the MAC.
• If the integrity of the message needs to be checked, the MAC function can be applied to the
message and the result compared with the stored MAC value.
• An attacker who alters the message will be unable to alter the MAC value without knowledge of
the secret key.
Applications of Cryptographic
Hash Functions
DIGITAL SIGNATURES
• The operation of the digital signature is similar to the MAC.
• In digital signature, the hash value of a message is encrypted with a user’s
private key.
• Anyone who knows the user’s public key can verify the integrity of the
message that is associated with the digital signature.
• An attacker who wishes to alter the message would need to know the user’s
private key.
Applications of Cryptographic
Hash Functions
• Ways in which a hash code is used to provide a digital signature:
• The hash code is encrypted, using public-key encryption with the sender’s private
key, this provides authentication.
• If confidentiality as well as a digital signature is desired, then the message plus the
private-key-encrypted hash code can be encrypted using a symmetric secret key.
Applications of Cryptographic Hash
Functions
OTHER APPLICATIONS
• Hash functions are commonly used to create a one-way password file.
• Hash functions can be used for intrusion detection and virus detection.
• A cryptographic hash function can be used to construct a pseudorandom
function (PRF) or a pseudorandom number generator (PRNG).
• A common application for a hash-based PRF is for the generation of
symmetric keys.
Secure Hash Algorithm (SHA)
• Most widely used hash function has been the Secure Hash Algorithm (SHA).
• SHA was developed by the National Institute of Standards and Technology
(NIST) and published as a federal information processing standard (FIPS 180) in
1993.
• SHA-0 was revised in 1995 as SHA-1.
• SHA is based on design of MD4 with key differences.
• SHA-1 produces a hash value of 160 bits.
Secure Hash Algorithm (cont.…)
• Revised Secure Hash Standard
• NIST issued a revision FIPS 180-2 in 2002.
• Defines 3 additional versions of SHA – SHA-256, SHA-384, SHA-512.
• Designed for compatibility with increased security provided by the AES cipher.
• Structure & detail is like SHA-1
• hence analysis should be similar
• but security levels are rather higher
Comparison of SHA parameters
SHA-512
• SHA-512 Logic
• Takes as input a message with a
maximum length of less than 2128
bits
• Produces as output a 512-bit message
digest.
• The input is processed in 1024-bit
blocks.
• The padding consists of a single 1 bit followed by the necessary number of 0 bits.
• STEP 3: Initialize hash buffer- A 512-bit buffer is used to hold intermediate and results of the hash
function.
• The buffer can be represented as eight 64-bit registers (a, b, c, d, e, f, g, h).
SHA-512
• STEP 4: Process message in 1024-bit (128-word)
blocks- The heart of the algorithm is a module that
consists of 80 rounds.
• Each round takes as input the 512-bit buffer value, abcdefgh,
and updates the contents of the buffer.
• Weakness in SHA-512:
• The difficulty of coming up with two messages having the same message digest is on
the order of 2256 operations.
• While the difficulty of finding a message with a given digest is on the order of 2512
operations.
Message Authentication
Codes
Message Authentication Codes (MAC)
• A message authentication code (MAC) is an algorithm that requires the use of a secret key.
• A MAC takes a variable-length message and a secret key as input and produces an authentication code.
• A recipient in possession of the secret key can generate an authentication code to verify the integrity of
the message.
• One means of forming a MAC is to combine a cryptographic hash function in some fashion with a
secret key.
• Another approach to constructing a MAC is to use a symmetric block cipher in such a way that it
produces a fixed-length output for a variable length input.
• In the context of communications across a network,
following attacks can be identified:
• Disclosure
Message • Traffic analysis
• Masquerade
Authentication • Content modification
Requirements • Sequence modification
• Timing modification
• Source repudiation
• Destination repudiation
Message Authentication Functions
• Message encryption: The ciphertext of the entire message serves as its authenticator
• Message authentication code (MAC): A function of the message and a secret key that produces a
fixed-length value that serves as the authenticator
Message Encryption
• Message encryption by itself can provide a measure of authentication,
analysis differs for symmetric and public-key encryption schemes .
• SYMMETRIC ENCRYPTION
• receiver knows sender must have created it
• since only sender and receiver know the key used
• the content cannot have been altered if message has suitable structure, redundancy or a suitable
checksum to detect any changes
Message Encryption (cont.…)
PUBLIC-KEY ENCRYPTION
• sometimes need authentication to persist longer than the encryption (e.g. archival use)
MAC
MAC = CK(M)
condenses a variable-length message M using a
message
• attacks on MACs are grouped into two categories:
• brute-force attacks
• cryptanalysis
• Brute-force attacks exploiting
Security of •
m
strong collision resistance hash have cost 2 /2
MACs
• 128-bit hash looks vulnerable, 160-bits
better
• MACs with known message-MAC pairs
Hash
crypto hash function code is widely available
• hash includes a key along with message
Functions • original proposal:
KeyedHash = Hash(Key|Message)
as MACs
some weaknesses were found with this
• eventually led to development of HMAC
HMAC
HMAC Design Objectives
• It must verify the author and the date and time of the signature.
Thus, the digital signature function includes the authentication function also.
Attacks and Forgeries
Note: A denotes the user whose signature method is being attacked, and C denotes the attacker.
• Key-only attack: C only knows A’s public key.
• Known message attack: C is given access to a set of messages and their signatures.
• Generic chosen message attack: C chooses a list of messages before attempting to breaks A’s
signature scheme, independent of A’s public key. C then obtains from A valid signatures for the
chosen messages. The attack is generic, because it does not depend on A’s public key; the same
attack is used against everyone.
• Directed chosen message attack: Similar to the generic attack, except that the list of messages to
be signed is chosen after C knows A’s public key but before any signatures are seen.
• Adaptive chosen message attack: C is allowed to use A as an “oracle.” This means that C may
request from A signatures of messages that depend on previously obtained message-signature
pairs.
success at breaking a signature scheme
with a non-negligible probability
C can do any of the following :
• Universal forgery: C finds an efficient signing algorithm that provides an equivalent way
of constructing signatures on arbitrary messages.
• Existential forgery: C forges a signature for at least one message. C has no control over
the message. Consequently, this forgery may only be a minor nuisance to A
Simplified
Depiction of
Essential
Elements of
Digital
Signature
Process
Digital Signature Requirements
• The signature must be a bit pattern that depends on the message being signed.
• The signature must use some information only known to the sender to prevent
both forgery and denial.
• It must be relatively easy to produce the digital signature.
• It must be relatively easy to recognize and verify the digital signature.
• It must be computationally infeasible to forge a digital signature, either by
constructing a new message for an existing digital signature or by constructing a
fraudulent digital signature for a given message.
• It must be practical to retain a copy of the digital signature in storage.
Digital Signature Standard
• This Standard specifies algorithms for applications requiring a digital signature, rather
than a written signature.
• A digital signature is represented in a computer as a string of bits.
• A digital signature is computed using a set of rules and a set of parameters that allow the
identity of the signatory and the integrity of the data to be verified.
• Digital signatures may be generated on both stored and transmitted data.
• Signature generation uses a private key to generate a digital signature; signature
verification uses a public key that corresponds to, but is not the same as, the private key.
Each signatory possesses a private and public key pair.
• Public keys may be known by the public; private keys are kept secret. Anyone can verify
the signature by employing the signatory’s public key.
Digital Signature Standard
• Only the user that possesses the private key can perform signature generation. A hash function is
used in the signature generation process to obtain a condensed version of the data to be signed; the
condensed version of the data is often called a message digest.
• The message digest is input to the digital signature algorithm to generate the digital signature.
• The hash functions to be used are specified in the Secure Hash Standard (SHS), FIPS 180. FIPS
approved digital signature algorithms shall be used with an appropriate hash function that is
specified in the SHS.
• The digital signature is provided to the intended verifier along with the signed data.
• The verifying entity verifies the signature by using the claimed signatory’s public key and the
same hash function that was used to generate the signature.
• Similar procedures may be used to generate and verify signatures for both stored and transmitted
data.
DSS Applications
• A digital signature algorithm is intended for use in electronic mail, electronic funds transfer,
electronic data interchange, software distribution, data storage, and other applications that require
data integrity assurance and data origin authentication.
• This Standard shall be used in designing and implementing public key-based signature systems.
The adoption and use of this Standard is available to private and commercial organizations.
• A digital signature algorithm may be implemented in software, firmware, hardware or in
combination.
• The intent of this Standard to specify general security requirements for generating digital
signatures.
Note: conformance to this Standard does not assure that a particular implementation is secure. It is
the responsibility of an implementer to ensure that any module that implements a digital signature
capability is designed and built in a secure manner
Digital Signature Standard (DSS)
• This Standard defines methods for digital signature generation that can be used for the protection of binary data
(commonly called a message), and for the verification and validation of those digital signatures.
• Three techniques are approved.
1) The Digital Signature Algorithm (DSA) is specified in this Standard. The specification includes criteria
for the generation of domain parameters, for the generation of public and private key pairs, and for the
generation and verification of digital signatures.
2) The RSA digital signature algorithm is specified in American National Standard (ANS) X9.31 and Public
Key Cryptography Standard (PKCS) #1. FIPS 186-4 approves the use of implementations of either or both
of these standards and specifies additional requirements.
3) The Elliptic Curve Digital Signature Algorithm (ECDSA) is specified in ANS X9.62. FIPS 186-4
approves the use of ECDSA and specifies additional requirements. Recommended elliptic curves for
Federal Government use are provided herein. This Standard includes requirements for obtaining the
assurances necessary for valid digital signatures. Methods for obtaining these assurances are provided in
NIST Special Publication (SP) 800-89, Recommendation for Obtaining Assurances for Digital Signature
Applications.
Digital Signature Standard (DSS)
• Key Distribution means the function that exchange a key between two Parties in encrypted form.
• Key distribution often involves the use of master keys, which are in frequently used and are long
lasting, and session keys, which are generated and distributed for temporary use between two
parties.
• Public-key encryption schemes are secure only if the authenticity of the public key is assured.
Key Distribution
• Session key: When two end systems (hosts, terminals, etc.) wish to communicate, they establish a logical
connection (e.g., virtual circuit). For the duration of that logical connection, all user data are encrypted with a
one-time session key. At the end of the session, or connection, the session key is destroyed.
• Permanent key: A permanent key is a key used between entities for the purpose of distributing session keys.
The configuration consists of the following elements:
• Key distribution center: The key distribution center (KDC) determines which systems are allowed to communicate
with each other. When permission is granted for two systems to establish a connection, the KDC provides a one-time
session key for that connection.
• Security service module (SSM): This module, which may consist of functionality at one protocol layer, performs end-
to-end encryption and obtains session keys on behalf of users.
Key management and
distribution
• Symmetric schemes require both parties to share a common secret key.
• Symmetric key distribution using symmetric encryption
• Symmetric key distribution using Asymmetric encryption
establish
• B generates a secret key, Ks, and transmits it to A, which is encrypted with A’s public
key.
• A computes D(PRa, E(PUa, Ks)) to recover the secret key. Because only A can decrypt
key A and B can now securely communicate using conventional encryption and the session key
Ks.
Man in the middle attack
Secret Key distribution with
confidentiality and Authentication
Distribution of public keys
• Public-key authority
• Public-key certificates
Public Announcement
By using public-key algorithm, such as RSA, any par-
ticipant can send his or her public key to any other participant or broadcast the
key to the community at large network.
The major weakness in public announcement is anyone can forge such a public
announcement.
Publicly Available Directory
• A greater degree of security can be achieved by maintaining publicly available
dynamic directory of public keys.
• The authority maintains a directory with a {name, public key} entry for each participant.
• Each participant registers a public key with the directory authority. Registration would
have to be in person or by some form of secure authenticated communication.
• A participant may replace the existing key with a new one at any time, either because of
the desire to replace a public key that has already been used for a large
amount of data, or because the corresponding has been compromised in some way.
• Participants could also access the directory electronically. For this purpose, secure,
authenticated communication from the authority to the participant is mandatory.
Public-Key Authority
• Stronger security for public-key distribution can be achieved by providing tighter
control over the distribution of public keys from the directory.
• The scenario assumes that a central authority maintains a dynamic directory of public
keys of all participants.
• Each participant reliably knows a public key for the authority, with only the authority
knowing the corresponding private key. The following steps occur:
• A sends a timestamped message to the public-key authority containing a request for
the current public key of B.
• The authority responds with a message that is encrypted using the authority’s private
key, PRauth. Thus, A is able to decrypt the message using the authority’s public key.
Therefore, A is assured that the message originated with the authority. The message
includes the following:
• B’s public key, PUb, which A can use to encrypt messages destined for B
• The original request used to enable A to match this response with the
corresponding earlier request and to verify that the original request was not
altered before reception by the authority
• The original timestamp given so A can determine that this is not an old message
from the authority containing a key other than B’s current public key
Public Key Distribution Scenario
3. A stores B’s public key and also uses it to encrypt a message to B containing an identifier of A
(IDA) and a nonce (N1), which is used to identify this transaction uniquely.
4 & 5. B retrieves A’s public key from the authority in the same manner as A retrieved B’s
public key. At this point, public keys have been securely delivered to A and B, and they may
begin their protected exchange. However, two additional steps are desirable:
6. B sends a message to A encrypted with PU a and containing A’s nonce (N1) as well as a new
nonce generated by B (N2). Because only B could have decrypted message (3), the presence of
N1 in message (6) assures A that the correspondent is B.
7. A returns N2, which is encrypted using B’s public key, to assure B that its correspondent is A.
Thus, a total of seven messages are required. The initial five messages need be used
only infrequently because both A and B can save the other’s public key for future use—a
technique known as caching. Periodically, a user should request fresh copies of the public keys
of its correspondents to ensure currency.
Key Distribution Issues
hierarchies of KDC’s required for large networks, but must trust each
other
session key lifetimes should be limited for greater security
use of automatic key distribution on behalf of users, but must trust
system
use of decentralized key distribution
controlling key usage
Public key Certificates
• The public-key authority could be somewhat of a bottleneck in the system, for a user must appeal to the authority for a
public key for every other user that it wishes to contact.
• As before, the directory of names and public keys maintained by the authority is vulnerable to tampering.
• An alternative approach, first suggested by Kohnfelder, is to use certificates that can be used by participants to exchange
keys without contacting a public-key authority, in a way that is as reliable as if the keys were obtained directly from a
public-key authority.
• The certificate consists of :
• a public key
• an identifier of the key owner
• and the whole block signed by a trusted third party.
• The third party is a certificate authority, such as a government agency or a financial institution, that is trusted by the user community.
• A user can present his or her public key to the authority in a secure manner and obtain a certificate.
• The user can then publish the certificate after obtaining it.
Public key Certificates
• The requirements for this scheme are:
1. Any participant can read a certificate to determine the name and public key of the certificate’s owner.
2. Any participant can verify that the certificate originated from the certificate authority and is not counterfeit.
• where PRauth is the private key used by the authority and T is a timestamp. A may then pass this certificate on to any other participant, who
reads and verifies the certificate as follows:
D(PUauth, CA) = D(PUauth, E(PRauth, [T || IDA || PUa])) = (T || IDA || PUa)
• The recipient uses the authority’s public key, PU auth, to decrypt the certificate.
Obtaining public key certificates
from CA
Public-key certificate
• Because the certificate is readable only using the authority’s public key, this verifies that the certificate came from the certificate
authority.
• The elements IDA and PUa provide the recipient with the name and public key of the certificate’s holder.
• The timestamp T validates the currency of the certificate.
• The timestamp counters the following scenario.
• A’s private key is learned by an adversary.
• A generates a new private/public key pair and applies to the certificate authority for a new certificate.
• Meanwhile, the adversary replays the old certificate to B.
• If B then encrypts messages using the compromised old public key, the adversary can read those messages.
• In this context, the compromise of a private key is comparable to the loss of a credit card.
• The owner cancels the credit card number but is at risk until all possible communicants are aware that the old credit card is
obsolete.
• Thus, the timestamp serves as something like an expiration date.
• If a certificate is sufficiently old, it is assumed to be expired.
• One scheme has become universally accepted for formatting public-key certificates: the X.509 standard. X.509 certificates are
used in most network security applications, including IP security, transport layer security (TLS), and S/MIME.
X.509 Authentication Service
• part of CCITT X.500 directory service standards
• distributed servers maintain users information database
• defines framework for authentication services
• directory may store public-key certificates
• with public key of user signed by certification authority
• also defines authentication protocols
• uses public-key crypto & digital signatures. It does not dictate the use of a specific digital
signature algorithm nor a specific hash function
• X.509 certificates are widely used and have 3 versions
• X.509 was initially issued in 1988. The standard was subsequently revised in 1993 to address
some of the security concerns documented in [IANS90] and [MITC90]. The standard is
currently at version 7, issued in 2012.
X.509 Certificate Use
The certificate for Bob’s public key includes unique
identifying information for Bob, Bob’s public key, and
identifying information about the CA, plus other
information as explained subsequently.
This information is then signed by computing a hash value
of the information and generating a digital signature using
the hash value and the CA’s private key.
X.509 indicates that the signature is formed by encrypting
the hash value.
The current version of X.509 does not dictate a specific
digital signature algorithm.
If the NIST DSA or the ECDSA scheme is used, then the
hash value is not encrypted but serves as input to a digital
signature generation algorithm.
X.509 Certificates
Elements of the certificate
• Version: Differentiates among successive versions of the certificate format; the default is version 1.
• If the issuer unique identifier or subject unique identifier are present, the value must be version 2
• Although the X.509 specification is currently at version 7, no changes have been made to the fields that make
up the certificate since version 3.
• Serial number: An integer value unique within the issuing CA that is unambiguously associated with this
certificate.
• Signature algorithm identifier: The algorithm used to sign the certificate together with any associated
parameters. Because this information is repeated in the signature field at the end of the certificate, this
field has little utility.
Elements of the certificate
• Issuer name: X.500 name of the CA that created and signed this certificate.
• Period of validity: Consists of two dates: the first and last on which the certificate is valid.
• Subject name: The name of the user to whom this certificate refers. That is, this certificate
certifies the public key of the subject who holds the corresponding private key.
• Subject’s public-key information: The public key of the subject, plus an identifier of the
algorithm for which this key is to be used, together with any associated parameters.
• Issuer unique identifier: An optional-bit string field used to identify uniquely the issuing CA in
the event the X.500 name has been reused for different entities.
Elements of the certificate
• Subject unique identifier: An optional-bit string field used to identify uniquely the subject in the event
• Extensions: A set of one or more extension fields. Extensions were added in version 3 and are discussed
• Signature: Covers all of the other fields of the certificate. One component of this field is the digital
signature applied to the other fields of the certificate. This field includes the signature algorithm identifier
The unique identifier fields were added in version 2 to handle the possible reuse of subject and/or issuer