Decrypting a small byte string w/ CryptDecrypt

L

lamjtme

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???
 
L

lamjtme

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 threads

J
Replies
0
Views
51
jeremyshraeder
J
D
  • Article
Replies
0
Views
114
David Weston, Vice President Enterprise and OS
D
C
Replies
0
Views
143
Charlie Bell
C
Back
Top Bottom