XmlDSig ActiveX Reference Documentation

XmlDSig

Current Version: 10.1.0

An API for validating XML Digital Signatures. Use the XmlDSigGen class for creating XML Digital Signatures.

Object Creation

Note:
For versions of Chilkat < 10.0.0, use "Chilkat_9_5_0.XmlDSig" instead of "Chilkat.XmlDSig"
For a specific major version, use "Chilkat.XmlDSig.<major_version>", such as "Chilkat.XmlDSig.10" for Chilkat v10.*.*
See Chilkat ActiveX Object Creation

(ASP)
set obj = Server.CreateObject("Chilkat.XmlDSig")

(AutoIt)
$obj = ObjCreate("Chilkat.XmlDSig")

(Visual Basic 6.0)
Dim obj As New ChilkatXmlDSig

(VBScript)
set obj = CreateObject("Chilkat.XmlDSig")

(Delphi)
obj := TChilkatXmlDSig.Create(Self);

(FoxPro)
loObject = CreateObject('Chilkat.XmlDSig')

(PowerBuilder)
lole_object = create oleobject
li_rc = lole_object.ConnectToNewObject("Chilkat.XmlDSig")

(SQL Server)
EXEC @hr = sp_OACreate 'Chilkat.XmlDSig', @obj OUT

(Javascript)
var obj = new ActiveXObject("Chilkat.XmlDSig");

Properties

DebugLogFilePath
DebugLogFilePath As String

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

top
ExternalRefDirs
ExternalRefDirs As String
Introduced in version 9.5.0.77

May contain a set of directory paths specifying where referenced external files are located. Directory paths should be separated using a semicolon character. The default value of this property is the empty string which means no directories are automatically searched.

This property can be used if the external file referenced in the XML signature has the same filename as the file in the local filesystem.

top
IgnoreExternalRefs
IgnoreExternalRefs As Long
Introduced in version 9.5.0.77

If 1, then ignore failures caused by external references not being available. This allows for the XML signature to be at least partially validated if the external referenced files are not available. The default value of this property is 0.

top
LastBinaryResult
LastBinaryResult As Variant (read-only)

The binary data returned by the last (binary data returning) method called. Only available if Chilkat.Global.KeepBinaryResult is set to 1. This provides a means for obtaining large varbinary results in the SQL Server environment (where limitations exist in getting large amounts of data returned by method calls, but where temp tables can be used for binary properties).

top
LastErrorHtml
LastErrorHtml As String (read-only)

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorText
LastErrorText As String (read-only)

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorXml
LastErrorXml As String (read-only)

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastMethodSuccess
LastMethodSuccess As Long

Indicate whether the last method call succeeded or failed. A value of 1 indicates success, a value of 0 indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = 1 and failure = 0.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to 1. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

top
LastStringResult
LastStringResult As String (read-only)

The string return value of the last (string returning) method called. Only available if Chilkat.Global.KeepStringResult is set to 1. This provides a means for obtaining large string results in the SQL Server environment (where limitations exist in getting long strings returned by method calls, but where temp tables can be used for string properties).

top
LastStringResultLen
LastStringResultLen As Long (read-only)

The length, in characters, of the string contained in the LastStringResult property.

top
NumReferences
NumReferences As Long (read-only)
Introduced in version 9.5.0.69

The number of data objects referenced in the XML digital signature. A data object may be self-contained within the loaded XML signature, or it may be an external URI reference. An application can check each reference to see if it's external by calling IsReferenceExternal, and can get each reference URI by calling ReferenceUri.

top
NumSignatures
NumSignatures As Long (read-only)
Introduced in version 9.5.0.69

The number of digital signatures found within the loaded XML. Each digital signature is composed of XML having the following structure:

  <Signature ID?> 
     <SignedInfo>
       <CanonicalizationMethod/>
       <SignatureMethod/>
       (<Reference URI? >
         (<Transforms>)?
         <DigestMethod>
         <DigestValue>
       </Reference>)+
     </SignedInfo>
     <SignatureValue> 
    (<KeyInfo>)?
    (<Object ID?>)*
 </Signature>
