# information security 2

squashyja

Asymmetric Encryption

Week4 Part2-IS

RevisionSummer2013

Asymmetric Encryption Asymmetric encryption is a common form of encryption used in commercial and

government applications. Asymmetric encryption requires that two keys are used. One

key is used for encrypting data and a different key for decrypting data. First consider the

following definitions for the components that comprise asymmetric encryption.

Asymmetric encryption is also known as public key encryption.

1. Plaintext – This is the original message or data. It may be readable text or data in a variety of forms such as binary or compressed data.

2. Ciphertext – This is the encrypted plaintext (i.e. scrambled message or data). 3. Encryption algorithm – the process of converting the plaintext to the ciphertext. 4. Decryption algorithm – the process of converting the ciphertext to the plaintext. 5. Public Key – one of a pair of keys that is used for either encrypting or decrypting

data. The public key is publically available.

6. Private Key – one of a pair of keys that used for either encrypting or decrypting data. The private key is kept private and never distributed to anyone other than the

rightful owner.

Message Confidentiality Message confidentiality is the concept that two parties can exchange a message and the

person sending the message can be assured that only the intended recipient can read the

message.

Asymmetric or public key encryption supports the confidential transmission of data

between two parties. In the following diagram Person A sends a message to Person B

encrypting the message using B’s Public Key, only Person B can decrypt the message

since only Person B holds their own Private Key. Therefore the confidentiality of the

message is ensured since only Person B can read the message.

Remember, anyone can obtain Person B’s public key to encrypt a message. However,

only Person B’s private key can decrypt the message. Therefore confidentiality of the

message between the sender and receiver is assured.

Example:

Person A wants to encrypt a message that only person B can decrypt. Person A uses Person Bs public key and the plaintext as inputs to the

encryption algorithm producing the ciphertext.

Person A sends the ciphertext to Person B.

Person B receives the ciphertext. Person B uses their private key and the ciphertext as inputs to the

decryption algorithm producing the plaintext.

With asymmetric encryption there are two keys. They are called the Private and Public

keys. Think of the keys in pairs. The Public key is readily available to users that want to

exchange information with the owner of the Private Key. The Key Pair is said to be

owned by the owner of the Private Key. The Private Key must remain Private for the

system to be secure. The keys are managed by key management systems which are

controlled by a user or a Trusted Third Party. There are different key management

systems which we will cover later.

The public and private keys used in asymmetric encryption are mathematically related.

However, knowing one key does not allow you to determine the other key.

Asymmetric encryption is also known as public key encryption. With public key

encryption and some other mechanisms; constructs known as Digital Signature and

Digital Envelopes are supported. To understand how these constructs are supported we

need to take a look at the differences between message confidentiality and message

authentication and how these can be implemented using public key encryption.

Encrypt Decrypt Ciphertext

B’s Public Key

KetKey

Plaintext

B’s Private Key

Plaintext

Person A Person B

Message Confidentiality

Message Authentication Message authentication is the concept that two parties can exchange a message and the

person receiving the message can be assured that the message is authentic in that the

message could only have been sent by the true sender and not someone impersonating the

sender.

Consider the following steps and diagram:

Example:

Person A wants to send a message to Person B and wants to ensure Person B that the message could only have been sent from Person A.

Person A uses their own Private key and the plaintext as inputs to the encryption algorithm producing the ciphertext.

Person A sends the ciphertext to Person B.

Person B receives the ciphertext. Person B uses Person’s A public key and the ciphertext as inputs to the

decryption algorithm producing the plaintext.

Asymmetric or public key encryption can support authentication of information between

two parties. In the above diagram Person A wants to send a message to Person B and

they want to assure Person B that the message has guaranteed to have come from Person

A. Person A uses their Private Key (only held by Person A) to encrypt the message.

Person B uses Person A’s Public Key to decrypt the message. Since only Person A’s

Encrypt Decrypt Ciphertext

A’s Private Key

KetKey

Plaintext

A’s Public

Key

Plaintext

Person A Person B

Message Authentication

public key could decrypt messages encrypted with Person A’s Private Key, Person B is

assured the message came from Person A.

Remember, anyone can obtain Person A’s public key so anyone could intercept the

message and decrypt it. Therefore the message is not confidential. However, anyone that

does decrypt the message must have Person A’s public key therefore they are assured it is

an authentic message from Person A.

Hashing Hashing of data is a technique used to transform potentially a large amount of data into a

small datum. The transformation of the data is said to be done by a hash function. Hash

functions are used in cryptographic applications to support the concept of message

integrity. Message integrity is used to ensure that when a message is exchanged the

complete message has been sent and received intact.

A cryptographic hash function produces what is known as a message digest.

