Yes, before calling Signature::SignHash i generate my keys with that code CryptoPP::RSA::PrivateKey RSAPrivate; //private key generating CryptoPP::RSA::PublicKey RSAPublic(RSAPrivate); //public key generating
I took this code in a wiki sample and i tested it in a stand alone project and it worked. Your advice is to modify this code with that you wrote? Cheers, Michele Il giorno sabato 14 luglio 2012 02:56:48 UTC+2, Fraser ha scritto: > > Hi Michele, > > I take it that before you call Signature::SignHash, you *are* generating > your private and public keys? Something like: > > RSAprivate.GenerateRandomWithKeySize(RNG, 2048); > RSApublic = CryptoPP::RSA::PublicKey(RSAprivate); > > Cheers, > Fraser. > > On 13/07/2012 10:56, Michele wrote: > > Hi, > I'm working on a simple project on KDevelop (linux Slackware virtual > machine, on a Windows 7 host). I have to write a C++ code that : 1) creates > a folder; 2) creates a number of text files in that folder; 3) Calculates a > hash of each file with RIPEMD128; 4) Signs each hash with RSA ; 5)performs > an integrity check if requested. > I'm using Cryptopp 5.6.1 for RIPEMD128 and RSA functions. > I realized and tested points 1) 2) and 3). I realized and tested point 4) > following CryptoPP Signature Scheme Wiki: > http://www.cryptopp.com/wiki/RSA_Signature_Schemes, and it works fine. > Now i'm trying to integrate point 4) with the project and i realized the > following "signing function": > > CrypoPP::AutoSeededRandomPool RNG; > > CryptoPP::RSA::PrivateKey RSAprivate; > CryptoPP::RSA::PublicKey RSApublic ( RSAprivate); > > void Signature::SignHash(string Hash) > { > string Digest = Hash; > string Signature = ""; > > CryptoPP::RSASS<Cryptopp::PSS,CryptoPP::SHA1>::Signer > signer(RSAprivate); > cout << "cotrol point 1"; > > CryptoPP::StringSource( Digest,true , new CryptoPP::SignerFilter ( > RNG , signer, new CryptoPP::StringSink ( Signature ) ) ); > cout << "control point 2"; > } > > If i launch the program it prints control point 1 and then it crashes in > a Segmentation fault (bin/sh: line 1 3216 Segmentation fault > /root/<directory>/debug/. /src/<project>) !! > I'm a new user of C++ and Slackware and i don't know how to solve this > problem ( I think that segmentation fault derives from a memory and/or a > C++ contructor/destructor problem....... ) > > Anyone can help me to solve this fault? > -- > 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. > > > > -- 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.
