Hi,
Because I cant find the problem in this piece of source code and I would
like to ask you for help.
Would you please try to run this code on linux. I have run this source on
AIX and it runs fine. When I run it on linux things dont work. I have Suse
linux 7.
Maybe you could help me find the problem. I have debugged it but cant
really find the problem. In my debugger things go wrong when the BN class
gets involved. It SEGV´s on the BN_init() routine.
I really hope someone will look at this because I have been searching for a
solution for quite some time now and cant find any.
In the original project (this piece is stripped down to the problem) this
class is used with a communication class. The keys are sent over the
network and used in this class. Maybe some things are looking a bit unusual
in this class but that´s probably because of the way we are sending the
keys and the encrypted text to the other party.
Usage of the code : ( I use 2048 bits keys, please test this with the same
keysize)
- Put this source in a temp dir.
- Generate or copy a private key and a public RSA key (PEM) to the temp
dir.
To generate a keypair with this class :
int main(void)
{
RSAEncrypt RSAInstance;
RSAInstance.generateRSAKeys(2048);
}
This will write two keys to disk in the current directory : pubkey.pem
and privkey.pem
- Copy one of these source file to RSATest.tar in the temp directory.
(This source will encrypt and decrypt the file, the file will stay intact
as it only reads the file. nothing will be written to disk, except a
temporary file which will be thrown away after it is no longer needed)
- Compile the main.cpp : c++ main.cpp libcrypto.a libpthread.a
When you run this code it will SEGV after the pubkey is displayed on
screen. In the source code it SEGV´s when the encrypt routine is running.
Any solutions would be greatly appreciated.
Thanks for your help.
With kind regards,
Thijs Volders
(See attached file: post.zip)
.ZIP File