IP*Works! Encrypt V9 - Online Help
IP*Works! Encrypt V9
Questions / Feedback?

XMLSig Component

Properties   Methods   Events   Configuration Settings   Errors  

The XMLSig component is used to sign XML and verify signed XML.

Syntax

nsoftware.IPWorksEncrypt.Xmlsig

Remarks

The XMLSig component provides an easy to use API for signing and verifying signed XML. The Sign method will create signed XML with an enveloped signature. The VerifySignature method will attempt to verify the signature(s) within a XML document.

Sign

Before calling Sign specify the XML to sign by calling SetInputStream or setting InputFile, or InputXML.

The References property must be set. At least one reference must be set. A reference defines the XML element to sign, and the options that specify how it is transformed and hashed during the signing process.

Set Certificate to a certificate with private key.

Optionally set the CanonicalizationMethod. This determines how the signature itself is canonicalized. SigningAlgorithm defines the algorithm used to sign. The SignatureXPath property may be set to specify the location in the XML document where the signature will be placed.

Lastly, call Sign to sign the XML.

The following properties are applicable when calling this method:

Input and Output Properties

The component will determine the source and destination of the input and output based on which properties are set.

The order in which the input properties are checked is as follows:

When a valid source is found the search stops. The order in which the output properties are checked is as follows:

Verify a Signature

When VerifySignature is called, the component will scan the XML document and fire the SignatureInfo event for each signature that is found. When the SignatureInfo event fires the References collection will be populated.

Within the SignatureInfo event the XMLElement field must be set to the location of the XML element to which the signature applies. The URI field may contain data helpful to locating the XML element.

The XMLElement field specifies the XPath to the element. For instance:

/root/myElement XPath syntax
/root/[1] XPath syntax using an index
/root/ns:myElement XPath syntax where the element has a namespace
myElement Just the element name
@id=myid Attribute selector: This will select an element with an attribute "id" whose value is "myid".
/root/myElement[1]/ns:name2[@attr=attrValue] XPath syntax using an index and attribute selector

The signature is verified either using a key parsed from the signed XML, or using the certificate specified by the SignerCert property. The component will automatically parse the signer certificate (if present) from the signed XML and populate the SignerCert property with the parsed value.

When SignatureInfo fires, if the SignerCertParsed parameter is True the SignerCert property may be inspected to see the details of the parsed certificate. If SignerCertParsed is False, then the SignerCert property must be set to a valid certificate for signature verification to proceed.

When the SignatureInfo event finishes firing, the certificate present in the SignerCert property will be used to verify the signature, whether this is the certificate automatically parsed by the component or a different certificate specified within the event.

If the signature was successfully verified the method will return without error. If the signature was not verified the method throws an exception.

Property List


The following is the full list of the properties of the component with short descriptions. Click on the links for further details.

CanonicalizationMethodThe canonicalization method applied to the signature.
CertificateThe certificate used for signing.
HMACKeyThe HMAC key used with the 'HMAC-SHA1' signing algorithm.
InputFileThe XML file to process.
InputXMLThe XML to process.
OutputFileThe output file.
OutputXMLThe output XML after processing.
OverwriteIndicates whether or not the component should overwrite files.
ReferencesA collection of references.
SignatureXPathThe XPath of the signature.
SignerCertThe certificate used for signature verification.
SigningAlgorithmThe signing algorithm.

Method List


The following is the full list of the methods of the component with short descriptions. Click on the links for further details.

ConfigSets or retrieves a configuration setting .
DoEventsProcesses events from the internal message queue.
ResetResets the component.
SetInputStreamSets the stream from which the component will read data to sign or verify.
SetOutputStreamThe stream to which the component will write the signed or verified XML.
SignSigns the XML.
VerifySignatureVerifies signed XML.

Event List


The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.

ErrorInformation about errors during data delivery.
ProgressFired as progress is made.
SignatureInfoFired when a signature is found.
StatusProvides information about the current operation.

Configuration Settings


The following is a list of configuration settings for the component with short descriptions. Click on the links for further details.

KeyNameThe name of the key used to sign the XML.
LogLevelSpecifies the level of detail that is logged.
NormalizeLineEndingsWhether to normalize line endings when calculating the reference digest.
PreserveWhitespaceWhether to preserve whitespace in the signature.
SignatureRelationshipWhether the signature is a child or sibling of the SignatureXPath.
ReadFromProgressEventWhether to read input data from inside the progress event.
WriteToProgressEventWhether to write output data so it is accessible from inside the progress event.
SignerCertCountThe number of parsed signer certificates when verifying a signature.
SignerCertEncoded[i]The parsed signer certificate.
SignWithCryptoAPIWhether to use the Crypto API for signing operations.
CodePageThe system code page used for Unicode to Multibyte translations.

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 9.0.6240.0