EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Get Key ID from PGP encrypted file

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#29693
Posted: 06/05/2014 03:24:03
by Frank Munsberg (Standard support level)
Joined: 06/04/2009
Posts: 47

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

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.
#29694
Posted: 06/05/2014 03:37:24
by Vsevolod Ievgiienko (EldoS Corp.)

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.
#34681
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?
#34682
Posted: 10/08/2015 11:26:06
by Eugene Mayevski (EldoS Corp.)

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
#34689
Posted: 10/08/2015 14:26:22
by Ken Ivanov (EldoS Corp.)

Brian,

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.

Ken
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 1979 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!