--On Samstag, Juni 09, 2007 05:03:54 -0400 Richard <[EMAIL PROTECTED]> wrote:
Hello! My goal is to write a simple function for use in C programs of mine that can encrypt and output strings. This would seem to be an easy task at first, only through attempting it have I realized some difficulties.
beware: all encryption/decryption functions operate and generate binary data.
So if you assume the output is a valid C string you will fail...
My idea was to use the openssl RSA library, build an RSA structure, and use RSA_public_encrypt() to do this. I am currently unable to do this even with just hardcoded RSA variables.
Do you really want to use RSA for directly encrypting data ? I hope you are aware of the pitfalls doing this.
The reason is that I cannot initiate a BN with a large value, as it can only start as a word. I cannot find a way to expand the BN, except by using BN_set_bits(), which seems to me an impractical way to do this. How is this generally done?
There are the following functions available to set a BIGNUM: BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret); int BN_hex2bn(BIGNUM **a, const char *str); int BN_dec2bn(BIGNUM **a, const char *str); int BN_asc2bn(BIGNUM **a, const char *str); At least in recent releases there should be a man page available... Goetz -- DMCA: The greed of the few outweights the freedom of the many
pgp9IjjBrqE02.pgp
Description: PGP signature