Re: unsigned chars
| From: | Alexey Zakhlestin | Date: | Mon, 05 Apr 2010 09:31:03 +0000 |
| Subject: | Re: unsigned chars | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47785@lists.php.net to get a copy of this message | ||
Use "reply all" when writing to mailing-list.
On 05.04.2010, at 13:18, donald sullivan wrote:
> what i am trying to do is RSA encryption
>
> I have a working setup doing encryption and decryption at the same time. i want to store the
> encrypted value and be able to decrypted it later
>
> if i encrypt the data and send the data straight to the decrypt function it works fine
>
> int decryptRetVal = RSA_public_decrypt(512, Buffer, plainText, rsaPubKey, RSA_PKCS1_PADDING);
>
> if i try to send the output of the encryption to the php side for storage, or even write it to
> a file and then read that file for decryption it fails every time
>
> int decryptRetVal = RSA_public_decrypt(512, (unsigned char *)Z_STRVAL(zret), plainText,
> rsaPubKey, RSA_PKCS1_PADDING);
>
> how can i store the encrypted output for later use?
well, it should work
you don't give details, so I can't say what are you doing wrong.
I can give you only generic debugging advices:
make sure that the data you store on php-side is equivalent to the data you expect to get on
C-level.
If it is not — try to locate the step which corrupts the data, etc.