Private Key Cryptography Nitin

Embed Size (px)

Citation preview

  • 8/2/2019 Private Key Cryptography Nitin

    1/23

    Private Key Cryptography

    Traditional private/secret/single keycryptography uses one key.

    Key is shared by both sender and receiver.

    The risk in this system is that if either partyloses the key or it is stolen, the system isbroken.

  • 8/2/2019 Private Key Cryptography Nitin

    2/23

    CryptographyPublic Key Algorithm

    Cryptographybased on the Knapsack Problem

  • 8/2/2019 Private Key Cryptography Nitin

    3/23

    Was broken by Shamir in 1984.

    Shamir showed how to use integerprogramming to solve the particular classof Subset Sum problems in polynomialtime.

  • 8/2/2019 Private Key Cryptography Nitin

    4/23

  • 8/2/2019 Private Key Cryptography Nitin

    5/23

    Private Key Cryptography

    Uses two keys a public key and aprivate key

    Asymmetric since parties are not equal

    Public-key/two-key/asymmetric cryptographyinvolves the use of two keys: a public-key, which may be known by anybody, and

    can be used to encrypt messages, and verifysignatures

    a private-key, known only to the recipient, used to

  • 8/2/2019 Private Key Cryptography Nitin

    6/23

  • 8/2/2019 Private Key Cryptography Nitin

    7/23

    Public Key Cryptography

    Public key cryptosystem was introduced in1976 by Diffie and Hellman.In PKCdifferent keys are used for encryption and

    decryption.

  • 8/2/2019 Private Key Cryptography Nitin

    8/23

  • 8/2/2019 Private Key Cryptography Nitin

    9/23

    MerkleHellman knapsackcryptosystem

    The Merkle

    Hellman knapsackcryptosystem was one of the earliest publickey cryptosystems invented by RalphMerkle and Martin Hellman in 1978.

    The Merkle-Hellman system is based on the subsetsum problem (a special case of the knapsackproblem).

    The problem is as follows: given a set ofnumbers A and a number b, find a subset of A,which sums to b.

    In general, this problem is known to be NP-

  • 8/2/2019 Private Key Cryptography Nitin

    10/23

    Easy knapsack problem

    An easy knapsack problem is one in whichset A={a1,a2,.. an} is a super increasingsequence.

    A super increasing sequence is one inwhich the sum next to term of sequence isgreater than the sum of all preceding terms:

    Example: A={1,2,4,8, 2n-1} is super

    increasing sequence.

  • 8/2/2019 Private Key Cryptography Nitin

    11/23

    Polynomial time algorithm for easyKnapsack problem

  • 8/2/2019 Private Key Cryptography Nitin

    12/23

    Merkle-Hellman Additive Knapsackcryptosystem

  • 8/2/2019 Private Key Cryptography Nitin

    13/23

  • 8/2/2019 Private Key Cryptography Nitin

    14/23

    Choose S={s1,s2,..,sm} as asuperincreasing sequence, S is a simpleknapsack.

    Choose a multiplier w and a modulus n.

    The multiplier should have no commonfactors with the modulus.

    Then replace every integer si in the simple

    knapsack with the termhi = w*si mod n

    Then, H=[h1,h2,.hm] is a hard knapsack

  • 8/2/2019 Private Key Cryptography Nitin

    15/23

    Merkle hellman knapsackencryption algorithm

    The merkle hellman algo begins with a binarymessage i.e binary sequence P=[p1,p2,.pk]

    Divide the message into blocks of m bits

    The encipherment of message P is asequence of targets,where eaach target is the

    sum of some of the terms of the hardknapsack H.

    Each term of the ciphertext is Pi * H, the target

    derived using block Pi as the selection vector.

  • 8/2/2019 Private Key Cryptography Nitin

    16/23

    Knapsack Decryption algorithm

    Compute W as multiplicative inverse of wmod n such that Ww=1( mod n)

    The connection b/w easy and hardknapsack is H= w* S mod n

    The ciphertext message produced by theencryption algorithm is C=H*P= w*S*P modn

  • 8/2/2019 Private Key Cryptography Nitin

    17/23

    Knapsack Decryption algorithm

    To decipher,multiply C by by W,since

    W*C=W*H*P=W*w*S*P=S*P mod n

    The plain text Pi could be found by using

    polynomial time algorithm for easyknapsack.

  • 8/2/2019 Private Key Cryptography Nitin

    18/23

    Example

    Alice private key:

    S={1,2,4,9},w=15 and n=17

    now hi =w*si mod n1*15=15 mod 17=15

    2*15=30mod 17=13

    4*15=60mod 17=99*15=135mod 17=16

    The hard knapsack H={15,13,9,16}

  • 8/2/2019 Private Key Cryptography Nitin

    19/23

    Encryption of message

    We use knapsack S and Hw=15,n=17 and m=4 The message

    P=0100101110100101Is encoded with the knapsack H

    P=0100 1011 1010 0101[0,1,0,0]*[15,13,9,16]=13

    [1,0,1,1]*[15,13,9,16]=40[1,0,1,0]*[15,13,9,16]=24[0,1,0,1]*[15,13,9,16]=29The message is ecrypted as the integers 13,40,24,29,

    using H

  • 8/2/2019 Private Key Cryptography Nitin

    20/23

    Now multiplicative inverse W = 8

    ( 15 mod 17 is 8,since 15*8 mod 17=120 mod17=(17*17)+1 mod 17 =1)

    To decipher, we multiply these messages by

    8 mod 17 bcoz 8 is 15 mod 17.13*8=104 mod 17 = 2 = [0 1 0 0]

    40*8=320 mod 17 = 2 = [1 0 1 1]

    24*8=192 mod 17 = 5 = [1 0 1 0]

    29*8=232 mod 17 = 11 =[0 1 0 1]

    The recovered msg is 0100101110100101

  • 8/2/2019 Private Key Cryptography Nitin

    21/23

    Knapsack problem

  • 8/2/2019 Private Key Cryptography Nitin

    22/23

  • 8/2/2019 Private Key Cryptography Nitin

    23/23