Partager via


StrongNameSignatureGeneration Function

Generates a strong name signature for the specified assembly.

BOOLEAN StrongNameSignatureGeneration ( 
      [in]  LPCWSTR   wszFilePath,
      [in]  LPCWSTR   wszKeyContainer,
      [in]  BYTE      *pbKeyBlob,
      [in]  ULONG     cbKeyBlob,
     [out] BYTE      **ppbSignatureBlob,
     [out] ULONG     *pcbSignatureBlob
);

Parameters

Parameter Description

wszFilePath

[in] The path to the file that contains the manifest of the assembly for which the strong name signature will be generated.

wszKeyContainer

[in] The name of the key container that contains the public/private key pair.

If pbKeyBlob is null, wszKeyContainer must specify a valid container within the cryptographic service provider (CSP). In this case, the key pair stored in the container is used to sign the file.

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 wszKeyContainer is assumed to contain the key pair.

cbKeyBlob

[in] The size, in bytes, of pbKeyBlob.

ppbSignatureBlob

[out] A pointer to the location to which the common language runtime returns the signature. If ppbSignatureBlob is null, the runtime stores the signature in the file specified by wszFilePath.

If ppbSignatureBlob is not null, the common language runtime allocates space in which to return the signature. The caller must free this space using the StrongNameFreeBuffer Function function.

pcbSignatureBlob

[out] The size, in bytes, of the returned signature.

Return Value

true on successful completion; otherwise, false.

Remarks

Specify null for wszFilePath to calculate the size of the signature without creating the signature.

The signature can be stored either directly in the file, or returned to the caller.

If the StrongNameSignatureGeneration function does not complete successfully, call the StrongNameErrorInfo Function function to retrieve the last generated error.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: StrongName.h

Library: Included as a resource in MsCorEE.dll

.NET Framework Version: 2.0, 1.1, 1.0

See Also

Reference

StrongNameSignatureGenerationEx Function

Other Resources

Strong Naming Global Static Functions