IOpcDigitalSignatureManager::ReplaceSignatureXml method (msopc.h)
Replaces the existing signature markup that is stored in a specified signature part.
HRESULT ReplaceSignatureXml( IOpcPartUri *signaturePartName, const UINT8 *newSignatureXml, UINT32 count, IOpcDigitalSignature **digitalSignature );
An IOpcPartUri interface pointer that represents the part name of the signature part that stores the existing signature markup.
A buffer that contains the signature markup that will replace the existing markup.
The size of the newSignatureXml buffer.
A pointer to a new IOpcDigitalSignature interface that represents the signature derived from the signature markup that is passed in newSignatureXml.
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
||The method succeeded.|
||At least one of the signaturePartName, newSignatureXml, and digitalSignature parameters is NULL.|
||The newSignatureXml buffer contains more than one Reference element that refers to the package Object element, but only one such Reference is allowed.|
||The newSignatureXml buffer contains more than one SignatureProperty element that has the same Id attribute.|
||In the newSignatureXml buffer, a Reference element refers to an object that is external to the package. Reference elements must point to parts or Object elements that are internal.|
||An unsupported canonicalization method was requested or used in the newSignatureXml buffer.|
||In the newSignatureXml buffer, 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.|
||The newSignatureXml buffer does not contain the signature markup for exactly one signature.|
||The size of the newSignatureXml buffer is 0, but this buffer must have a size that is greater than 0.|
||In the newSignatureXml buffer, a relationships transform is not followed by a canonicalization method; the relationships transform must be followed by a canonicalization method.|
||In the newSignatureXml buffer, a Reference to the package-specific Object element was not found.|
||The signature markup in the newSignatureXml buffer does not specify a signature method algorithm.|
||In the newSignatureXml buffer, the SignatureProperties element was not found.|
||In the newSignatureXml buffer, the SignatureProperty child element of the SignatureProperties element was not found.|
||In the newSignatureXml buffer, the SignatureProperty element with the Id attribute value of "idSignatureTime" does not exist or is not correctly constructed.|
||In the newSignatureXml buffer, more than one relationships transform is specified for a Reference element, but only one relationships transform is allowed.|
||The URI attribute value of a Reference element in the newSignatureXml buffer does not include the content type of the referenced part.|
||In the newSignatureXml buffer, the SignatureProperty element is missing the required Target attribute.|
||A Reference element, which is in the newSignatureXml buffer, requires the URI attribute, but the attribute is missing.|
||The package is not signed; therefore, the signature markup cannot be replaced.|
||The specified part does not exist.|
This method does not validate the signature that is derived from the new signature markup that is in the newSignatureXml parameter.
The caller must confirm that the new signature markup, which replaces the existing signature markup in the specified signature part, will not break the signature.
This method changes the existing signature markup; certificates and relationships that have the specified signature part as their source are preserved.
Packaging objects are not thread-safe.
For more information, see the Getting Started with the Packaging API.
|Minimum supported client||Windows 7 [desktop apps only]|
|Minimum supported server||Windows Server 2008 R2 [desktop apps only]|