|
FORUMS PROFESSIONNELS WINDEV, WEBDEV et WINDEV Mobile |
| | | | | |
| Ajouter une signature à un fichier xml |
| Débuté par Med khaled ABDELKEFI, 12 fév. 2026 12:56 - Aucune réponse |
| |
| | | |
|
| |
Membre enregistré 14 messages |
|
| Posté le 12 février 2026 - 12:56 |
Bonjour J'ai un fichier xml (validé par un xsd (non signé). Je cherche à connaitre les étapes (ou un petit bout de programme windev) pour le signer et ajouter la signature (format xades) à la fin du document. la balise signature n'existe pas dans le fichier xml non signé. Projet dans le cadre de la facturation électronique en Tunisie
Votre aide SVP et merci d'avance.
Ci-après ma tentative (sans succès) xmlFacture est un xmlDocument, description="facture_v10_1" // SCHEMA .XSD SANS SIGNATURE
xmlFactureSigne est un xmlDocument, description = "facture_INVOIC_withSig - Copie" // SCHEMA .XSD AVEC SIGNATURE
xmlFacture = XMLOuvre("D:\Test.xml", depuisFichier) si ErreurDétectée = Vrai alors Erreur("Impossible d'ouvrir le flux RSS. Vérifiez votre connexion Internet.") fin
tabCertificat est un tableau de Certificat MonCertificat est un Certificat
tabCertificat = CertificatCharge("D:\Cert.cer","xxxxxxxx") MonCertificat = tabCertificat[1] si MonCertificat.ValidePourSignature = Faux alors Info("Le certificat sélectionné ne permet de pas de générer une signature.") retour fin
sign is xmlXAdESSignature
// Configure signature properties sign.NormalizationAlgorithm = atC14NExclusive sign.SignatureAlgorithm = saRSA_SHA_256
// Specify the certificate information (using a PKCS12 file as an example) sign.Key = MonCertificat // MyCertificate is a variable of type Certificate, or the path to a certificate file sign.KeyFileType = tfcPKCS12 //sign.SignaturePolicyIdentifier = "urn:oid:x.x.x.x.x.x.x.x.x.x.x" // Optional: OID of the signature policy
// Define a GUID for the XML body ID sGUID is string = DonneGUID(guidBrut256) // Use a real GUID generator, e.g., Replace(GetGUID(guidFormatted), ["{", "}"], "")
// Configure the reference to the signed data sign.Référence[1].URI = "#" + sGUID sign.Référence[1].Transformation[1] = atEnveloped sign.Référence[1].Transformation[2] = atC14NExclusive sign.Référence[1].HashAlgorithm = HA_SHA_256
si XMLSigne(sign,NoeudASigner) = Vrai alors // JE NE SAIS PAS FAIRE Trace("Document signé") fin |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|