Cryptographic hash functions need to be collision resistant. By collision resistant we

mean that if different sets of data are used as input to the hash function they should

produce unique hash values or message digests.

Example:

Person A wants to send data (Plaintext) to Person B and wants to ensure that Person B receives the exact data.

Person A runs a hash function on the Plaintext producing a message digest (Msg Digest A)

Person A sends the data and the message digest to Person B.

Person B receives the data (Plaintext) and the message digest produced by Person A

Person B runs the same hash function on the Plaintext producing a message digest (Msg Digest B)

Person B compares the message digest sent from Person A with the message digest they computed.

If the two message digests are equal then the data (Plaintext) sent is intact and the integrity of the data is assured.

if Msg Digest A = Msg Digest B

then

Integrity is assured

else

Integrity not assured

There are several well known algorithms for producing message digests. Two well

known algorithms are the Secure Hashing Algorithm family (SHA-0,-1,-2) and Message

Digest family (MD2, 3, 4, 5). All of the algorithms have different performance and

security characteristics. Of paramount importance to a successful cryptographic hashing

function is that no two Plaintexts can produce the same message digest. This is known as

being collision resistant.

In fact, hashing functions will produce the same message digests given different

plaintexts but the chance of that occurring for a good hash function is on the order of 2 50

.

A major attribute of evaluating the effectiveness of hashing algorithms is determining the

rate of collision. The more collision resistant a hashing algorithm is the better the

algorithm.

Discussion: Hashing functions are used in many areas of computer science. In

computer language development hashing algorithms are frequently used to build

symbol tables that contain variable and routine names. Hashing is used because

the algorithms are simple to implement and they can run very fast. If two symbols

“hash” to the same value there are simple ways the collisions can be dealt with.

Many hashing functions used for symbol table applications do not have the

collision resistant properties of those used for cryptographic applications. For

Hashing

Function

Hashing

Function Msg Digest A

Digest

Plaintext

Plaintext

Msg Digest B

Person A Person B

Message Integrity

Plaintext

Msg Digest

A

Digest

A=B?

cryptographic applications collisions are not a good thing, the algorithms must be

collision resistant otherwise they are not usable.

There are several tools on the web for creating hash values.

If you do a search of “Online Hashing Tools” you will find

several that you can input Plaintext values and have

returned Message Digests for various hash algorithms.

The combination of public key encryption and secure hashing algorithms allows parties

to exchange messages that have the attributes of:

Confidentiality

Authentication

Integrity

These attributes are also attainable (and desirable) using symmetric encryption. We chose

to describe them in this section.

Digital Signature A digital signature is the equivalent of signing a message so the recipient can verify it

came from you (authentication) and also be assured of the integrity of the message. We

saw how we can achieve Message Authentication using asymmetric encryption. We also

saw how we can achieve Message Integrity by using secure hashing algorithms. If the

two techniques are combined a Digital Signature can be implemented.

Sender A

1. Calculate a message digest for the Plaintext for Message A. (MDA) 2. Append the Plaintext of Message A (PTA) with the Message Digest. (PTA +

MDA )

3. Use the sender A Private key to encrypt the concatenation of PTA+MDA. (digitally signed message)

4. Send the message

Receiver B

1. Use sender A Public key to decrypt PTA+MDA. This authenticates the message came from sender A

2. Split PTA and MDA and calculate a message digest for PTA. Call this MDB.

3. If MDA = MDB you have verified the integrity of the message.

This implements Authentication and Integrity, but not confidentiality. For confidentiality

we need to implement a Digital Envelope.

Digital Envelope In addition to sending a message that has integrity and authentication we may also want

the message to be confidential. To implement this we need to implement another level of

encryption. This implements the Digital Envelope.

Sender A

1. Calculate a message digest for the Plaintext for Message A. (MDA) 2. Append the Plaintext of Message A (PTA) with the Message Digest. (PTA +

MDA )

3. Use the sender A Private key to encrypt the concatenation of PTA+MDA. (digitally signed message)

4. Use the receiver B public key to encrypt the digitally signed message in step 3 (digital envelope)

5. Send the message

Receiver B

1. Use the receiver B private key to decrypt the digital envelope. 2. Use sender A Public key to decrypt PTA+MDA. This authenticates the

message came from sender A

3. Split PTA and MDA and calculate a message digest for PTA. Call this MDB.

4. If MDA = MDB you have verified the integrity of the message.

Summary These are some of the main aspects to asymmetric encryption. By including secure

hashing with asymmetric encryption messages can be exchanged that include the

attributes of authentication, integrity and confidentiality. By combining these constructs

messages can be exchanged with some or all of these attributes. The techniques that are

implemented are referred to as Digital Signature and Digital Envelopes.