EldoS | Feel safer!

Software components for data protection, secure storage and transfer

List recipients for encrypted file

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#7033
Posted: 07/23/2008 13:46:00
by Orri Eiriksson (Basic support level)
Joined: 07/23/2008
Posts: 9

Hi there,

First time user here, evaluating SecureBlackBox for my company.


I've been looking for a way to list the recipients of a PGP encrypted file, similar to what GnuPG is able to do. The pgpReader.DecryptAndVerify exception thrown when the incorrect secret key is used to decrypt doesn't seem to contain that information, and I couldn't find it searching in the knowledgebase or on the forum.

Isn't there a handy way to list which public keys were used for the encryption, somehow?

Thanks in advance,

--Orri
#7037
Posted: 07/24/2008 01:52:56
by Ken Ivanov (EldoS Corp.)

Thank you for your interest in our products.

Please consider using TElPGPReader.OnEncrypted event. It returns KeyIDs of the keys that have been used to encrypt the message.
#7044
Posted: 07/24/2008 11:49:32
by Orri Eiriksson (Basic support level)
Joined: 07/23/2008
Posts: 9

Thank you, that did work!

The FindPublicKeyByID was rather tempramental, though, and the only way I could get my hand on the actual public key was to use:


Code
            

SBPGPKeys.TElPGPCustomPublicKey pubKey = null;
SBPGPKeys.TElPGPPublicSubkey pubKeyTemp = null;
if (KeyIDs.Length > 0)
{
    recipients = new ArrayList();
    for (int i = 0; i < KeyIDs.Length; ++i)
    {        
        keyring.FindPublicKeyByID(KeyIDs[i], ref pubKey, 0);
        pubKeyTemp = (SBPGPKeys.TElPGPPublicSubkey)pubKey;
        recipients.Add(pubKeyTemp.Supkey.get_UserIDs(0).Name);
    }
}


as the index returned by FindPublicKeyByID always seemed to return the same value, no matter what. But this worked.

Reply

Statistics

Topic viewed 1024 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!