Upravit

Sdílet prostřednictvím


SignedCode object

[The SignedCode object is available for use in the operating systems specified in the Requirements section. Instead, use Platform Invocation Services (PInvoke) to call the Win32 API SignerSignEx, SignerTimeStampEx, and WinVerifyTrust functions to sign content with an Authenticode digital signature. For information about PInvoke, see Platform Invoke Tutorial. The .NET and CryptoAPI via P/Invoke: Part 1 and .NET and CryptoAPI via P/Invoke: Part 2 subsections of Extending .NET Cryptography with CAPICOM and P/Invoke may also be helpful.]

The SignedCode object provides functionality for signing executable files with an Authenticode digital signature.

When to use

The SignedCode object is used to perform the following tasks:

  • Sign executable files.
  • Time stamp executable files.
  • Determine whether the signature of the executable file is valid.
  • Set or retrieve the path to the executable file.
  • Retrieve the signer and time stamper of the executable file.
  • Retrieve a collection of the certificates for the executable file.
  • Retrieve a description or the URL to the description of the executable file.

Members

The SignedCode object has these types of members:

Methods

The SignedCode object has these methods.

Method Description
Sign Creates an Authenticode digital signature and signs the executable file specified in the SignedCode.FileName property.
Timestamp Creates an Authenticode time stamp signature on the signed executable file specified in the SignedCode.FileName property.
Verify Verifies the Authenticode signature on the signed executable file specified in the SignedCode.FileName property.

 

Properties

The SignedCode object has these properties.

Property Access type Description
Certificates
Read-only
A Certificates collection that contains all the certificates in the signed executable file.
Description
Read/write
A string that contains a description of the signed executable file.
DescriptionURL
Read/write
A string that contains the HTTP address to a description of the signed executable file.
FileName
Read/write
A string that contains the path to the content file that contains the executable file.
This is the default property.
Signer
Read-only
A Signer object that provides access to the signer of the executable file.
Timestamper
Read-only
A Signer object that provides access to the time stamper of the executable file.

 

Remarks

The SignedCode object can be created, and is not safe for scripting. The ProgID for the SignedCode object is CAPICOM.SignedCode.1.

The executable file should be of a type that can be signed with Authenticode technology, for example, files that have a file name extension of .cab, .cat, .exe, .dll, .vbs, or .ocx.

Requirements

Requirement Value
Redistributable
CAPICOM 2.0 or later on Windows Server 2003 and Windows XP
DLL
Capicom.dll