Hi,
I need to sign something with ECDSA using the secret key which is stored in the PKCS#8 file. But when I load the key (DL_Keys_ECDSA<ECP>::PrivateKey) I get exception: "BERDecodeErr". So I tried to generate random key, store it to the file and load it from there to findout wheather my PKCS file is incorrect or what. But I got the same exception. Does anyone know how to load the EC keys from the file?

My example:

#include "dll.h"
#include "oids.h"

...
...
...

   AutoSeededX917RNG<DES_EDE3> m_rng;
   DL_GroupParameters_EC<ECP> params(ASN1::secp224r1());
   DL_Keys_ECDSA<ECP>::PrivateKey priv;
   priv.Initialize(m_rng, params);

   ByteQueue bq;
   priv.DEREncode(bq);

   FileSink *fs = new FileSink("ECprivateKeyDER.bin", true);
   unsigned long size = bq.MaxRetrievable();
   unsigned char * data = new unsigned char[size];
   bq.Get(data, size);
   fs->Put2(data, size, 0, true);
   fs->Flush(true);
   delete fs;
   delete []data;

   FileSource source("ECprivateKeyDER.bin", true, new HexDecoder(), true);
   DL_Keys_ECDSA<ECP>::PrivateKey privLoaded;
   privLoaded.Load(source);   // throws exception

Thanks.

  Rasti.


By the way, on the web link to public key algorithms hierarchy (http://cryptopp.com/pubkey.gif ) is broken.

_________________________________________________________________
Rozhodnite o tom, kto si s vami moze vymienat spravy a povedzte priatelom o MSN Messenger. http://messenger.msn.sk/

Reply via email to