Hi Jeff, Thanks a lot for replying. The sample code that I sent you uses the ReadFromDisk method so that you have a short/complete working sample code. In reality, the public key is obtained by parsing a X.509 format public key certificate using an ASN.1 parser.
Also, putting this into perspective, the exception happens only with eccrypto.h from cryptopp 5.2.1 package. With cryptopp 5.5.2, there are no issues with loading this public key (with the sample code as well as with the actual sw). My latest sw uses cryptopp 5.5.2 package, but apparently my client who first reported this problem has sw that uses cryptopp 5.2.1. Asking him to upgrade to the latest sw is not an issue, but before that I want to make sure that I am not doing something fundamentally wrong. Also, I forgot to mention earlier, I use MSVC6 SP5. Thanks again. Srinath On Mon, Mar 2, 2009 at 3:26 AM, Jeffrey Walton <[email protected]> wrote: > > Hi Srinath, > > Have you verified the key using dumpasn1 or other tool? > > What happens when you use a FileSource rather than a fopen\buffer > \StringSource combination? > > Jeff > > From *.cpp: > BYTE *ReadFromDisk(TCHAR *FileName, DWORD *dwBufferLen) > { > unsigned char *buff = NULL; > *dwBufferLen = 0; > > // Read the file and store data in pbBuffer > FILE *f = fopen(FileName, "rb"); > .... > } > > > On Feb 27, 3:29 pm, Srinath Sitaraman <[email protected]> > wrote: > > Hi, > > I have an application that's using cryptopp521 package. I am attaching > > herwith a portion of sample code that's the subject of concern. > > > > I create an ECDSA<ECP, SHA>::PublicKey object, ECKpub and I use it to > load > > the public key (please see attached binary file) which is 302 bytes long > as > > follows: > > > > ECKpub.Load(StringSource(pkPub, Len, true, NULL)); //Here Len = 302 and > > pkPub is a pointer to the public key > > > > The Load call throws an unhandled exception. However, when I use the > > cryptopp552 package, I do not get an exception. Do you have any thoughts > on > > why this is happening?! Using the crypto552 package is not an issue for > me, > > but I am trying to understand what the problem could be, and fix if it I > am > > doing something wrong in my code. > > > > Thanks in advance. > > > > Srinath > > > > Test.cpp > > 1KViewDownload > > > > PubKey.bin > > < 1KViewDownload > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
