Home | Sign in | English EN
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
The following functions are used to handle the Windows certificates:
CertificateCheckDuplicateChecks the signature of a duplicate.
CertificateCheckFileSignatureBufferChecks the correspondence between a signature and a file. The signature was stored as a Buffer variable.
CertificateCheckFileSignatureFileChecks the correspondence between a signature and a file. The signature was kept as an external file.
CertificateCheckStringChecks the correspondence between a signature and a string.
CertificateExtractExtracts a certificate from a signature buffer or from a print duplicate.
CertificateExtractExtensionValueReturns the value of a certificate extension.
CertificateListReturns the list of certificates available on the computer.
CertificateLoadLoads a certificate from a file or a buffer.
CertificateOpenPropertiesOpens the Windows window used to find out the properties of a certificate.
CertificateSelectOpens a window for selecting the certificates. The listed certificates are the certificates installed in the personal store.
CertificateSignExecutableSigns an executable file with a certificate.
CertificateSignFileCreates the signature of a file. This signature can be stored in a Buffer variable or in a text file.
CertificateSignStringCreates the signature of a character string.
TrustedCertificateAddAdds a certificate to the list of trusted root authorities used to validate certification strings.
TrustedCertificateResetRemoves all the certificates added by TrustedCertificateAdd.
Minimum version required
  • Version 16
This page is also available for…
Assinatura Digital nfe - Parte 3/... - Assinar Documento
Nessa aula vou Mostrar como Assinar um Documento Xml
This lesson will show how Subscribe to a XML Document
Cette leçon montrera comment Abonnez-vous à un document XML
//Buscar arquivo xml a assinar // search xml file to sign // rechercher ujn fichier xml pourr signer
_xml_assinar is string=fLoadText("D:\arquivo_xml\43160603850874000126550010000035551000142204-nfe.xml",foUnicode)
sRefuri is string="infNFe"
chavenfe is string="NFe43160603850874000126550010000035551000142204"
s_retorno is string=assinar_nfe(_xml_assinar,sRefuri,chavenfe)
IF s_retorno=-1 THEN
EDT_xml_assinado="Erro assinar"
PROCEDURE assinar_nfe(_recebe_xml,_refUri,_ChNfe)

//_refUri= (sRefUri IS STRING = "infNFe")
clX509certi is X509Certificate2("D:\certificado_2016\certificado.pfx","senha")
clDoc is System.Xml.XmlDocument;
clDoc.LoadXml(_recebe_xml) // Ler um arquivo Xml // read an xml file // lire un fichir xml //
//certificado com endereco e senha //certificate with address and password //le certificat avec adresse et mot de pass
//ver se Refuri existe //Refers to see there //fait référence à y voir
qtderefuri is int= clDoc.GetElementsByTagName(_refUri).Count
IF (qtderefuri) =0 THEN
//nao existe // does not exists // ne pas exister
//cria um objeto assinado // creat a signed object // créer un objet signé
VrSignedXml is SignedXml(clDoc)
// adiciona a chave do certificado // add the key certificate // ajouter le certificat de clé
VrSignedXml.SigningKey = clX509certi.PrivateKey
// Cria a referencia para assinatura // creates a reference to signature // crée une référence à la signature
Reference is Reference //= new Reference();
Reference.Uri = "#" + _ChNfe
// adiciona um XmlDsigEnvelopedSignatureTransform para a assinatura // add a XmlDsigEnvelopedSignatureTransform for signature
// ajouter un XmlDsigEnvelopedSignatureTransform à la signature
Env is XmlDsigEnvelopedSignatureTransform
c14 is XmlDsigC14NTransform
// adiciona a referencia no xml assinado // add the reference in xlm signed // ajouter la référence en xml singé
// Cria a chave // creates the key // crée la clé
VrkeyInfo is KeyInfo
// carrega o certificado em um keyinfox509 e adiciona ao keyinfo // load the certificate in a keyinfo x509 and add to keyinfo
// chager le certificat dans un x509 keyinfo et ajouter à kyinfo
VrkeyInfo.AddClause(new KeyInfoX509Data(clX509certi))
// adiciona o keyinfo ao xml assinado // add keyinfo the xml signed // ajouter keyinfo le xml signé
VrSignedXml.KeyInfo = VrkeyInfo
// busca a representacao XML da assinatura e salva no XML // search the xml representantion of the signature and saved in xml
// rechercher la représentation xml de la signature et enregistré en xml
xmlDigitalSignature is System.Xml.XmlElement dynamic = VrSignedXml.GetXml()
// adiciona a assinatura no documento // add the signature in the document // ajouter la signature dans le document
clDoc.DocumentElement.AppendChild(clDoc.ImportNode(xmlDigitalSignature, True))
//salva o documento assinado // save the signed document // enregistrer le document signé
RESULT clDoc.get_InnerXml()


//Blog com Video e Exemplo

27 Jun. 2016