> It appears the first byte is not the asnTag.  I know this is simple,
> but what am I doing wrong?
You're writing random data, and then trying to read it as an ASN.1
encoded object. Take a look at the wiki's DH example, or Crypto++'s
examples in validate1.cpp, validate2.cpp, etc.

Jeff

On 5/27/09, SpaceCowboy850 <[email protected]> wrote:
>
> I'm using the Deffie-Hellman algorithm in Crypto 5.60 under Visual
> Studio 2005.  I'm trying to create my own seed file instead of using
> the ones provided in the example.
>
> This is the way I create my file:
>
>  const size_t seedBufSize = 1024;
>  unsigned char seedBuf[seedBufSize];
>  g_autoRNG.GenerateBlock( reinterpret_cast<byte*>(seedBuf),
> seedBufSize );
>  CryptoPP::FileSink fileSink( "seed.dat" );
>  fileSink.GetStream()->write( (const char*)seedBuf, seedBufSize );
>  fileSink.IsolatedFlush( true, true );
>
> I then try to load it like this:
>
>  CryptoPP::FileSource fileSource( "seed.dat", true );
>  g_pKeyAgreementAlg = new CryptoPP::DH(fileSource);
>
> I keep getting a BERDecodeError.  I've tried using a HexDecoder like
> this:
>
>  CryptoPP::FileSource fileSource( "seed.dat", true, new
> CryptoPP::HexDecoder() );
>
> It appears the first byte is not the asnTag.  I know this is simple,
> but what am I doing wrong?
>

--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---

Reply via email to