Discuss this help topic in SecureBlackbox Forum

XML: Verify signature with certificate

To validate a signature using a public key / certificate you need to create an instance of appropriate TElXMLKeyInfoX509Data / TElXMLKeyInfoRSAData / TElXMLKeyInfoDSAData / TElXMLKeyInfoECData / TElXMLKeyInfoGOST2001Data / TElXMLKeyInfoPGPData class. The decision of which class to create is based on TElXMLVerifier.KeyName property and/or TElXMLVerifier.SignatureMethod property. You need to initialize this key info data object (this is done in the similar way as it is done for signing, the only difference that you should load only a public key), and then assign this object to TElXMLVerifier.KeyData property.

C#:


TElXMLKeyInfoX509Data X509KeyData = new TElXMLKeyInfoX509Data(false);
// set the parameter to true, if the certificate should be cleared by this object
X509KeyData.Certificate = Certificate;
Verifier.KeyData = X509KeyData;
...
Delphi:

X509KeyData := TElXMLKeyInfoX509Data.Create(false);
// set the parameter to true, if the certificate should be cleared by this object
X509KeyData.Certificate := Certificate;
Verifier.KeyData := X509KeyData;
...
// after validation, we need to clear the key object
X509KeyData.Free;

How To articles about XML signing (XMLDSig and XAdES)

Discuss this help topic in SecureBlackbox Forum