# Re: CALG_RSA_KEYX algorithm?

*From*: Cengiz Güngör <cengungor57@xxxxxxxxx>*Date*: Mon, 1 Jun 2009 11:27:50 -0700 (PDT)

Thank you for your reply,

I know the RSA algorithm is same everywhere, but as far as I know

there are many encryption methods; for example one treats each byte in

a string as a number, encrypts each one of them seperately and

serializes them as the ciphertext, while the other one converts the

whole plaintext into a big number and encrypts it. There are padding

differences between methods too (PKCS1, OAEP etc.).

I also have my decrypting code ready but I can't make it decrypt data

coming from CryptEncrypt. I use the PHP functions I found here:

http://www.edsko.net/misc/rsa.php . Which I think the reason it won't

work is because there are algorithm differences (by algorithm I mean

the 3rd step you mentioned). I might be wrong but I can't seem to find

another reason.

Thanks...

"lelteto" wrote:

CALG_RSA_KEYX is used to encrypt the SESSION Key. So first you will need to.

1. select a symmetric algorithm (preferably AES)

2. generate a RANDOM key for it

3. encrypt your message / data with the above algo and key

4. now encrypt your symmetric key (from 2) with the receiving partys public

key

5. send the result from both 3 AND 4.

At the receiving end you first decrypt the session key with the private key

(data is from 4). This is a NORMAL RSA decryption so you should be able to

use whatever you want on your other platform.

After that you use the recovered session key and the same symmetric algo (1)

to decrypt the data / message.

Laszlo Elteto

SafeNet, Inc.

**Follow-Ups**:**Re: CALG_RSA_KEYX algorithm?***From:*lelteto

**Re: CALG_RSA_KEYX algorithm?***From:*phal555

**References**:**CALG_RSA_KEYX algorithm?***From:*phal555

**RE: CALG_RSA_KEYX algorithm?***From:*lelteto

- Prev by Date:
**Access to the output of "CPAcquireContext" in other CSP functions?** - Next by Date:
**Re: Access to the output of "CPAcquireContext" in other CSP functions?** - Previous by thread:
**RE: CALG_RSA_KEYX algorithm?** - Next by thread:
**Re: CALG_RSA_KEYX algorithm?** - Index(es):