Decrypting a small byte string w/ CryptDecrypt

Decrypting a small byte string w/ CryptDecrypt

Secure Home | Search | About
 Microsoft Applications Security    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content add this group's latest topics to your Google content
Subject Author Date
Decrypting a small byte string w/ CryptDecrypt lamjtme 12-22-2007
Posted by =?Utf-8?B?bGFtanRtZQ==?= on December 22, 2007, 1:10 pm
If you were  Registered and logged in, you could reply and use other advanced thread options
I want to encrypt ciphertext with a public key and decrypt it with a private
key. The performance impact is acceptable since I'm dealing with a very
small payload.

I have a curious problem using CryptDecrypt (w/ a public key) against a byte
blob previously encoded with CryptEncrypt (w/ a private key). The key pair
I'm using comes from a call to CryptAcquireCertificatePrivateKey against a
certificate store. I can hex dump the private/public keys so I know they're
present in the key handle. I keep getting a NTE_BAD_KEY error. I notice the
ALG_ID on the key pair is AT_SIGNATURE. I tried force the type to CALG_KEYX
to get it to be AT_KEYEXCHANGE but I get "invalid type error".

Am I hitting an international limitation in the software or do you think i
have a defect in my code???

Posted by =?Utf-8?B?bGFtanRtZQ==?= on December 22, 2007, 1:48 pm
If you were  Registered and logged in, you could reply and use other advanced thread options
I've reposted issue to platformsdk.security. Disregard post, that is unless
you absolutely, positively, know the answer! Thanks, sorry for the noise.


"lamjtme" wrote:

> I want to encrypt ciphertext with a public key and decrypt it with a private
> key. The performance impact is acceptable since I'm dealing with a very
> small payload.
>
> I have a curious problem using CryptDecrypt (w/ a public key) against a byte
> blob previously encoded with CryptEncrypt (w/ a private key). The key pair
> I'm using comes from a call to CryptAcquireCertificatePrivateKey against a
> certificate store. I can hex dump the private/public keys so I know they're
> present in the key handle. I keep getting a NTE_BAD_KEY error. I notice the
> ALG_ID on the key pair is AT_SIGNATURE. I tried force the type to CALG_KEYX
> to get it to be AT_KEYEXCHANGE but I get "invalid type error".
>
> Am I hitting an international limitation in the software or do you think i
> have a defect in my code???

Similar ThreadsPosted
CryptDecrypt fails with NTE_BAD_DATA June 3, 2006, 12:34 pm
An NTE_BAD_DATA error returned by CryptDecrypt() August 16, 2007, 8:55 pm
java/byte verify December 19, 2006, 11:57 pm
decrypting email in pst file with efs data recovery certificate??? October 21, 2007, 9:11 pm
Recommendations for use of Policy CA in small PKI solutions December 18, 2007, 7:06 am
Small error in "Best Practices for Implementing a MS W2003 PKI" June 30, 2005, 9:31 am
Basic network layout for Small Business 2003 server October 25, 2005, 7:13 am
Best Way to Share a Secret String Between Member Servers? February 7, 2007, 12:20 am

The site map in XML format XML site map

Contact Us | Privacy Policy