RE: CPSignHash error 80090008
From: lelteto (lelteto_at_discussions.microsoft.com)
Date: 12/20/04
- Next message: olegsobol_at_gmail.com: "Base64 encode in VB6, decode in Java PROBLEM!!!"
- Previous message: iandoll: "CPSignHash error 80090008"
- In reply to: iandoll: "CPSignHash error 80090008"
- Next in thread: iandoll: "Re: CPSignHash error 80090008"
- Reply: iandoll: "Re: CPSignHash error 80090008"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 20 Dec 2004 09:43:11 -0800
At CPAcquireContext when you 'call down' the default provider do you specify
PROV_RSA_SCHANNEL? For SSL type crypto you need that (instead of
PROV_RSA_FULL). Make sure that your own provider also allows this.
Laszlo Elteto
SafeNet, Inc.
"iandoll" wrote:
> Hello all,
>
> I have certificate and I have set him my CSP ( by setting
> CERT_KEY_PROV_INFO),
> so my CSP is called when I am using that certificate in IE (2SSL
> communication).
> In CSP I have implemented all functions to be wrappers to default CSP.
> When I access web server using my certificate, next functions are
> called
> in this order :
>
> 1. CPAcquireContext
> 2. CPCreateHash
> 3. CPSetHashParam
> 4. CPSignHash
> 5. CPDestroyHash
> 6. CPReleaseContext
>
> Everything is fine till CPSignHash is called by browser.
> Function CPSignHash return error code 80090008 (Invalid algorithm
> specified)
> During the debug I have seen that CPCreateHash is called with
> CALG_SSL3_SHAMD5
> (0x00008008) as algorithm, I have forwarded all parameters to default
> CSP.
> Do I need to set any additional parameter in any of this functions to
> make it
> work correctly.
>
> Code snippet is below the message.
>
> Thanks in advance,
> Ian
>
>
>
> BOOL WINAPI
> CPAcquireContext(
> OUT HCRYPTPROV *phProv,
> IN LPCSTR szContainer,
> IN DWORD dwFlags,
> IN PVTableProvStruc pVTable)
> {
> MessageBox(NULL, "CPAcquireContext", "DEBUG", MB_OK);
>
> BOOL retVal = CryptAcquireContext(phProv, NULL, NULL, PROV_RSA_FULL,
> dwFlags);
> if (!retVal) { ERROR_MSGBOX("CPAcquireContext-ERROR");}
> return retVal;
> }
>
> BOOL WINAPI
> CPCreateHash(
> IN HCRYPTPROV hProv,
> IN ALG_ID Algid,
> IN HCRYPTKEY hKey,
> IN DWORD dwFlags,
> OUT HCRYPTHASH *phHash)
> {
> MessageBox(NULL, "CPCreateHash", "DEBUG", MB_OK);
>
> BOOL retVal = CryptCreateHash(hProv, Algid, hKey, NULL, phHash);
> if (!retVal) { ERROR_MSGBOX( "CPCreateHash-ERROR");}
> return retVal;
> }
>
> BOOL WINAPI
> CPSetHashParam(
> IN HCRYPTPROV hProv,
> IN HCRYPTHASH hHash,
> IN DWORD dwParam,
> IN CONST BYTE *pbData,
> IN DWORD dwFlags)
> {
> MessageBox(NULL, "CPSetHashParam", "DEBUG", MB_OK);
>
> BOOL retVal = CryptSetHashParam(hHash, dwParam, pbData, NULL);
> if (!retVal) {MessageBox(NULL, "CPSetHashParam-ERROR", "DEBUG",
> MB_OK);}
> return retVal;
> }
>
> BOOL WINAPI
> CPSignHash(
> IN HCRYPTPROV hProv,
> IN HCRYPTHASH hHash,
> IN DWORD dwKeySpec,
> IN LPCWSTR szDescription,
> IN DWORD dwFlags,
> OUT LPBYTE pbSignature,
> IN OUT LPDWORD pcbSigLen)
> {
> MessageBox(NULL, "CPSignHash", "DEBUG", MB_OK);
>
> BOOL retVal = CryptSignHash(hHash, dwKeySpec, NULL, dwFlags,
> pbSignature, pcbSigLen);
> if (!retVal) { ERROR_MSGBOX("CPSignHash-ERROR");}
> return retVal;
> }
>
>
- Next message: olegsobol_at_gmail.com: "Base64 encode in VB6, decode in Java PROBLEM!!!"
- Previous message: iandoll: "CPSignHash error 80090008"
- In reply to: iandoll: "CPSignHash error 80090008"
- Next in thread: iandoll: "Re: CPSignHash error 80090008"
- Reply: iandoll: "Re: CPSignHash error 80090008"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|