To facilitate the implementation of shared names across tools, and the runtime, we define simple wrapper APIs to expose the needed cryptographic functionality. For the V1 release, these APIs are unmanaged wrappers for Microsoft CryptoAPI functionality (see the Microsoft Platform SDK). In particular, we abstract out much of the complexity associated with using Cryptographic Service Providers (CSPs), key management, and digital signature/verification operations. This also represents a set of APIs that may be ported to other platforms, not supporting CryptoAPI, for future shared name support.
Shared name generation requires support for public/private key pair generation, hashing, digital signature, and signature verification on development platforms. Runtime platforms will require hashing and signature verification only. The APIs are factored to allow tailoring of support for development and runtime systems.
Applications using these wrappers should be aware that APIs supporting key generation and digital signature generation should not be further wrapped to expose them as COM, or other scriptable, interfaces. This would open the possibility for Web scripts to create valid digital signatures on behalf of the user without their consent. Unmanaged, hostile, code can also do this, but it can do so by calling CryptoAPI directly. These wrapper APIs do not increase this potential vulnerability.
To simplify use of the shared name functionality, we wish to abstract out the complexity associated with using CryptoAPI directly. To do this, we make the following simplifying assumptions:
There will be no provision in the APIs for overriding these settings. We will however, store this information in a known location (Registry on Win32 systems at HKLM\Software\Microsoft\StrongName). It will be possible to change the default settings, but we will not provide UI to support this operation.
The CryptoAPI wrapper functions will be provided as unmanaged C-code interfaces only. Functions will return TRUE if successful, or FALSE if an error occurred. Extended error information is available by calling the function StrongNameErrorInfo() after an error, which returns a DWORD. If CryptoAPI functionality is not available, then we will return the error
(0x80131413) SN_CRYPTOAPI_CALL_FAILED.
If the specified Cryptographic Service Provider (CSP) can’t be located then we return the error
(0x80131414) SN_CSP_NOT_FOUND.
For all other failures, this value will contain the DWORD returned by CryptoAPI using GetLastError(). Future versions may extend or alter the error codes returned.