Hi, help plz with my problem.
There is a code:
Code:
while (1) {
inlen = _read(in, ctext, key_size);
printf("Read %i bytes\n", inlen);
if (inlen <= 0) break;
outlen = RSA_private_decrypt(512, ctext, ptext, privKey, RSA_PKCS1_PADDING);
printf("RSA returns %i\n", outlen);
if (outlen < 0)
{
fprintf(stderr, "OpenSSL error: %s\n", ERR_error_string(ERR_get_error(), NULL));
exit(0);
}
_write(out, ptext, outlen);
This is program output:
Code:
Read 82 bytes
RSA returns 494
Read 0 bytes
File size is 2055 bytes. _read function at second cycle always returns null. Whats the problem with the code? Thanks.