Note: The "Signature" and other XML tags may be namespace prefixed.

The Selector property is used to select which XML signature is in effect when validating or calling other methods or properties.

More Information and Examples
top
RefFailReason
RefFailReason As Long (read-only)
Introduced in version 9.5.0.77

Indicates the failure reason for the last call to VerifyReferenceDigest. Possible values are:

  • 0: No failure, the reference digest was valid.
  • 1: The computed digest differs from the digest stored in the XML.
  • 2: An external file is referenced, but it is unavailable for computing the digest.
  • 3: The index argument passed to VerifyReferenceDigest was out of range.
  • 4: Unable to find the Signature.
  • 5: A transformation specified some sort of XML canonicalization that is not supported.
  • 99: Unknown. (Should never get this value.)

top
Selector
Selector As Long
Introduced in version 9.5.0.69

If the loaded XML contains multiple signatures, this property can be set to specify which signature is in effect when calling other methods or properties. In most cases, the loaded XML contains a single signature and this property will remain at the default value of 0.

top
UncommonOptions
UncommonOptions As String
Introduced in version 9.5.0.90

This is a catch-all property to be used for uncommon needs. This property defaults to the empty string, and should typically remain empty.

top
VerboseLogging
VerboseLogging As Long

If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
Version As String (read-only)

Version of the component/library, such as "9.5.0.94"

top

Methods

AddEncapsulatedTimeStamp
AddEncapsulatedTimeStamp(json As ChilkatJsonObject, sbOut As ChilkatStringBuilder) As Long
Introduced in version 9.5.0.90

Adds an EncapsulatedTimeStamp to the signature indicated by the Selector property. The updated signed XML with the added EncapsulatedTimeStamp is returned in sbOut. See the example below for details.

Returns 1 for success, 0 for failure.

top
CanonicalizeFragment
CanonicalizeFragment(xml As String, fragmentId As String, version As String, prefixList As String, ByVal withComments As Long) As String

Applies XML canonicalization to a fragment of the passed-in XML, and returns the canonicalized XML string. The fragmentId identifies the XML element where output begins. It is the XML element having an "id" attribute equal to fragmentId. The version may be one of the following:

  • "C14N" -- for Inclusive Canonical XML
  • "EXCL_C14N" -- for Exclusive Canonical XML

The prefixList only applies when the version is set to "EXCL_C14N". The prefixList may be an empty string, or a SPACE separated list of namespace prefixes. It is the InclusiveNamespaces PrefixList, which is the list of namespaces that are propagated from ancestor elements for canonicalization purposes.

If withComments is 1, then XML comments are included in the output. If withComments is 0, then XML comments are excluded from the output.

Returns Nothing on failure

top
CanonicalizeXml
CanonicalizeXml(xml As String, version As String, ByVal withComments As Long) As String

Applies XML canonicalization to the passed-in XML, and returns the canonicalized XML string. The version may be one of the following:

  • "C14N" -- for Inclusive Canonical XML
  • "EXCL_C14N" -- for Exclusive Canonical XML

If withComments is 1, then XML comments are included in the output. If withComments is 0, then XML comments are excluded from the output.

Returns Nothing on failure

top
GetCerts
GetCerts(sa As CkStringArray) As Long
Introduced in version 9.5.0.76

Returns the certificates found in the signature indicated by the Selector property. The base64 representation of each certificate is returned.

Returns 1 for success, 0 for failure.

top
GetKeyInfo
GetKeyInfo() As ChilkatXml
Introduced in version 9.5.0.69

Returns the KeyInfo XML for the signature indicated by the Selector property. Returns Nothing if no KeyInfo exists.

Returns Nothing on failure

top
GetPublicKey
GetPublicKey() As PublicKey
Introduced in version 9.5.0.69

