Problem with CryptRegisterOIDInfo in Microsoft "Longhorn" Server Beta2

Discussion in 'Windows Vista Security' started by Roman Sedov, Jun 9, 2006.

  1. Roman Sedov

    Roman Sedov Guest

    When I call CryptRegisterOIDInfo with pInfo parameter pointing on
    "old-style" CRYPT_OID_INFO structure (cbSize = 28) without pwszCNGAlgid and
    pwszCNGExtraAlgid members, I get error about invalid parameter.
    If use CRYPT_OID_INFO with new members (csSize = 36) it's OK.

    Usually, there are back-compatibility in CryptoAPI for such changes...

    The repro-example is:

    typedef struct _CRYPT_OID_INFO_LH
    {
    DWORD cbSize;
    LPCSTR pszOID;
    LPCWSTR pwszName;
    DWORD dwGroupId;
    union {
    DWORD dwValue;
    ALG_ID Algid;
    DWORD dwLength;
    };
    CRYPT_DATA_BLOB ExtraInfo;
    LPCWSTR pwszCNGAlgid;
    LPCWSTR pwszCNGExtraAlgid;
    } CRYPT_OID_INFO_LH, *PCRYPT_OID_INFO_LH;

    CRYPT_OID_INFO OIDInfo =
    {
    sizeof(CRYPT_OID_INFO),
    "1.2.3",
    L"Test",
    CRYPT_ENHKEY_USAGE_OID_GROUP_ID
    };
    CRYPT_OID_INFO_LH OIDInfoLH =
    {
    sizeof(CRYPT_OID_INFO_LH),
    "1.2.3",
    L"Test",
    CRYPT_ENHKEY_USAGE_OID_GROUP_ID
    };
    OIDInfoLH.pwszCNGAlgid = L"";
    OIDInfoLH.pwszCNGExtraAlgid = L"";

    DWORD dwError;
    BOOL res;
    res = CryptRegisterOIDInfo(&OIDInfo, 0); // res: FALSE
    dwError = GetLastError(); //dwError :0x80070057
    res = CryptRegisterOIDInfo((PCCRYPT_OID_INFO)&OIDInfoLH, 0); //res: TRUE
     
    Roman Sedov, Jun 9, 2006
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.