Hi, I am trying to encrypt a session key that I created using DES_KEY_SCHEDULE. I am using RSA_public_encrypt to encrypt the session key (8 bytes) with the public key using RSA_PKCS1_OEAP_PADDING. This creates a 64byte encrypted session key. I send this to the Server on the windows machine. But 'Importing the Encrypted Session Key' on that server fails. That's implemented using wincrypt.h functions such as CryptImportObjectEx.
Further info: I used the public key received from the server (created using the asymmetric_encrypt_algorithm) and I imported that using: rsaPubKey = (RSA*) d2i_RSA_PUBKEY_bio(pub,NULL); Now, I use this to encrypt the session key: unsigned char ciphertext[512]; unsigned char iv[8]; unsigned char iv1[8]; RAND_seed(rnd_seed, sizeof (rnd_seed)); RAND_pseudo_bytes(iv,8); bytecopy(iv,iv1,8); encryptlen = RSA_public_encrypt (8, (*ks)->ks.cblock, ciphertext, rsaPubKey, RSA_PKCS1_OAEP_PADDING); if(encryptlen == -1) { fprintf (stderr, "ERROR: Failed to encrypt using public key\n"); goto proc_exit; } The length after this is 64, which is preferred. So, after all this when I finally send the 'ciphertext' chars as the encrypted session key, the server fails to import it using CryptImportKey (from wincrypt.h). The ERROR RECEIVED says: "Either the algorithm that works with the public key you are trying to import is not supported by this CSP, or an attempt was made to import a session key that was encrypted with something other than one of your public keys" If anyone has come into a similar problem or anything close, pleaseeeee let me know. Any help will be tremendously appreciated. If you like to know more details or are interested in working with me on this, please let me know. Thanx in advance, J.. ===== - J | -> [EMAIL PROTECTED] __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]