public static List<KeyPairInformation> GetKeysFromPgpMessage(string message)
{
var encryptionKeys = new List<KeyPairInformation>(); // create a return list
var inspector = new PGPInspectLib(); // instantiate the inspector
Stream encryptedStream = new MemoryStream(System.Text.ASCIIEncoding.ASCII.GetBytes(message)); // get the stream
if (inspector.IsPublicKeyEncrypted(encryptedStream)) // check it is a valid stream
{
long[] encryptionKeyIds = inspector.ListEncryptionKeyIds(encryptedStream); // pass stream to retrieve list of key id's // throws here.
foreach (long keyId in encryptionKeyIds)
encryptionKeys.Add(KeyManagement.GetKeyFromKeyId(keyId)); // populate return list with Key Information
}
return encryptionKeys;
}