Returns the public key from the KeyInfo XML for the signature indicated by the Selector property. Returns Nothing if no KeyInfo exists, or if no public key is actually contained in the KeyInfo.

Returns Nothing on failure

top
HasEncapsulatedTimeStamp
HasEncapsulatedTimeStamp() As Long
Introduced in version 9.5.0.90

Returns 1 if the signature indicated by the Selector property contains an EncapsulatedTimeStamp. Otherwise returns 0.

top
IsReferenceExternal
IsReferenceExternal(ByVal index As Long) As Long
Introduced in version 9.5.0.69

Returns 1 if the reference at index is external. Each external reference would first need to be provided by the application prior to validating the signature.

top
LoadSignature
LoadSignature(xmlSig As String) As Long
Introduced in version 9.5.0.69

Loads an XML document containing 1 or more XML digital signatures. An application would first load XML containing digital signature(s), then validate. After loading, it is also possible to use various methods and properties to get information about the signature, such as the key info, references, etc. If external data is referenced by the signature, it may be necessary to provide the referenced data prior to validating.

Note: When loading an XML document, the Selector property is automatically reset to 0, and the NumSignatures property is set to the number of XML digital signatures found.

Returns 1 for success, 0 for failure.

top
LoadSignatureBd
LoadSignatureBd(binData As ChilkatBinData) As Long
Introduced in version 9.5.0.69

Loads an XML document containing one or more XML digital signatures from the contents of a BinData object. An application would first load the XML, then validate. After loading, it is also possible to use various methods and properties to get information about the signature, such as the key info, references, etc. If external data is referenced by the signature, it may be necessary to provide the referenced data prior to validating.

Note: When loading an XML document, the Selector property is automatically reset to 0, and the NumSignatures property is set to the number of XML digital signatures found.

Returns 1 for success, 0 for failure.

top
LoadSignatureSb
LoadSignatureSb(sbXmlSig As ChilkatStringBuilder) As Long
Introduced in version 9.5.0.69

Loads an XML document containing one or more XML digital signatures from the contents of a StringBuilder object. An application would first load the XML, then validate. After loading, it is also possible to use various methods and properties to get information about the signature, such as the key info, references, etc. If external data is referenced by the signature, it may be necessary to provide the referenced data prior to validating.

Note: When loading an XML document, the Selector property is automatically reset to 0, and the NumSignatures property is set to the number of XML digital signatures found.

Returns 1 for success, 0 for failure.

top
ReferenceUri
ReferenceUri(ByVal index As Long) As String
Introduced in version 9.5.0.69

Returns the URI of the Nth reference specified by index. (The 1st reference is at index 0.) URI's beginning with a pound sign ('#') are internal references.

Returns Nothing on failure

top
SetHmacKey
SetHmacKey(key As String, encoding As String) As Long
Introduced in version 9.5.0.69

Sets the HMAC key to be used if the Signature used an HMAC signing algorithm. The encoding specifies the encoding of key, and can be "hex", "base64", "ascii", or any of the binary encodings supported by Chilkat in the link below.

Returns 1 for success, 0 for failure.

top
SetHttpObj
SetHttpObj(http As ChilkatHttp)
Introduced in version 9.5.0.90

Sets the HTTP object to be used to communicate with OCSP responders, CRL distribution points, or timestamp authority (TSA) servers if needed. The http is used to send the requests, and it allows for connection related settings and timeouts to be set. For example, if HTTP or SOCKS proxies are required, these features can be specified on the http.

top
SetPublicKey
SetPublicKey(pubKey As PublicKey) As Long
Introduced in version 9.5.0.69

Sets the public key to be used for verifying the signature indicated by the Selector property. A public key only needs to be explicitly provided by the application for those XML signatures where the public key is not already available within the KeyInfo of the Signature. In some cases, the KeyInfo within the Signature contains information about what public key was used for signing. The application can use this information to retrieve the matching public key and provide it via this method.

Returns 1 for success, 0 for failure.

