Re: Problems with RSA encryption/decryption

2007-08-13 Thread Marek Marcola
Hello, > int encSize = RSA_public_encrypt(size, inText, sigBuffer, rsaPubKey, > RSA_PKCS1_OAEP_PADDING); > if(encSize == -1) > { > cout << "error encrytping with public key" << endl; > return -1; > } > int decryptRetVal = RSA_private_decrypt(encSize, sigBuffer, plainText, > rsaPrivKey, RSA_PKCS1_OA

Re: Problems with RSA encryption/decryption

2007-08-13 Thread Dan Spirlock
Hi Marek and David, Thank you both for your help. I applied both of your advice and It looks like I've got things working now. As David said I was not keeping track of the size of the encoded data, thus when it came time to decrypt I was providing the wrong value in the flen parameter.

RE: Problems with RSA encryption/decryption

2007-08-13 Thread Marek Marcola
Hello, > > > > RSA_public_encrypt(size, inText, sigBuffer, rsaPubKey, > > > > RSA_PKCS1_OAEP_PADDING); > > > > Ooops, you just threw away the return value from > > > RSA_public_encrypt. So how > > > are you going to know how big the signature is? > > > RSA_size() > > I thought RSA_size gave the

RE: Problems with RSA encryption/decryption

2007-08-13 Thread David Schwartz
> > > RSA_public_encrypt(size, inText, sigBuffer, rsaPubKey, > > > RSA_PKCS1_OAEP_PADDING); > > Ooops, you just threw away the return value from > > RSA_public_encrypt. So how > > are you going to know how big the signature is? > RSA_size() I thought RSA_size gave the modulus size, which is als

RE: Problems with RSA encryption/decryption

2007-08-13 Thread Marek Marcola
Hello, > > RSA_public_encrypt(size, inText, sigBuffer, rsaPubKey, > RSA_PKCS1_OAEP_PADDING); > > Ooops, you just threw away the return value from RSA_public_encrypt. So how > are you going to know how big the signature is? RSA_size() Best regards, -- Marek Marcola <[EMAIL PROTECTED]> __

RE: Problems with RSA encryption/decryption

2007-08-13 Thread David Schwartz
> RSA_public_encrypt(size, inText, sigBuffer, rsaPubKey, RSA_PKCS1_OAEP_PADDING); Ooops, you just threw away the return value from RSA_public_encrypt. So how are you going to know how big the signature is? > sigretVal = RSA_size(rsaPrivKey); > unsigned char *plainText = new unsigned char[sigretV

Re: Problems with RSA encryption/decryption

2007-08-13 Thread Marek Marcola
Hello, > > #include > #include "openssl/rsa.h" > #include "openssl/pem.h" > #include "openssl/err.h" > > > using namespace std; > int main () > { > RSA *rsaPrivKey = RSA_new(); Check error code ! > RSA *rsaPubKey = RSA_new(); Check error code ! > unsigned char inText[512]; > > > ERR_load_c

Problems with RSA encryption/decryption

2007-08-13 Thread Dan Spirlock
Hello, Extreme noob to openssl, and am running into problems using the crypto library for RSA encryption and decryption. For now I'm just putting together a simplistic test application to get a feel for using the openssl libs. The problem I'm having is when I try to decrypt an encrypte