EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Get Key ID from PGP encrypted file

Posted: 06/05/2014 03:24:03
by Frank Munsberg (Standard support level)
Joined: 06/04/2009
Posts: 49

Is it somehow possible to just read the Key ID from a PGP encrypted file without actually starting a decryption process?

seems to work but in that event I'd already be in the middle of the decryption process.

I will have a PGP encrypted file and a couple of PGP private keys dumped somewhere. Now I need to get the Key ID from the file to pick the right key. I'd have to query my data source to get the correct key by ID/Fingerprint and doing it inside that event is kind of awkward.
Posted: 06/05/2014 03:37:24
by Vsevolod Ievgiienko (Team)

Thank you for contacting us.

You can put all available keys to an instance of TElPGPKeyring and then assign it to TElPGPReader.DecryptingKeys property. This way TElPGPReader will choose the right key during decryption process automatically.
Posted: 10/08/2015 11:13:00
by Brian Coleman (Basic support level)
Joined: 10/08/2015
Posts: 1

We are having a similar issue. However, we have different PassPhrases depending on which key is used. Is there a way for us to get the key that was used for encryption so that we use the correct PassPhrase to decrypt the file. Just to be clear, each key will have their own distinct PassPhrase. We would need to know which key is going to be used so that the corresponding PassPhrase is passed into the PGPReader.

Is there a way to get that information before attempting to decrypt?
Posted: 10/08/2015 11:26:06
by Eugene Mayevski (Team)

You can set the passphrase of the key in the key object itself. That would be more handy.

Please let me know if this answers your question.

Sincerely yours
Eugene Mayevski
Posted: 10/08/2015 14:26:22
by Ken Ivanov (Team)


You can do that by hooking on TElPGPReader.OnEncrypted event and starting decrypting the file with DecryptAndVerify() method. Once key information has been read from the encrypted file, the OnEncrypted event will fire, providing you with the key IDs of all the keys involved.




Topic viewed 2384 times

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


Back to top

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

Got it!