How to extract a key from 'KeyInfo' element?

To extract a key from “KeyInfo” element you need to use the following code (C# notation):

for (int i = 0; i < ElXMLVerifier.Signature.KeyInfo.Count; i++)
  if (ElXMLVerifier.Signature.KeyInfo[i] is TElXMLKeyInfoX509Data)
  {
    TElXMLKeyInfoX509Data x509Data = (TElXMLKeyInfoX509Data) ElXMLVerifier.Signature.KeyInfo[i];
    ...
    // check x509Data.Certificate and CertStorage properties for raw certificate data and other properties like IssuerRDNs, SerialNumbers… that reference a certificate
  }

if (ElXMLVerifier.Signature.KeyInfo[i] is TElXMLKeyInfoRSAData)
...

Ready to get started?

Learn more about SecureBlackbox or download a free trial.

Download Now