CertGetPublicKeyLength() test failures on Win7

Greg Geldorp ggeldorp at vmware.com
Tue Sep 15 13:02:48 CDT 2009


> From: Juan Lang
> > I see 3 test failures related to CertGetPublicKeyLength() on Win7,
> > crypt32/tests/cert.c lines 3146/3160/3165. All 3 failures are the
> > same, CertGetPublicKeyLength() returns 0 with last error 0x80090004
> >  (NTE_BAD_LEN). After looking at it for a while, I'm inclined to
> > change the condition to ok(ret == 56 || (ok == 0 && GetLastError()
> >  == NTE_BAD_LEN), ...). Do you agree that's the correct fix or do
> > I need to dig deeper?
>
> Hm, that's interesting.  I'm certainly curious why that is.  I'd check
> whether Win7 can decode the public key.  From our implementation of
> CertGetPublicKeyLength():
>
>         BOOL ret = CryptDecodeObjectEx(dwCertEncodingType,
>          RSA_CSP_PUBLICKEYBLOB, pPublicKey->PublicKey.pbData,
>          pPublicKey->PublicKey.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, &buf,
>          &size);
>
> I expect this is also failing on Win7?

No, it's not. Return value is TRUE, buf is allocated and contains a
PUBKEYSTRUC followed by a RSAPUBKEY with len 56 while size contains 0x1b.
So Win7 is capable of decoding the key.

Ge.



More information about the wine-devel mailing list