IOpcDigitalSignatureManager::ReplaceSignatureXml method (msopc.h)
Replaces the existing signature markup that is stored in a specified signature part.
Syntax
HRESULT ReplaceSignatureXml(
[in] IOpcPartUri *signaturePartName,
[in] const UINT8 *newSignatureXml,
[in] UINT32 count,
[out, retval] IOpcDigitalSignature **digitalSignature
);
Parameters
[in] signaturePartName
An IOpcPartUri interface pointer that represents the part name of the signature part that stores the existing signature markup.
[in] newSignatureXml
A buffer that contains the signature markup that will replace the existing markup.
[in] count
The size of the newSignatureXml buffer.
[out, retval] digitalSignature
A pointer to a new IOpcDigitalSignature interface that represents the signature derived from the signature markup that is passed in newSignatureXml.
Return value
The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.
Return code/value | Description |
---|---|
|
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. |
Remarks
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.
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
Getting Started with the Packaging API
Overviews
Packaging API Programming Guide
Packaging Digital Signature Interfaces
Reference