Re: CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- From: visalavats@xxxxxxxxxxxxx
- Date: Fri, 6 Jun 2008 18:06:09 -0700 (PDT)
On Jun 6, 4:00 pm, Mounir IDRASSI <mooni...@xxxxxxxxxxxxxxxxx> wrote:
Hi,
I'm a little bite confused by your description. When doing digital
signature, the public key is for verification and private key for signature.
So I guess you are goind to do both encryption and signature. In this case,
using an AT_KEYEXCHANGE key is the right choice since it can do both
operations.
The usual process is to create a new container using CryptAcquireContext,
generate an AT_KEYEXCHANGE key using CryptGenKey, export the public key using
CryptExportKey with PUBLICKEYBLOB as blob type and optionally sign a
certificate request to be sent to a certificate authority. Usually, all
these steps are done automatically for you if you use PKI systems like the MS
CA integrated with Windows Server 2003/2008.
One everything is set up, you can start doing classical PKI operations like
the sample you used. I think you can find many simples on the internet on how
specific Crypto API calls for each operation context.
I hope I gave you some clues on how to advance as your question was a little
bit vague.
Cheers,
--
Mounir IDRASSI
IDRIXhttp://www.idrix.fr
to reach : mounir_idrix_fr (replace the underscores with the at and dot
characters respectively)
"visalav...@xxxxxxxxxxxxx" wrote:
Hi Mounir,
My requirement is to Create a digital signatrue. I Want to use public
key to encrypt and private key to decrypt.
I guess the param AT_EXCHANGE will be used to when we export the key,
but i am not sure how the things works.
Can you please help me in this regard.
Thanks- Hide quoted text -
- Show quoted text -
Thanks for the info Mounir,
I am working on Windows mobile.
I want to create a digital signature for a file from one end(A) and
send the file and signature to the other end(Windows mobile).
The signature should be created using public key
( I am using function CryptGenKey(hProv, AT_KEYEXCHANGE,
0,&hPublicKey);
CryptExportKey(hPublicKey,0,/
*PRIVATEKEYBLOB*/ PUBLICKEYBLOB,0,
baKeyBlob.GetData(),&dwKeyBlobLen) ;
and for signing I am using "CryptSignHash( hHash, AT_KEYEXCHANGE,
NULL, 0, pbSignature, &dwSigLen) ;"
and verifying signing i am using " CryptVerifySignature( hHash,
bSignature, dwSigLen, hPubKey, NULL, 0)"
and functions succeeds.
My question here is: how the private keys used here to verify
signature? because we used hpublic key which is a public key.
Please share your idea i am bit confused how the AT_KEYEXCHANGE
works.
Thanks
Vishal
.
- Follow-Ups:
- Re: CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- From: Mounir IDRASSI
- Re: CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- References:
- CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- From: visalavats
- Re: CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- From: visalavats
- CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- Prev by Date: Re: CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- Next by Date: RE: CardRSADecrypt succeeds but CryptDecrypt fails with NTE_BAD_DA
- Previous by thread: Re: CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- Next by thread: Re: CryptVerifySignature fail with message NTE_BAD_SIGNATURE
- Index(es):
Relevant Pages
|