Re: Computing Hash

From: Param (Param_at_discussions.microsoft.com)
Date: 09/09/04


Date: Thu, 9 Sep 2004 01:43:04 -0700

pbSignature is actual signature in the der format
and fileLen is the length of the pbSignature.
from this signature only i got the certificate and publickey
as u told if the parameters are wrong what extra check i have to perform

the same signature i am able to verify with the
CryptVerifyDetachedMessageSignature

"Valery Pryamikov" wrote:

> That means that you passed parameters wrong.
> btw, what fileLen has to do with the length of pbSignature? if you have
> detached signature, in separate file, it probably encoded with ASN1 and
> filelen would not be size of signature, but size of encoded blob including
> tags, oid and envelope. You have to pass signature only (large integer
> number) in little-endian format to the CryptVerifySignature. if parameters
> are passed correctly and signature matches, then api is guaranteed to work.
>
> -Valery.
> http://www.harper.no/valery
>
> "Param" <Param@discussions.microsoft.com> wrote in message
> news:AA0BAAD9-ECDA-47D9-A743-E0485ACFF8D2@microsoft.com...
> > Hello,
> > I am getting NTE_BAD_SIGNATURE error in the CryptVerifySignature
> >
> > CryptVerifySignature(hHash,
> > pbSignature,
> > fileLen,
> > hPubKey,
> > NULL,
> > 0))
> >
> >
> > "Valery Pryamikov" wrote:
> >
> >> Just call CryptHashData while as you streaming your data and pass hash to
> >> CryptVerifySignature.
> >> You only have to make sure that you pass pbSignature in little endian
> >> format
> >> (ASN1 encodded format holds it in big-endian, so you just need to reverse
> >> bytes)
> >>
> >> -Valery.
> >> http://www.harper.no/valery
> >>
> >> "Param" <Param@discussions.microsoft.com> wrote in message
> >> news:BAFF8FE3-86F3-4CA4-A3C9-87E0DA0B9970@microsoft.com...
> >> > nothing
> >> > i am asking about signature verification
> >> >
> >> > "Valery Pryamikov" wrote:
> >> >
> >> >> What stops you from calling CryptHashData while as you streaming your
> >> >> data?
> >> >>
> >> >> -Valery.
> >> >> http://www.harper.no/valery
> >> >>
> >> >> "Param" <Param@discussions.microsoft.com> wrote in message
> >> >> news:04630EF7-172B-4D8E-A0C0-023A855DCF5D@microsoft.com...
> >> >> > That means i need to call CryptHashData in a loop until i pass the
> >> >> > last
> >> >> > chunk
> >> >> > of data.
> >> >> > need to set any flag for tha last chunk of data.
> >> >> >
> >> >> > Actually my requirement is different.
> >> >> > I need to verify a large file signature.
> >> >> > I am getting all the details from the detached signature(pkcs7).
> >> >> > signer
> >> >> > info
> >> >> > etc..
> >> >> > I am not able to check for the data intigrity part(hash checking)
> >> >> > bcs
> >> >> > of
> >> >> > the
> >> >> > huge
> >> >> > amount of the data .
> >> >> > Is there any other method for doing so(streaming)
> >> >> > thanx in adv....
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > "Valery Pryamikov" wrote:
> >> >> >
> >> >> >> Hi,
> >> >> >> you simply create hash with CryptCreateHash, call CryptHashData
> >> >> >> passing
> >> >> >> it
> >> >> >> with chunks of data while as you read it and call
> >> >> >> CryptGetHashParam(...,
> >> >> >> HP_HASHVAL, ...) to get hash value when you ready with feeding data
> >> >> >> in.
> >> >> >>
> >> >> >> -Valery.
> >> >> >> http://www.harper.no/valery
> >> >> >>
> >> >> >> "Param" <Param@discussions.microsoft.com> wrote in message
> >> >> >> news:B3EE380A-F720-41A2-866D-9F201EBBD145@microsoft.com...
> >> >> >> > Hi,
> >> >> >> > How do i create hash of a 500MB using CryptoAPI?
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>



Relevant Pages

  • HELP, jawin instruction and stack size setting?
    ... I am trying to call a dll function whose signature is ... DWORD dwKeySpec, ... DWORD dwFlags, ... BYTE* pbSignature, ...
    (comp.lang.java.help)
  • Re: Computing Hash
    ... That means that you passed parameters wrong. ... what fileLen has to do with the length of pbSignature? ... filelen would not be size of signature, but size of encoded blob including ... number) in little-endian format to the CryptVerifySignature. ...
    (microsoft.public.platformsdk.security)
  • CryptVerifySignature: Signature byte array format
    ... I use CryptVerifySignature CryptoAPI funtion to verify the signature: ... HCRYPTHASH hHash, ... I don't know the pbSignature format needed but I've tried assign to pbSignature pointer the output string from CAPICOM.SignedData.Signand doesn't works ... How can I obtain the valid signature array that accepts CryptVerifySignature from signed message generated by CAPICOM? ...
    (microsoft.public.platformsdk.security)
  • Re: Computing Hash
    ... ASN1 DER format stores numbers in big-endian. ... ASN1 DER means that it isn't actual signature, ... > CryptVerifyDetachedMessageSignature ...
    (microsoft.public.platformsdk.security)