IOpcCertificateEnumerator::GetCurrent method (msopc.h)

Gets the CERT_CONTEXT structure at the current position of the enumerator.

Syntax

HRESULT GetCurrent(
  [out, retval] const CERT_CONTEXT **certificate
);

Parameters

[out, retval] certificate

A pointer to a CERT_CONTEXT structure. If the method succeeds, call the CertFreeCertificateContext function to free the memory of the structure.

Return value

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return code/value Description
S_OK
The method succeeded.
E_POINTER
The partReference parameter is NULL.
OPC_E_ENUM_COLLECTION_CHANGED
0x80510050
The enumerator is invalid because the underlying set has changed.
OPC_E_ENUM_INVALID_POSITION
0x80510053
The enumerator cannot perform this operation from its current position.
OPC_E_DS_EXTERNAL_SIGNATURE
0x8051001E
A relationship whose target is a Signature part has the external target mode; Signature parts must be inside of the package.
OPC_E_DS_INVALID_CERTIFICATE_RELATIONSHIP
0x8051001D
A relationship of type digital signature certificate has the external target mode.

For more information about this relationship type, see the OPC.

OPC_E_DS_INVALID_RELATIONSHIP_TRANSFORM_XML
0x80510021
A Transform element that indicates the use of the relationships transform and the selection criteria for the transform does not conform to the schema specified in the OPC.
OPC_E_DS_MISSING_CERTIFICATE_PART
0x80510056
The part that contains the certificate and is the target of a relationship of type digital signature certificate does not exist.

For more information about this relationship type, see the OPC.

OPC_E_DS_SIGNATURE_PROPERTY_MISSING_TARGET
0x80510045
The SignatureProperty element is missing the required Target attribute.
OPC_E_UNEXPECTED_CONTENT_TYPE
0x80510005
Either the content type of a part differed from the expected content type (specified in the OPC, ECMA-376 Part 2), or the part content did not match the part's content type.

Remarks

If the certificate represented by the CERT_CONTEXT structure is corrupted or is not an X.509 certificate, this method will return an error; further, the signing policy used by the caller dictates whether the signature will still be validated. After this kind of error is returned, calls to the MoveNext or MovePrevious method will continue to iterate through the enumerator.

When an enumerator is created, the current position precedes the first pointer of the enumerator. To set the current position to the first pointer, call the MoveNext method after the enumerator is created.

Thread Safety

Packaging objects are not thread-safe.

For more information, see the Getting Started with the Packaging API.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header msopc.h

See also

Certificates

Core Packaging Interfaces

Digital Signatures Overview

Getting Started with the Packaging API

IOpcCertificateEnumerator

IOpcCertificateSet

Overviews

Packaging API Programming Guide

Packaging API Reference

Packaging API Samples

Packaging Interfaces

Reference