DevOTechS Forums
June 29, 2022, 03:14:55 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: DevOTechS forums
   Home   Help Search Calendar Login Register  
Pages: 1 [2]
 on: May 07, 2008, 07:52:03 AM 
Started by gwynw - Last post by gwynw

Thank you for your support.

My P, Q and e values are from a know good RSA key, hence I should be able to calculate all the other components from these.
The reason I am doing this is that I want to write a tool to test that RSA keys have been correctly migrated from a pre existing system to a new system - hence I have to use the existing keys.

I will do a bit more experimentation before getting back to you with an example of my truncation problem.

Best regards,


 on: May 06, 2008, 08:56:26 PM 
Started by gwynw - Last post by Admin
Hi Gwyn,

I looked a little deeper into your code snippet. Two suggestions:
1 - Use HIME function hi_GenerateRSAKeys to generate public key, private key and modulus, because you are cutting corners generating the key in your code example. The relation between public key exponent 'e' and '(p-1)(q-1)' must be so that GCD of e and (p-1)(q-1) = 1 , where GCD is the Greatest Common Divisor.
Also: 1 < e < (p-1)(q-1) .
If these conditions are not fulfilled, you must choose new p and q (and/or e) until the conditions are fulfilled. P and q are both prime numbers, as you know.

Maybe you are doing this, but it is not shown in your code.

2 - As stated before, make sure that plaintext is smaller than the modulus.

Hope this helps.

Kind regards

 on: May 06, 2008, 05:08:28 PM 
Started by gwynw - Last post by Admin
PS. Also remember that with RSA, your plaintext length must always be smaller than the modulus length.


 on: May 06, 2008, 05:06:25 PM 
Started by gwynw - Last post by Admin
Hi Gwyn,

You seem to be trying to create the RSA keys yourself ?
Unless you have a good reason not to, I highly recommend to use the HIME hi_GenerateRSAKeys or hi_GenerateRSAKeys_CRT  functions to generate the RSA public and private keys.

The HIME manual (included with the zip package you downloaded) has a page called "RSA encryption/decryption" that shows a complete example (though not in C#) of how to encrypt and decrypt data with RSA, both the 'classic' way as with using CRT (Chinese Remainder Theorem).

Kind regards

 on: May 06, 2008, 04:37:51 PM 
Started by gwynw - Last post by gwynw
 Huh  Hello,

I am using C# and finding problems. Below are some calculations I have been doing with RSA.

These work for small values (a few bytes) and I am able to encrypt and decrypt succesfully.

However, when I try to scale up to, say, 96 bytes RSA keyset, then I get truncation problems. The first few bytes of my caclucated values are OK, but then the rest is wrong.

Any ideas?

HIME.hi_PutReg(pString, 10);      //p = 10
HIME.hi_PutReg(qString, 11);      //q = 11
HIME.hi_Mul(10, 11, 12);            //Modulus = 12
                                             //e = 2
HIME.hi_Decr(10,15);                //p-1 = 15
HIME.hi_Decr(11,16);                //q-1 = 16
HIME.hi_Mul(15,16,17);              //(p-1)(q-1)
HIME.hi_Modinv(2, 17, 18);
HIME.hi_Encrypt_Rsa(1, 2, 12, 4);

Any help would be most welcome. Is there a manual showing examples?

Thank you


 on: March 18, 2008, 11:15:38 PM 
Started by Admin - Last post by Admin
Hi everyone,

As you probably have noticed, there are 2 forum categories (apart from the 'General' one):
- HIME: The Huge Integer Math and Encryption library is covered there. All of those forums are open for posting.
- NUMS: This is for discussions about a new DevOTechS product in development: NUMS, an Arbitrary Precision Floating Point Math Library.

Kind regards

Pages: 1 [2]
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!