Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Examine KeyInfo Certificate in XML SignatureThis example loads signed XML and gets the signing certificate, assuming the certificate is contained in X509Certificate within the KeyInfo.
LOCAL loDsig LOCAL loSbXml LOCAL lnSuccess LOCAL loXmlKeyInfo LOCAL lcCertBase64 LOCAL loCert * This example requires the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.XmlDSig') loDsig = CreateObject('Chilkat.XmlDSig') * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder') loSbXml = CreateObject('Chilkat.StringBuilder') lnSuccess = loSbXml.LoadFile("c:/aaworkarea/elias/3/face_f09006808443a699d1b.xml","utf-8") IF (lnSuccess <> 1) THEN ? "Failed to load XML file." RELEASE loDsig RELEASE loSbXml CANCEL ENDIF lnSuccess = loDsig.LoadSignatureSb(loSbXml) IF (lnSuccess <> 1) THEN ? loDsig.LastErrorText RELEASE loDsig RELEASE loSbXml CANCEL ENDIF * Get the KeyInfo XML. loXmlKeyInfo = loDsig.GetKeyInfo() IF (loDsig.LastMethodSuccess <> 1) THEN ? loDsig.LastErrorText RELEASE loDsig RELEASE loSbXml CANCEL ENDIF ? loXmlKeyInfo.GetXml() ? "----" * Assuming the X509Certificate is in the KeyInfo, it will look like this: * <ds:KeyInfo Id="..."> * <ds:KeyValue> * ... * <ds:X509Data> * <ds:X509Certificate>MIIHAz...</ds:X509Certificate> * </ds:X509Data> * </ds:KeyInfo> lcCertBase64 = loXmlKeyInfo.GetChildContent("*:X509Data|*:X509Certificate") IF (loXmlKeyInfo.LastMethodSuccess <> 1) THEN ? "No X509Certificate found in the KeyInfo." RELEASE loDsig RELEASE loSbXml CANCEL ENDIF * Load a certificate object w/ the base64. * For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Cert') loCert = CreateObject('Chilkat.Cert') lnSuccess = loCert.LoadFromBase64(lcCertBase64) IF (lnSuccess <> 1) THEN ? loCert.LastErrorText RELEASE loDsig RELEASE loSbXml RELEASE loCert CANCEL ENDIF * Examine the cert.. ? "SubjectDN: " + loCert.SubjectDN ? "IssuerDN: " + loCert.IssuerDN ? "SerialNumber as Decimal: " + loCert.SerialDecimal RELEASE loXmlKeyInfo RELEASE loDsig RELEASE loSbXml RELEASE loCert |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.