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


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 support@nsoftware.com.