StrongNameGetPublicKeyEx Method
Gets the public key from a public/private key pair, and specifies a hash algorithm and a signature algorithm.
Syntax
HRESULT StrongNameGetPublicKey (
[in] LPCWSTR pwzKeyContainer,
[in] BYTE *pbKeyBlob,
[in] ULONG cbKeyBlob,
[out] BYTE **ppbPublicKeyBlob,
[out] ULONG *pcbPublicKeyBlob
[in] ULONG uHashAlgId,
[in] ULONG uReserved,
);
Parameters
pwzKeyContainer
[in] The name of the key container that contains the public/private key pair. If pbKeyBlob
is null, szKeyContainer
must specify a valid container within the cryptographic service provider (CSP). In this case, the StrongNameGetPublicKeyEx
method extracts the public key from the key pair stored in the container.
If pbKeyBlob
is not null, the key pair is assumed to be contained in the key binary large object (BLOB).
The keys must be 1024-bit Rivest-Shamir-Adleman (RSA) signing keys. No other types of keys are supported at this time.
pbKeyBlob
[in] A pointer to the public/private key pair. This pair is in the format created by the Win32 CryptExportKey
function. If pbKeyBlob
is null, the key container specified by szKeyContainer
is assumed to contain the key pair.
cbKeyBlob
[in] The size, in bytes, of pbKeyBlob
.
ppbPublicKeyBlob
[out] The returned public key BLOB. The ppbPublicKeyBlob
parameter is allocated by the common language runtime and returned to the caller. The caller must free the memory by using the ICLRStrongName::StrongNameFreeBuffer method.
pcbPublicKeyBlob
[out] The size of the returned public key BLOB.
uHashAlgId
[in] The assembly hash algorithm. See the Remarks section for a list of accepted values.
uReserved
[in] Reserved for future use; defaults to null.
Return Value
S_OK
if the method completed successfully; otherwise, an HRESULT value that indicates failure (see Common HRESULT Values for a list).
Remarks
The public key is contained in a PublicKeyBlob structure.
The following table shows the set of accepted values for the uHashAlgId
parameter.
Name | Value |
---|---|
None | 0 |
SHA-1 | 0x8004 |
SHA-256 | 0x800c |
SHA-384 | 0x800d |
SHA-512 | 0x800e |
Requirements
Platforms: See System Requirements.
Header: MetaHost.h
Library: Included as a resource in MSCorEE.dll
.NET Framework Versions: Available since 4.5