SecureBlackbox 16: How do I extract a key from the KeyInfo element?

Note: This article applies only to SecureBlackbox Legacy. For future development please consider using the latest version.

To extract a key from the KeyInfo element, 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 the x509Data.Certificate and CertStorage properties for raw certificate data and other properties like IssuerRDNs, SerialNumbers, etc. that reference a certificate
      }

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

We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.