xml.Signature methods

Methods for the xml.Signature class.

Table 1. Class methods: Creation
Name Description
xml.Signature.Create()
  RETURNING sign xml.Signature
Constructor of a blank Signature object.
xml.Signature.CreateFromNode(
   signode xml.DomNode )
  RETURNING sign xml.Signature
Constructor of a new Signature object from a XML Signature node, according to the XML-Signature specification.
Table 2. Class methods: Object access
Name Description
xml.Signature.RetrieveObjectDataListFromSignatureNode(
   sign xml.DomNode,
   ind INTEGER )
  RETURNING nodelist xml.DomNodeList
Returns a DomNodeList containing all embedded XML nodes related to the signature object of index ind in the XML Signature node sign.
Note: In addition to this class method categorized under Object Access, there are also object methods. These are listed in Table 9.
Table 3. Object methods: Key and certificate
Name Description
setCertificate(
   cert xml.CryptoX509 )
Defines the X509 certificate to be added to the Signature object when signing a document.
setKey(
   key xml.CryptoKey )
Defines the key used for signing or validation.
Table 4. Object methods: Modifier
Name Description
setCanonicalization(
   url STRING )
Sets the canonicalization method to use for the signature.
setID(
   id STRING )
Sets an ID value for the signature.
Table 5. Object methods: Access
Name Description
getCanonicalization()
  RETURNING ident STRING
Returns one of the four canonicalization identifier of the signature.
getDocument()
  RETURNING doc xml.DomDocument
Returns a new DomDocument object representing the signature in XML.
getID()
  RETURNING id STRING
Returns the ID value of the signature.
getSignatureMethod()
  RETURNING algo STRING
Returns the algorithm method of the signature.
getType()
  RETURNING str STRING
Returns a string with the type of the Signature object.
Table 6. Object methods: Reference modifier
Name Description
appendReferenceTransformation(
   ind INTEGER,
   trans STRING,
   ... )
Appends a transformation related to the reference of index ind, and is executed before any computation
createReference(
   uri STRING,
   digest STRING )
  RETURNING ind INTEGER
Creates a new reference that will be signed with the compute() method
setReferenceID(
   ind INTEGER,
   value STRING )
Sets an ID value for the signature reference of index ind.
Table 7. Object methods: Reference access
Name Description
getReferenceCount()
  RETURNING num INTEGER
Returns the number of references in this Signature object.
getReferenceDigest(
   ind INTEGER )
  RETURNING algo STRING
Returns the digest algorithm identifier of the reference of index ind in this Signature object.
getReferenceURI(
   ind INTEGER )
  RETURNING uri STRING
Returns the URI of the reference of index ind in this Signature object.
getReferenceID(
   ind INTEGER )
  RETURNING value STRING
Returns the ID value of the reference of index ind in this Signature object, or NULL if there is none.
getReferenceTransformation(
   ind INTEGER,
   pos INTEGER )
  RETURNING ident STRING
Gets the transformation identifier related to the reference of index ind at position pos in the list of transformation.
getReferenceTransformationCount(
   ind INTEGER )
  RETURNING num INTEGER
Returns the number of transformation related to the reference of index ind.
Table 8. Object methods: Object modifier
Name Description
appendObjectData(
   ind INTEGER,
   node xml.DomNode )
Appends a copy of a XML node node to the signature object of index ind.
createObject()
  RETURNING ind INTEGER
Creates a new object that will embed additional XML nodes.
setObjectID(
   ind INTEGER,
   value STRING )
Sets an ID value for the signature object of index ind.
Table 9. Object methods: Object access
Name Description
getObjectCount()
  RETURNING num INTEGER
Returns the number of objects in this Signature object.
getObjectId(
   ind INTEGER )
  RETURNING id STRING
Returns the ID value of the signature object of index ind in this Signature object.
Note: In addition to these object methods categorized under Object Access, there is also a class method. It is listed in Table 2.
Table 10. Object methods: Signature computation and verification
Name Description
compute(
   doc xml.DomDocument )
Computes the signature of all references set in this Signature object.
signString(
  key xml.CryptoKey,
  strToSign STRING
 )
 RETURNING sig STRING
Sign the passed string according to the specified key.
verify(
   doc xml.DomDocument )
  RETURNING flag INTEGER
Verifies whether all references in this Signature object haven't changed.
verifyString(
   key xml.CryptoKey,
   signedStr STRING,
   signature STRING )
  RETURNING flag INTEGER
Verify the signature is consistent with the given key and the original message.