top
SetRefDataBd
SetRefDataBd(ByVal index As Long, binData As ChilkatBinData) As Long
Introduced in version 9.5.0.69

Provides the binary data for the external reference at index.

top
SetRefDataFile
SetRefDataFile(ByVal index As Long, path As String) As Long
Introduced in version 9.5.0.69

Provides the data for the external reference at index. When validating the signature, the data contained in path will be streamed to compute the digest for validation.

top
SetRefDataSb
SetRefDataSb(ByVal index As Long, sb As ChilkatStringBuilder, charset As String) As Long
Introduced in version 9.5.0.69

Provides the text data for the external reference at index. The charset specifies the byte representation of the text, such as "utf-8", "utf-16", "windows-1252", etc. (If in doubt, try utf-8 first.)

top
UseCertVault
UseCertVault(certVault As ChilkatXmlCertVault) As Long
Introduced in version 9.5.0.69

Adds an XML certificate vault to the object's internal list of sources to be searched for certificates having public keys when verifying an XML signature. A single XML certificate vault may be used. If UseCertVault is called multiple times, only the last certificate vault will be used, as each call to UseCertVault will replace the certificate vault provided in previous calls.

Returns 1 for success, 0 for failure.

top
VerifyReferenceDigest
VerifyReferenceDigest(ByVal index As Long) As Long
Introduced in version 9.5.0.69

This method allows for an application to verify the digest for each reference separately. This can be helpful if the full XMLDSIG validation fails, then one can test each referenced data's digest to see which, if any, fail to match.

top
VerifySignature
VerifySignature(ByVal verifyReferenceDigests As Long) As Long
Introduced in version 9.5.0.69

Verifies the signature indicated by the Selector property. If verifyReferenceDigests is 1, then the digest of each Reference within the signature's SignedInfo is also validated.

Returns 1 for success, 0 for failure.

More Information and Examples
(AutoIt) Verify XML Digital Signature with an RSA Key(Classic ASP) Verify XML Digital Signature with an RSA Key(PowerBuilder) Verify XML Digital Signature with an RSA Key(SQL Server) Verify XML Digital Signature with an RSA Key(VBScript) Verify XML Digital Signature with an RSA Key(Visual Basic 6.0) Verify XML Digital Signature with an RSA Key(Visual FoxPro) Verify XML Digital Signature with an RSA Key(AutoIt) Verify SOAP XML using a wsse:SecurityTokenReference(Classic ASP) Verify SOAP XML using a wsse:SecurityTokenReference(PowerBuilder) Verify SOAP XML using a wsse:SecurityTokenReference(SQL Server) Verify SOAP XML using a wsse:SecurityTokenReference(VBScript) Verify SOAP XML using a wsse:SecurityTokenReference(Visual Basic 6.0) Verify SOAP XML using a wsse:SecurityTokenReference(Visual FoxPro) Verify SOAP XML using a wsse:SecurityTokenReference(AutoIt) Verify XML Signature having KeyInfo / X509Data / X509Certificate(Classic ASP) Verify XML Signature having KeyInfo / X509Data / X509Certificate(PowerBuilder) Verify XML Signature having KeyInfo / X509Data / X509Certificate(SQL Server) Verify XML Signature having KeyInfo / X509Data / X509Certificate(VBScript) Verify XML Signature having KeyInfo / X509Data / X509Certificate(Visual Basic 6.0) Verify XML Signature having KeyInfo / X509Data / X509Certificate(Visual FoxPro) Verify XML Signature having KeyInfo / X509Data / X509CertificateOnline Tool to Verify XML Signature(AutoIt) Verify XML Signature with External URL References(Classic ASP) Verify XML Signature with External URL References(PowerBuilder) Verify XML Signature with External URL References(SQL Server) Verify XML Signature with External URL References(VBScript) Verify XML Signature with External URL References(Visual Basic 6.0) Verify XML Signature with External URL References(Visual FoxPro) Verify XML Signature with External URL References
top