Hi Andy,

Thanks for your reply.

Yes, I rebuilt the Crypto++ LIB and my wrapper DLL under VS2008. When
it wasn't working as expected, I built 5.5.2 under VS2003 and re-tried
with the original code and noticed the exception.

You are right - I once tried to call the VS2003 version of my wrapper
DLL from VS2008 and really nasty things happened.

On Mar 5, 2:54 pm, Andy Finkenstadt <[EMAIL PROTECTED]> wrote:
> This may sound naive, but were your binaries of CryptoPP re-compiled
> under the VS2008 environment?  The .LIB is compiler-version and -options
> and STL-version specific, and mixing them will result in much
> unhappiness and similar issues like these below.
>
> --andy
>
>
>
> Glen Miller wrote:
> > I'm having what appears to be the same problem with StringSource. The
> > following function works with Crypto++ 5.1 in VS2003, but does not
> > work with Crypto++ 5.4 or 5.5.2. In VS2003, it throws an exception. In
> > VS2008 no errors occur, but "signature" is not populated. I'm
> > upgrading our code to VS2008, and am stuck at this point - since Crypto
> > ++ 5.1 does not work under VS2008. Is there a work-around?
>
> > int rsa_sha1_sign( const string &key, const string &plaintext, string
> > &signature)
> > {
> >   try
> >   {
> >     AutoSeededRandomPool rng;
>
> >     RSASSA_PKCS1v15_SHA_Signer privkey(StringSource(key, true, new
> > Base64Decoder()));
>
> >     SecByteBlock sbbSignature(privkey.SignatureLength());
>
> >     privkey.SignMessage(rng, (byte const*) plaintext.data(),
> > plaintext.size(), sbbSignature.begin());
>
> >     StringSource source(sbbSignature, true, new Base64Encoder(new
> > StringSink(signature),false));
> >   }
> >   catch(CryptoPP::Exception)
> >   {
> >     return 0;
> >   }
> >   return 1;
> > }
>
> > On Feb 29, 7:22 am, whatazor <[EMAIL PROTECTED]> wrote:
>
> >> Hi,
> >> I've used this code (but the difference is only that the class is
> >> instanciated internally to function brackets) and the behaviour
> >> doesn't change.
>
> >> :(
>
> >> On 25 Feb, 00:23, "Jeffrey Walton" <[EMAIL PROTECTED]> wrote:
>
> >>> Hi w,
>
> >>> I suspect it has to with your usage of the library. Try the following.
>
> >>> Jeff
>
> >>> #include <iostream>
> >>> #include <string>
>
> >>> using std::string;
> >>> using std::cout;
> >>> using std::endl;
>
> >>> #include "default.h"
> >>> #include "filters.h"
>
> >>> using CryptoPP::DefaultEncryptorWithMAC;
> >>> using CryptoPP::DefaultDecryptorWithMAC;
> >>> using CryptoPP::StringSink;
> >>> using CryptoPP::StringSource;
>
> >>> int main(int argc, char* argv[])
> >>> {
> >>>     string message = "secret message";
> >>>     string password = "password";
> >>>     string encrypted, recovered;
>
> >>>     StringSource(
> >>>         message,
> >>>         true,
> >>>         new DefaultEncryptorWithMAC(
> >>>             password.c_str(),
> >>>             new StringSink( encrypted )
> >>>         ) // DefaultEncryptorWithMAC
> >>>     ); // StringSource
>
> >>>     StringSource(
> >>>         encrypted,
> >>>         true,
> >>>         new DefaultDecryptorWithMAC(
> >>>             password.c_str(),
> >>>             new StringSink( recovered )
> >>>         ) // DefaultDecryptorWithMAC
> >>>     ); // StringSource
>
> >>>     cout << "Recovered Text:" << endl;
> >>>     cout << "  " << recovered << endl;
>
> >>>     return 0;
>
> >>> }
>
> >>> On 2/22/08, whatazor <[EMAIL PROTECTED]> wrote:
>
> >>>> Hi All,
> >>>> I use crypto 5.4 and I notice a strange problem using an automated
> >>>> test for testing a wrapping class of StringSource I have. This
> >>>> wrapping class only call StringSource, but the problems is that
> >>>> sometimes (not regularly) StringSource throw an exception even if this
> >>>> automated test use always the same string to crypt and then decrypt,
> >>>> and the same passphrase
>
> >>>> try
> >>>>  {
> >>>>    StringSink *ssink = new StringSink(out);
> >>>>    DefaultEncryptorWithMAC  * mac =    new
> >>>> DefaultEncryptorWithMAC(passPhrase, ssink);
>
> >>>>    StringSource s((const byte *)in, len, true, mac);
> >>>>  }
> >>>>  catch (...)
> >>>>  {
> >>>>    result = false;
> >>>>  }
>
> >>>> where is the problem?
>
> >>>> thx you very much
> >>>> w- Hide quoted text -
>
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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