[RESOLVED] (Cryptography) CPImportKey function
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] (Cryptography) CPImportKey function

  1. #1
    Join Date
    Mar 2009
    Posts
    51

    [RESOLVED] (Cryptography) CPImportKey function

    For the actual question, please see below the [ code ] section, but first some background:

    The CPImportKey function is listed in Visual Studio 2005's MSDN as being part of the "Platform SDK: Cryptography" and as available on pretty much all versions of Windows.

    The function is also documented here as being available on Windows 2000 onwards:
    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

    Both sources however state that the required header file needs to be downloaded as part of the Cryptographic Service Provider Developer's Kit.

    While that SDK does indeed contain the header (Cspdk.h) it does not contain any .lib file.

    Most bizarly, this SDK contains a DLL which merely has skeleton version of CPImportKey:
    Code:
    BOOL WINAPI
    CPImportKey(
        IN  HCRYPTPROV hProv,
        IN  CONST BYTE *pbData,
        IN  DWORD cbDataLen,
        IN  HCRYPTKEY hPubKey,
        IN  DWORD dwFlags,
        OUT HCRYPTKEY *phKey)
    {
        *phKey = (HCRYPTKEY)NULL;    // Replace NULL with your own structure.
        return TRUE;
    }
    So ... is the CPImportKey function actually implemented by Microsoft somewhere? If so, which DLL ?

    If not, how can I import a Key BLOB which was exported using .net's RSACryptoServiceProvider.ExportCspBlob ?

    Thanks.
    Last edited by Zaccheus@Work; November 11th, 2009 at 10:00 AM.
    The CodeGuru member formerly known as Zaccheus.

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: (Cryptography) CPImportKey function

    Use CryptImportKey.

  3. #3
    Join Date
    Mar 2009
    Posts
    51

    Thumbs up Re: (Cryptography) CPImportKey function

    D'oh, of course!

    Thank you!
    The CodeGuru member formerly known as Zaccheus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center