ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / XML file functions
  • Properties specific to xmlSignature variables
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The xmlSignature type is used to define the advanced characteristics of an XML signature. The characteristics of this signature can be defined and modified using various WLanguage properties.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
MaSignature is xmlSignature
MaSignature.NormalizationAlgorithm = atC14NExclusiveWithComments
MaSignature.SignatureAlgorithm = saRSA_SHA_160
MaSignature.Key = MonCertificat
Add(MaSignature.Reference, maRéférence)
MaSignature.KeyInformation[1] = informationCléX509
// Exemple utilisant un Webservice intégré au projet
// Cet exemple ne fonctionne pas par un simple copier/coller

// SOAPAjouteSignatureXML prend en 2ème paramètre l'emplacement où apposer la signature.
// Cet emplacement est décrit dans le WSDL qu'on souhaite utiliser, par un type XSD.
// Dans cet exemple de code, cet emplacement est décrit dans "Security.Assetion.Signature"
// qui provient du WSDL du Webservice qu'on souhaite appeler.

// Il faut donc se référer au WSDL qu'on utilise pour trouver cet emplacement.

MaRequête is wsRequest
MaSecurity is Security // Webservice intégré dans le projet. 

// Construit un identifiant
id is string = GetGUID(guidFormatted)
id = "_" + Middle(id, 2, Length(id) - 2)

// Initialise la signature
cMaSignature is xmlSignature
cMaSignature.NormalizationAlgorithm = atC14NExclusive
cMaSignature.SignatureAlgorithm = saRSA_SHA_256
// Fichier de clé OU certificat récupéré par les fonctions certificats
cMaSignature.Key = fExeDir + fSep + "macle.p12"
cMaSignature.KeyPassword = "password"
cMaSignature.KeyFileType = tfcPKCS12
cMaSignature.Reference[1].HashAlgorithm = HA_SHA_256
cMaSignature.Reference[1].URI = "#" + id
cMaSignature.Reference[1].Transformation[1] = atEnveloped
cMaSignature.Reference[1].Transformation[2] = atC14NExclusive
x509 is xmlSignatureInformationKeyX509
x509.WithCertificate = True
cMaSignature.KeyInformation[1] = x509

// Fin initialisation de la signature
dhDateHeureCourante is DateTime
MaSecurity.Assertion:ID = id
MaSecurity.Assertion:IssueInstant = dhDateHeureCourante
MaSecurity.Assertion:Version = "2.0"
MaSecurity.Assertion.Issuer = "test"
MaSecurity.Assertion.Issuer:Format = ...
	"urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName"

// Ajoute la signature
SOAPAddXMLSignature(MaRequête, MaSecurity.Assertion.Signature, cMaSignature)
Properties

Properties specific to xmlSignature variables

The following properties can be used to define the characteristics of xmlSignature variables:
Property nameType usedEffect
AlgorithmNormalizationInteger constantMethod for standardizing the XML (C14N):
  • atAucune: no standardization method.
  • atC14N11Inclusive: C14N11 inclusive standardization method.
  • atC14N11IncludedWithComment: C14N11 inclusive standardization method with comments.
  • atC14NExclu Exclusive C14N standardization method.
  • atC14NExcluWithCommentary Exclusive C14N standardization method with comments.
  • atC14NInclusive: C14N inclusive standardization method.
  • atC14NIncludedWithComment: C14N inclusive standardization method with comments.
AlgorithmSignatureInteger constantMethod used for the signature:
  • asDSA_SHA_160 DSA encryption algorithm and SHA 160 hash algorithm.
  • asECDSA_SHA_224 ECDSA encryption algorithm and SHA 224 hash algorithm.
  • asECDSA_SHA_256 ECDSA encryption algorithm and SHA 256 hash algorithm.
  • asECDSA_SHA_384 ECDSA encryption algorithm and SHA 384 hash algorithm.
  • asECDSA_SHA_512 ECDSA encryption algorithm and SHA 512 hash algorithm.
  • asRSA_SHA_160 RSA encryption algorithm and SHA 160 hash algorithm.
  • asRSA_SHA_256 RSA encryption algorithm and SHA 256 hash algorithm.
  • asRSA_SHA_384 RSA encryption algorithm and SHA 384 hash algorithm.
  • asRSA_SHA_512 RSA encryption algorithm and SHA 512 hash algorithm.
KeyCertificate or key file used for the signature.
  • If this property corresponds to a file, the KeyFileType property must be specified.
  • New in SaaS
    If this property corresponds to a variable of type Certificate, the certificate handled may be a certificate present on a bullet card.
    Attention This feature is only available in WINDEV Suite SaaS 2025 Update 1. For more details, see Using new features exclusive to WINDEV Suite SaaS 2025.
KeyFileTypeInteger constantIf the Key property corresponds to a file, the KeyFileType property defines the encoding type of the file:
  • tfcBinary: binary encoding.
  • tfcDER DER (Distinguished Encoding Rule) encoding.
  • tfcPEM PEM encoding.
  • tfcPKCS12 PKCS12 type encoding.
  • tfcPKCS8DER PKCS8 DER encoding.
  • tfcPKCS8PEM PKCS8 PEM encoding.
KeyInformationArray of xmlSignatureInformationKeyX509 variablesUsed to specify information about the key used.
KeyPasswordCharacter string or Secret stringPassword used to decrypt the private key.
New in version 2025
Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI string - Latin".
To learn more about secret strings and how to use the vault, see Secret string vault.
New in version 2025
AndroidAndroid Widget Secret strings are not available for this parameter in Android/Android widget applications.
ReferenceArray of xmlSignatureReferenceElements to sign.
Minimum version required
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/14/2025

Send a report | Local help