Keys are rarely written in a format outside of the ASN.1 encoding.
Now using that encoding there can be multiple types and encodings after the
fact.

        Here is what I would recommend looking at.

        1)Is it in binary.  If not think about getting it into binary,
unless there is some indicators/clues in the text.  If there are you will
need to figure it out from them.
        2)Look at the binary stream and see if it lines up with ASN.1
encoded Integers.  If not look for OpenPGP Integer encoding.
        3)Once you have isolated the Integers you can use the size to make
some educated guess as to which one is which.  Obviously q and x (you won't
have x in the public key) are 160 bits with x being smaller.  P and y are
going to be 512 bits or 1024 bits.  G tends to be a given among a group, so
it may or may not be included with the key.
        4)Once you have a good set of guess see which ones make sense (does
the signature now verify?).


        Good luck,
                Shawn


> -----Original Message-----
> From: Gorelik, Slava [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 13, 2003 2:43 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: DSA Question.
> 
> Hi.
> The problem is: I don't know in which format public key was written to
> file.
> ??????????????????
> 
> -----Original Message-----
> From: Andrew Finkenstadt [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 13, 2003 1:04 AM
> To: [EMAIL PROTECTED]
> Subject: RE: DSA Question.
> 
> I'm still getting my own head around how Crypto++ works, lacking a solid
> foundation in template programming techniques in C++... but the example
> code
> in test.cpp is helping a lot.
> 
> The HexDecoder and Base64Decoders are used to translate a binary format
> not
> well suited for text transfer, into one that IS suited.  THey are symetric
> with their corresponding *Encoders.  If you choose to use an encoder to
> place the keys into a file, you will need to use the corresponding decoder
> to read it in from the file.
> 
> I think.  If I am wrong, I'm sure someone will tell me quickly. :)
> 
> Andy
> 
> 
> -----Original Message-----
> From: Gorelik, Slava [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 12, 2003 1:20 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: DSA Question.
> 
> 
> To Wei Dai
> But, in the RSA example , you use HexDecoder, but how could I know which
> decoder to use ?
> 
> -----Original Message-----
> From: Wei Dai [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 11, 2003 10:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: DSA Question.
> 
> Have you looked at the RSA sample code in test.cpp? DSA usage is very
> similar.
> 
> On Tue, Nov 11, 2003 at 11:56:26AM +0100, Gorelik, Slava wrote:
> > Hi to All.
> >
> > I have a one stupid question.
> >
> >
> >
> > I want to use the DSA class I have a public key in the file.
> >
> > How can I load the key to the PublicKey in the DSA ????
> >
> >
> >
> > Thank You.
> >
> >
> >


Reply via email to