"Fixing" private key/generating public key from incomplete private

Werner Koch wk at gnupg.org
Wed Mar 5 11:19:38 CET 2014

On Wed,  5 Mar 2014 10:11, dbaryshkov at gmail.com said:

> I'm not sure about the 'testkey' name. I have the following use case in mind:
> I read the private exponent from the private key. I initialize the context
> and then I can fetch usable public and private keys from that context.

testkey tries to figure whether a secret key is consistent.  for example
for RSA it computes the public modulus and compares it to the provided
public modulus.  For DSA, y is computed and compared to the provided y.
Now with a provided context testkey could store that Y in the context
and tell the user by returning a dedicated error code, that Y was
missing but is now available in the context.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.

More information about the Gcrypt-devel mailing list