Cryptography Overview

Encrypting a Message Using the Public Key

Anyone who wishes to send Bob an encrypted message can do so using the elliptic curve parameters and Q. To encrypt a message M, where the length (in bytes) of the message is f, another party follows these steps:

1.Compute a random value, k1, between 1 and n – 1.

2.Compute the elliptic curve point Q1 = k1P. This will be transmitted along with the encrypted message.

3.Compute the elliptic curve point S1 = k1Q. S1 is a pair (x1,y1). This is the secret information the sender uses to encode the message.

4.Compute a one time pad, otp, of length f, from x1 using a key derivation function (KDF). otp is a concatenation of a series of hashes; it is constructed using f, x1, and SHA1. otp is described below. The description uses the following notation: (1) denotes the concatenation of two numbers, (2) for a number a, [a] denotes the integer part of a. In particular, [f/160] denotes the integer part of f/160.

a.Initiate a 32-bit, big-endian bit string counter. In hex, counter is initialized to 0000000116.

b.For i = 1 to [f/160], create a series of hashes, as follows:

Compute Hashi = SHA1(x1 counter), that is, the SHA1 hash of the concatenation of x1 and counter.

Increment counter. Increment i.

c.We want the length of the pad to be exactly the same as the length, f, of the message M. If f/160 is not an integer, we need to truncate the last hash to make the lengths equal. Therefore, we define Hash’[f/160] as follows:

Hash’[f/160] = {

Hash[f/160]

if f/160 is an integer

the [f/160] – (160 ⋅ [f/160])

if f/160 is not an integer

 

leftmost bits of Hash[f/160]

 

d.Set otp to be the concatenation of the series of hashes: otp = Hash1 Hash2 Hash[f/160]-1Hash’[f/160]

5.Compute M’ = otp XOR M.

7 6

R S A B S A F E C r y p t o - C D e v e l o p e r ’s G u i d e

Page 98
Image 98
RSA Security 5.2.2 manual Encrypting a Message Using the Public Key