JOURNAL OF INFORMATION, KNOWLEDGE AND RESEARCH IN COMPUTER SCIENCE AND APPLICATIONS NEW VARIANT M-RSA DIGITAL SIGNATURE SCHEME WITH ONE PUBLIC KEY AND TWO PRIVATE KEYS 1K.SURESH 1,3 Dept.of KUMAR REDDY, 2E.MADHUSUDHANA REDDY, 3M.PADMAVATHAMMA Computer Science, S.V.University,Tirupati,A.P,Inda. CSE,MITS,Madanapalle,A.P,India 2 Dept.of sureshreddy117@yahoo.com,e_mreddy@yahoo.com,prof.padma@yahoo.com ABSTRACT: We design, develop and analyzed outputs of our new variant M-RSA digital signature scheme with one public key and two private keys to propose security solutions. We studied RSA digital signature scheme and we develop a new variant M-RSA digital signature scheme. Propose efficient threshold public key digital signature scheme using M-RSA digital signature scheme as the building block with one public key and two private keys. Keywords: Digital Signature Scheme, RSA, M-RSA, One Public Key, Two Private Keys. I. INTRODUCTION In this article, we present the design, develop and analyzed outputs of our threshold public key digital signature scheme viz M(Multi Prime)-RSA digital signature scheme with one public key and two private keys. We briefly discuss the possibility and validity of combining new variant with algorithm, Java code and test results to obtain a new efficient and general digital signature scheme. II. RSA Digital Signature Scheme The three persons Rivest, Shamir and Adleman also constructed a signature scheme, which we call RSA signature. Below we describe the RSA signature scheme. Key Generation: 1. The signer chooses large primes p and q at random. 2. Compute n =pq, and (n) p 1 q 1 . 3. Choose a random integer e< (n) such that gcd (e, (n) ) = 1. 4. Compute the integer d such that d mod (n) i.e e-1 ed 1 mod (n) Public Key PKA= (n, e) Private Key SKA = (p, q, d) Signature generation: Using the Private Key SKA, creates a signature ‘σ’ on the message M by computing. M d mod n Signature Verification: After obtaining the signature ‘σ’ and the message M. Check whether M e mod n If the above equation holds then “Accept: the message otherwise “Reject” it. III. New variant M-RSA Digital Signature Scheme The multi prime-RSA digital signature scheme is constructed with r distinct prime numbers P1,P2,P3,……..,Pr instead of the traditional two primes p and q. Key generation: 1. The signer choose sufficient large distinct primes p1,p2,--------, pr such that 4p1+1,4p2+1,4p3+1,…..,4pr+1 are also primes P14p1+1, P24p2+1, P34p3+1,.…………,Pr4pr+1 r N Pi P1.P2 . Pr i 1 2. Compute ( N ) ( P1 1)( P2 1)....( Pr 1) r ( N ) ( Pi 1) i 1 3. Choose a random integer E< ( N ) such that gcd (E, ( N ) ) = 1. 4. Compute an integer d which is the inverse of e such that ED 1(mod ( N )) 5. For 1≤j≤K, compute D j D (mod Pj 1) Public Key = (N, E) Private Key = (N, D1,D2,……..,DK) Signature Generation: Using the Private Key (N, D1,D2,……..,DK) creates a signature ‘σ’ on the message M by the following method. 1 M D (mod P1 ) 1 ISSN: 0975 – 6728| NOV 12TO OCT 13 | VOLUME – 02, ISSUE - 02 Page 93 JOURNAL OF INFORMATION, KNOWLEDGE AND RESEARCH IN COMPUTER SCIENCE AND APPLICATIONS 2 M D (mod P2 ) 2 . . K M D (mod PK ) K By chinese remainder theorem, the above systems of congruence have unique solution. M D (mod P1. P2 .....PK ) M D (mod N ) Signature Verification: After obtaining the signature ‘σ’ and the message M. Check whether M (mod N ) If the above equation holds then “Accept” the message otherwise “Reject” it. E IV. Algorithm for our new variant M–RSA Digital Signature Scheme with one Public key and two private keys Step 1 : Start Step 2 : [Generate multiple prime numbers such that 4p1+1, 4p2+1, 4p3+1,…,4pr+1 are also primes] p1, p2 , p3,….,pr P14p1+1, P24p2+1, P34p3+1,.…,Pr4pr+1 Step 3 : [Compute N] N P1*P2*P3*..….*Pr Step 4 : While i<= r Φ(N) Φ(N)*(Pi-1); ii++ Step 5 : [Compute E using gcd method] gcd(E, Φ(N)) 1 Step 6 : [Compute D] DE-1 (mod Φ(N)) Step 7 : for 1<=j<=K Dj D(mod Pj-1) Step 8 : [Publish public key] Public Key (K,E,N) Step 9 : [Store private key safely] Private Key (K,D1,…..,DK,N) Step 10: [read the plain text] read M Step 11: [Compute encryption cipher text C] C ME (mod N) Step 12: [Signature to cipher text σ] M D mod N Step 13: [Signature verification] M E mod N Step 14: [Compute cipher text to plain text using chinese remainder] for 1<=j<=K , M CDj (mod N) Step 14: Stop V. V. Implementation of our new variant MRSA Digital Signature Scheme Java code with one public key and two private keys for 128 bit length import java.io.*; import java.util.Vector; import java.math.BigInteger; import java.util.Random; import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.security.MessageDigest; public class MRSADSS1E2D { final BigInteger zero = new BigInteger("0") ; final BigInteger one = new BigInteger("1") ; final BigInteger two = new BigInteger("2") ; final BigInteger three = new BigInteger("3") ; int bitlength= 128; private BigInteger P1; private BigInteger P2; private BigInteger P3; private BigInteger P4; private BigInteger p1; private BigInteger p2; private BigInteger p3; private BigInteger p4; private BigInteger N; private BigInteger phi; private BigInteger e; private BigInteger d; private BigInteger d1; private BigInteger d2; private Random r; public MRSADSS1E2D() { r = new Random(10); // get two big primes P1 = BigInteger.probablePrime(bitlength, r); P2 = BigInteger.probablePrime(bitlength, r); P3 = BigInteger.probablePrime(bitlength, r); P4 = BigInteger.probablePrime(bitlength, r); p1 = P1.multiply(BigInteger.valueOf(4)).add(BigInteger.O NE); p2 = P2.multiply(BigInteger.valueOf(4)).add(BigInteger.O NE); p3 = P3.multiply(BigInteger.valueOf(4)).add(BigInteger.O NE); p4 = P4.multiply(BigInteger.valueOf(4)).add(BigInteger.O NE); N = P1.multiply(P2).multiply(P3).multiply(P4); phi= P1.subtract(BigInteger.ONE).multiply(P2.subtract(Bi gInteger.ONE)).multiply(P3.subtract(BigInteger.ON E)).multiply(P4.subtract(BigInteger.ONE)); // compute the exponent necessary for encryption (private key) e = BigInteger.probablePrime(bitlength/2, r); while (phi.gcd(e).compareTo(BigInteger.ONE) > 0 && e.compareTo(phi) < 0 ){ e.add(BigInteger.ONE); } d = e.modInverse(phi); } ISSN: 0975 – 6728| NOV 12TO OCT 13 | VOLUME – 02, ISSUE - 02 Page 94 JOURNAL OF INFORMATION, KNOWLEDGE AND RESEARCH IN COMPUTER SCIENCE AND APPLICATIONS public void privateFactors(BigInteger number) { boolean flag = false ; BigInteger limit = bigRoot(number).add(one); for (BigInteger i = three; i.compareTo(limit) <= 0; i=i.add(two)) { while (number.mod(i).compareTo(zero) == 0) { number=number.divide(i) ; d1=i; d2=number; flag = true; break; } if(flag == true) break } } public BigInteger bigRoot(BigInteger number) { BigInteger result = zero ; BigInteger oldRoot ; BigInteger newRoot ; BigInteger zero = new BigInteger("0") ; BigInteger two = new BigInteger("2") ; BigInteger num = number ; newRoot = num.shiftRight(num.bitLength()/2) ; do { oldRoot = newRoot ; newRoot = oldRoot.multiply(oldRoot).add(num).divide(oldRoot) .divide(two) ; } while(newRoot.subtract(oldRoot).abs().compareTo(t wo)>0) ; return newRoot; } public MRSADSS1E2D(BigInteger e, BigInteger d, BigInteger N) { this.e = e; this.d = d; this.N = N; } public static void main (String[] args) { BufferedReader br; long KGTime,ETime,DTime; long startTime = System.currentTimeMillis(); MRSADSS1E2D mrsa = new MRSADSS1E2D(); System.out.println("-MRSA DIGITAL SIGNATURE SCHEME WITH ONE PUBLIC KEY AND TWO PRIVATE KEYS-"); System.out.println("The bitlength "+ mrsa.bitlength); System.out.println("The value of P1 is "+mrsa.p1); System.out.println("The value of P2 is "+mrsa.p2); System.out.println("The value of P3 is "+mrsa.p3); System.out.println("The value of P4 is "+mrsa.p4); System.out.println("The value of N is "+mrsa.N); System.out.println("The value of PHI is "+mrsa.phi); System.out.println("-----KEY GENERATION PAHSE STARTS----------"); System.out.println("The Public Key E is "+ mrsa.e); System.out.println("The Private Key D is"+ mrsa.d); mrsa.privateFactors(mrsa.d); System.out.println("The Singer's Key D1 :\n"+ mrsa.d1); System.out.println(" The Co-Singer's Key D2 is :\n"+ mrsa.d2); long endTime = System.currentTimeMillis(); KGTime=endTime-startTime; System.out.println(" Key Generation Time (in miliseconds):"+ KGTime); String teststring=""; try{ br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the test string"); teststring = br.readLine(); System.out.println("Encrypting String: " + teststring); }catch(Exception ex){} System.out.println("---ENCRYPTION PAHSE STARTS----------"); // encrypt long startEncyTime = System.currentTimeMillis(); byte[] encrypted = mrsa.encrypt(teststring.getBytes()); System.out.println("Eincrypted String in Bytes: " + bytesToString(encrypted)); long endEncyTime = System.currentTimeMillis(); ETime = endEncyTime-startEncyTime; System.out.println(" Encryption Time in millSecond"+ ETime); String HashVal="";//null; String newMessage =""; String newMessageHashVal =""; String singMessage =""; String encryptedhash =""; try{ br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the string(for signtuare verification try to give correct & wrong one)"); newMessage = br.readLine(); HashVal = mrsa.MD5HashFunction(teststring); HashVal = mrsa.MD5HashFunction(teststring); newMessageHashVal=mrsa.MD5HashFunction(new Message); if(!HashVal.equals(newMessageHashVal)) { singMessage = newMessageHashVal ; System.out.println("the values are not same \n"+newMessageHashVal); } else { singMessage = HashVal; System.out.println("the values same"+HashVal); }}catch(Exception ex){System.out.println(ex);} String coSigner = mrsa.sigCreation1(singMessage); System.out.println("The Signature created using cosingner private key is ------->\n"+coSigner); encryptedhash = mrsa.sigCreation2(coSigner); is ISSN: 0975 – 6728| NOV 12TO OCT 13 | VOLUME – 02, ISSUE - 02 Page 95 JOURNAL OF INFORMATION, KNOWLEDGE AND RESEARCH IN COMPUTER SCIENCE AND APPLICATIONS System.out.println("The Signature created using singner private key is --->\n"+encryptedhash); System.out.println("--DECRYPTION PAHSE STARTS-----"); // decrypt long startDecyTime = System.currentTimeMillis(); byte[] decrypted1 = mrsa.decrypt1(encrypted); System.out.println("The Co-Signer decryptes the value using his private key:\n"+new String(decrypted1)); byte[] decrypted = mrsa.decrypt2(decrypted1); System.out.println("Decrypted String when verified by the co-singer: \n" + new String(decrypted)); long endDecyTime = System.currentTimeMillis(); DTime =endDecyTime-startDecyTime; System.out.println(" Decrypted Time in millSecond"+DTime); System.out.println("----MRSADSS1E2D SIGNATURE VERIFICATION STARTS----"); String decryptedhash = mrsa.sigVerification(encryptedhash); System.out.println("the singature have is "+decryptedhash); if(decryptedhash.equals(HashVal.replaceAll("^0*", ""))) System.out.println("The Signtuare is Verified Successfullay"); else System.out.println("The Signtuare verficication is failed, Message is modified by some one"); //end of main function } /*** Converts a byte array into its String representations * @param encrypted * @return */ private static String bytesToString(byte[] encrypted) { String test = ""; for (byte b : encrypted) { test += Byte.toString(b); } return test; } /** * encrypt byte array * @param message * @return */ public byte[] encrypt(byte[] message) { return (new BigInteger(message)).modPow(e, N).toByteArray(); } /** * decrypt byte array for single public and single private * @param message * @return */ public byte[] decrypt(byte[] message) { return (new BigInteger(message)).modPow(d, N).toByteArray(); } /** * decrypt byte array for dual private keys * @param message * @return */ public byte[] decrypt1(byte[] message) { return (new BigInteger(message)).modPow(d1, N).toByteArray(); } /** * decrypt byte array dual private keys * @param message * @return */ public byte[] decrypt2(byte[] message) { return (new BigInteger(message)).modPow(d2, N).toByteArray(); } /** * encrypt string for single public key and single private key * @param message * @return */ public String sigCreation(String message) { return (new BigInteger(message)).modPow(d, N).toString(); } /** * encrypt string dual private keys co-signer * @param message * @return */ public String sigCreation1(String message) { return (new BigInteger(message)).modPow(d1, N).toString(); } /** * encrypt string dual private keys verifier * @param message * @return */ public String sigCreation2(String message) { return (new BigInteger(message)).modPow(d2, N).toString(); } /** * decrypt string using single public key * @param message * @return */ public String sigVerification(String message) { return (new BigInteger(message)).modPow(e, N).toString(); } // We are using MD5 hash function public String MD5HashFunction(String text) throws Exception { MessageDigest md; md = MessageDigest.getInstance("MD5"); byte[] md5hash = new byte[32]; md.update(text.getBytes("iso-8859-1"), 0, text.length()); md5hash = md.digest(); String hashValue=convertToHex(md5hash); return hashValue; } public String convertToHex(byte[] data) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < data.length; i++) { int halfbyte = (data[i] >>> 4) & 0x0F; int two_halfs = 0; do { ISSN: 0975 – 6728| NOV 12TO OCT 13 | VOLUME – 02, ISSUE - 02 Page 96 JOURNAL OF INFORMATION, KNOWLEDGE AND RESEARCH IN COMPUTER SCIENCE AND APPLICATIONS if ((0 <= halfbyte) && (halfbyte <= 9)) buf.append((char) ('0' + halfbyte)); else buf.append((char) ('a' + (halfbyte - 10))); halfbyte = data[i] & 0x0F; } while(two_halfs++ < 1); } //return buf.toString(); return HextoBinary(buf.toString()); } public String HextoBinary(String userInput) { String[]hex={"0","1","2","3","4","5","6","7","8","9", "A","B","C","D","E","F"}; String[]binary={"0000","0001","0010","0011","0100 ","0101","0110","0111","1000","1001","1010","1011 ","1100","1101","1110","1111"}; String result=""; for(int i=0;i<userInput.length();i++) { char temp=userInput.charAt(i); String temp2=""+temp+""; for(int j=0;j<hex.length;j++){ if(temp2.equalsIgnoreCase(hex[j])) { result=result+binary[j]; }}} return result; } //end of class } VI. Conclusion In this article, we presented our proposed M-RSA digital signature scheme with one public key and one private key with the existing RSA digital signature scheme. We have developed code in java, analyzed the outputs. Our proposed system helps in enhancement of the block size for plaintext and enhances the range of public/private keys. The increase in the size of private key avoids the attacks on private key. This concludes that M-RSA digital signature scheme provides more security with low cost. VII. References [1]. Apostal T.M, introduction to analytic number theory, Springer International Students Edition 1980. [2]. Bellare M, Desai A, Pointcheval D and Rogaway P: Relations Among Notations of Security for Public-Key Encryption Scheme, Advances in Cryptology, Proceedings of CYPTO 98, LNCS 1462, Pages 26-45, Springer verlag, 1998. [3]. Bellary M and Rogaway P: Exact Security of Digital Signatures-How to sign with RSA and Rabin Schemes, Advances in Cryptology Proceedings of EUROCRYPT’96, LNCS 1070 [4]. Boneh D and Shacham H: Fast variants of RSA. RSA laboratories 2002. [5]. Diffie W and Hellman M: New Directions in Cryptography, IEEE Transactions on Information Theory. Vol-10, pages 74-84, IEEE, 1977. Cryptography-Proceedings of PKC 2000, LNCS 1751, pages 129-146, Springer Verlag, 2000. [6]. Proceedings of ACM CCS’s 93, pages 62-93, ACM, 1993. [7]. Rivest R: Shamir A and Adleman L: A Method for Obtaining Digital Signatures and Public Key Cryptosystems, Communications of the ACM 21 (2), pages 120-126,1978. [8]. W. Stallings. Cryptography and Network Security: Principles and Practice. Prentice Hall, second edition, 1998. ISSN: 0975 – 6728| NOV 12TO OCT 13 | VOLUME – 02, ISSUE - 02 Page 97 JOURNAL OF INFORMATION, KNOWLEDGE AND RESEARCH IN COMPUTER SCIENCE AND APPLICATIONS VIII. Test results of our new variant M-RSA Digital Signature Scheme with one public key and two private keys ISSN: 0975 – 6728| NOV 12TO OCT 13 | VOLUME – 02, ISSUE - 02 Page 98