RE: CrpytAPI, Decryption using the Public Key
- From: lelteto <lelteto@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 16 Oct 2007 08:28:02 -0700
1. Are you trying to decrypt on the SAME computer? If yes, you are simply
using the generated key pair's private part (which is still there).
2. You should NOT encrypt / decrypt your data with the RSA key pair. What
you need to do is
- generate a RANDOM symmetric session key with CryptGenKey (If you need to
support Win95 then you cannot use AES. Try to use DES3 - although the
customer would need the stronger crypto, as the old exportable only supported
DES)
- wrap (encrypt) this session key using the RSA public key: CryptExportKey
- now encrypt all your data with the session key
- send the encrypted data AND the exported session key blob to the recipient
The recipien then
- first decrypts the session key with the private key: CryptImportKey
- decrypts the data with the recovered session key
You can read more on how to PROPERLY use cryptography in many books (eg.
Schneier: Applied Cryptography)
Laszlo Elteto
SafeNet, Inc.
"Uri_G" wrote:
Hello, I am generating a public/private key pair with the CALG_RSA_KEYX.
algorithm in the Microsoft Base Cryptographic provider, with provider type of
PROV_RSA_FULL and length 1024.
Then I export both the public and the private key BLOBs and save each in a
file.
Then I use the public key file (I import the BLOB) to encrypt some data.
Then I can decrypt the encrypted data with the imported BLOB of the private
key file.
Everything is fine, except, I succeed in decrypting the data with the public
key too.
This is very weird and I have no clue on why this is happening.
Thank you if you solve it!
Another question, I am using 117 length blocks for the encryption, because
it is 128-11 according to the docs of PKCS #1. But how do I specify that I do
not want to use that version, and just want the simplest RSA algorithm? I
need it to be supported up to windows 95.
Thanks,
Uri.
- Follow-Ups:
- RE: CrpytAPI, Decryption using the Public Key
- From: Uri_G
- RE: CrpytAPI, Decryption using the Public Key
- Prev by Date: Re: Interacting with winlogon Desktop of Windows Vista
- Next by Date: RE: CrpytAPI, Decryption using the Public Key
- Previous by thread: Re: How to work around UAC?
- Next by thread: RE: CrpytAPI, Decryption using the Public Key
- Index(es):
Relevant Pages
|