When I said unnecessary members of a Private Key structure, I meant everything except modulus and private exponent so basically you can't derive the public key from the private key. But in order to maintain compatibility with previously encoded private keys, I decided not to modify the InvertibleRSAFunction class and instead use the RSAFunction structure to store both the private and the public key, and therefore declare only PK_Encryptor 's.
 
For generating the public exponent I added 

if (m_e == 17)

m_e.Randomize (rng,Integer(3), Integer::Power2 (modulusSize), Integer::RandomNumberType::PRIME);

in the InvertibleRSAFunction::GenerateRandom method, after

m_e = alg.GetValueWithDefault("PublicExponent", Integer(17));

I wanted to be as confident as possible that GCD (m_e, LCM (m_p-1, m_q-1)) would be 1. But still I am not sure. And another problem I see is the possibility that the random generated m_e is greater than LCM (m_p-1, m_q-1).
What can I do here?
 
Thanks,
Adrian.

> On Thu, Mar 25, 2004 at 08:08:52PM +0200, Adrian Doroiman wrote:
> > I am thinking of doing this the following way: one key will be for
> > writing (the public key) and one key will be for reading (the private
> > key). The user having both keys will have read-write access.
>
> From a private key, you can always derive the public key, even if the
> private key doesn't include the public key, so I don't think this is
> secure. I've skipped the rest of your message because of that.
>

Reply via email to