Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Michele
Ok David, now i'm deleting RNG from class members. I'm not sure that I've understand your example but i will try... Il giorno sabato 14 luglio 2012 19:08:07 UTC+2, David Irvine ha scritto: > > It seems you may not be using the RNG correctly. It's generally preferred > to have on per thread at le

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Michele
Yes, i've done (i wrote my method in last post and called that variable DigitalSign) but it Segfault However thanks. Now I'm reading the link that David posted. Il giorno sabato 14 luglio 2012 19:58:45 UTC+2, Ingo Naumann ha scritto: > > I believe that you should declare the variable "Sign"

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Ingo Naumann
I believe that you should declare the variable "Sign" in your method "SignHash" and maybe you should not have named it "Sign" because you are using that for some other things already. I am referring to the variable inside the "StringSink" command. So, tru to rename that into "result", or whatever,

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Michele
Hi Ingo, what i want is sign the RIPEMD128 hash and the sign it. I choose RSA because it is most common and available in cryptopp, and its signature scheme use SHA1... Variable string Sign is the end of StringSink, i define it in class Sign (chek my last post) and i initialize that so: void Si

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread David Irvine
It seems you may not be using the RNG correctly. It's generally preferred to have on per thread at least (or a global if you like). i.e. in test.cpp you will see how this was done. In your case I am not sure you should have a class member RNG used as you have. This can cause all sorts of issues w

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Michele
Hi David, this is the error i read in the shell: /bin/sh: line 1: 5233 Segmentation fault/root//debug/ . /src/ . I'm new user of C++ so it could be not a segfault, but i'm not able to understand if it is or not. The class Sign is: class Sign { private: RSA::PrivateKey RSAprivate; strin

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Ingo Naumann
Dear Michele, How do you initialize the string variable "Sign"? And, BTW, one comment on item 4) in your first mail. The command you are using in your code is for signing a message. The message gets hashed and then the RSA function is applied to this hash (simplified explanation). In your case, y

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread David Irvine
Are you sure you are getting a segfault and not an exception (possibly from the RNG, I am not sure how you are using this). Could you post the frame stack or perhaps a mini (smallest possible) version of a program that exposes this issue. Best Regards David Irvine On Sat, Jul 14, 2012 at 4:37 PM,

Re: Verifying HMAC-RIPEMD160 values

2012-07-14 Thread Rianq
Thank you very much! David Irvine-2 wrote: > > You may find that reading the file test.cpp will help you quickly grab the > simpler concepts. There is a simple.h which will show you > default initialised algorithms. See test.cpp line 483 (approx, see below) > HmacFile for an implementation to s

Re: Verifying HMAC-RIPEMD160 values

2012-07-14 Thread David Irvine
You may find that reading the file test.cpp will help you quickly grab the simpler concepts. There is a simple.h which will show you default initialised algorithms. See test.cpp line 483 (approx, see below) HmacFile for an implementation to start you off. It's trivial to replace the hash algorithm

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Michele
OK, now i'm sure that i generate a pair RSAprivate/RSApublic of valid keys. My new signing function is: void Sign::SignHash( string Digest) { RSASS < PSS , SHA1 >::Signer Signer(RSAprivate); StringSource( Digest, true, new SignerFilter( RNG, Signer, new StringSink(Sign ) ) ); } It crashes agai

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Michele
Hi Fraser, you are right!! I've just tried ( sorry for my english) your "checking code" and the result is false twice. So i modified my code with that you suggested, in previous email: [...] 1. RSA::PrivateKey RSAprivate; 2. RSAprivate.GenerateRandomWithKeySize(RNG,2048); 3. RSA::PublicKey RSA

Verifying HMAC-RIPEMD160 values

2012-07-14 Thread Rianq
Hi there, I'm having a little trouble finding my way into Crypto++. I'm not very proficient in C++ and I just need an HMAC with underlying RIPEMD160 to verify the result of test vectors for a PBKDF2 built in VHDL. I have no aversion to reading, but I have no idea which parts of the crypto++ wiki a

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Fraser Hutchison
Hi Michele, Yes, you're only constructing the private key here, and then initialising the public key with an invalid private key, which makes the public key invalid also.  The keys are not being generated here. Inside Signature::SignHash, try adding the foll

Re: CryptoPP: RSA Signature Scheme causes a Segmentation Fault

2012-07-14 Thread Michele
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