PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of xmlSignature variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
xmlSignature (Type of variable)
In French: xmlSignature
The xmlSignature type is used to define the advanced characteristics of an XML signature. The characteristics of this signature can be defined and modified by several WLanguage properties.
Note: See Declaring a variable for more details.
Example
MySignature is xmlSignature
MySignature..AlgorithmNormalization = atC14NExclusiveWithComments
MySignature..AlgorithmSignature = asRSA_SHA_160
MySignature..Key = MyCertificate
Add(MySignature..Reference, myReference)
MySignature..KeyInformation[1]..Type = informationKeyX509
// Example that is using a Webservice included to the project
// This example does not operate via a copy/paste

// SOAPAddXMLSignature takes in 2nd parameter the location where the signature will be placed.
// This location is described in the WSDL that we want to use, by an XSD type.
// In this code example, this location is described in "Security.Assetion.Signature"
// that comes from the WSDL of the Webservice that we want to call.

// Therefore, we must refer to the WSDL that we are using to find this location.

MyRequest is wsRequest
MySecurity is Security // Webservice included in the project.

// Builds an identifier
id is string = GetGUID(guidFormatted)
id = "_" + Middle(id, 2, Length(id) - 2)

// Initializes the signature
cMySignature is xmlSignature
cMySignature..AlgorithmNormalization = atC14NExclusive
cMySignature..AlgorithmSignature = asRSA_SHA_256
// Key file OR certificate retrieved by the certificate functions
cMySignature..Key = fExeDir + fSep + "mykey.p12"
cMySignature..KeyPassword = "password"
cMySignature..KeyFileType = tfcPKCS12
cMySignature..Reference[1]..AlgorithmHash = HA_SHA_256
cMySignature..Reference[1]..URI = "#" + id
cMySignature..Reference[1]..Transformation[1] = atEnveloped
cMySignature..Reference[1]..Transformation[2] = atC14NExclusive
x509 is xmlSignatureInformationKeyX509
x509..WithCertificate = True
cMySignature..KeyInformation[1] = x509

// End of signature initialization
dtCurrentDateTime is DateTime
MySecurity.Assertion:ID = id
MySecurity.Assertion:IssueInstant = dtCurrentDateTime
MySecurity.Assertion:Version = "2.0"
MySecurity.Assertion.Issuer = "test"
MaSecurity.Assertion.Issuer:Format = ...
"urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName"


// Adds the signature
SOAPAddXMLSignature(MaRequest, MySecurity.Assertion.Signature, cMySignature)
Remarks

Properties specific to the description of xmlSignature variables

The following properties can be used to handle an xmlSignature variable:
Property nameType usedEffect
AlgorithmNormalizationInteger constantMethod for standardizing the XML (C14N):
  • atNone: no standardization method.
  • atC14N11Inclusive: Inclusive C14N11 standardization method.
  • atC14N11InclusiveWithComments: Inclusive C14N11 standardization method with comments.
  • atC14NExclusive: Exclusive C14N standardization method.
  • atC14NExclusiveWithComments: Exclusive C14N standardization method with comments.
  • atC14NInclusive: Inclusive C14N standardization method.
  • atC14NInclusiveWithComments: Inclusive C14N standardization method with comments.
AlgorithmSignatureInteger constantMethod used for the signature:
  • asDSA_SHA_160: DSA encryption algorithm and SHA 160 hash algorithm
  • asRSA_SHA_160: RSA encryption algorithm and SHA 160 hash algorithm
  • asRSA_SHA_256: RSA encryption algorithm and SHA 256 hash algorithm
KeyCertificate or key file used for the signature. If this property corresponds to a file, ..KeyFileType must be specified.
KeyInformationArray of xmlSignatureInformationKeyX509 variablesUsed to specify information about the key used.
KeyPasswordCharacter stringPassword used to decrypt the private key.
ReferenceArray of xmlSignatureReferenceElements to sign.
KeyFileTypeInteger constantIf ..Key corresponds to a file, used to define the type of encoding for the file:
  • tfcBinary: binary encoding
  • tfcDER: DER encoding (Distinguished Encoding Rule)
  • tfcPEM: PEM encoding
  • tfcPKCS12: PKCS12 encoding
  • tfcPKCS8DER: PKCS8 DER encoding
  • tfcPKCS8PEM: PKCS8 PEM encoding
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>
Minimum required version
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment