Trying to sign a message fails. No exception thrown.

33 views
Skip to first unread message

Padelis Floudas

unread,
Mar 9, 2014, 10:18:10 AM3/9/14
to cryptop...@googlegroups.com
Hi,

i am trying to sign a message using the code below.

void wxCryptopp::SignMessage( const std::string& PrivateKeyFileName,
                             const std::string& Message,
                             std::string& SignedMessage )
{
    try
    {
        SignedMessage = "";

        CryptoPP::FileSource privFile( PrivateKeyFileName.c_str(), true, new CryptoPP::HexDecoder);
        CryptoPP::RSASSA_PKCS1v15_SHA_Signer priv(privFile);

        CryptoPP::AutoSeededRandomPool rng;
        size_t length = priv.MaxSignatureLength();
        wxMessageBox(wxString::Format("Signer Length : %d", length));

        CryptoPP::StringSink* strSink = new CryptoPP::StringSink( SignedMessage );
        CryptoPP::HexEncoder* hexEnc = new CryptoPP::HexEncoder(strSink);
        CryptoPP::SignerFilter* signer = new CryptoPP::SignerFilter( rng, priv, hexEnc, true);

        CryptoPP::StringSource s1(Message, true, signer);
    }
    catch (CryptoPP::Exception e)
    {
        wxMessageBox(e.GetWhat(), "Exception");
    }
}

The app compiles ok but when i try to sign the message it fails at this line:

  • CryptoPP::StringSource s1(Message, true, signer);

There is no exception thrown.

I am using codeblocks and wxwidgets in winxp 32bit. I compiled the cryptopp static library using mingw. Mingw is the compiler that i am using.


Thank you in advance.

Padelis Floudas

unread,
Mar 9, 2014, 9:20:40 PM3/9/14
to cryptop...@googlegroups.com
Segmentation fault is thrown at line

  • CryptoPP::TF_SignerBase::SignAndRestart(CryptoPP::RandomNumberGenerator&, CryptoPP::PK_MessageAccumulator&, unsigned char*, bool) const


Thank you



--
--
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-user...@googlegroups.com.
More information about Crypto++ and this group is available at http://www.cryptopp.com.
---
You received this message because you are subscribed to a topic in the Google Groups "Crypto++ Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cryptopp-users/8YWZRj5aLuI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cryptopp-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Padelis Floudas
PVTech ECU R&D
http://www.pvtech-ecu-research.com
Reply all
Reply to author
Forward
0 new messages