EldoS | Feel safer!

Software components for data protection, secure storage and transfer


Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 03/05/2008 16:36:00
by James Willis (Standard support level)
Joined: 03/05/2008
Posts: 3

I have scoured the files and i cannot find ANYTHING on how to use FindPublicKeyByID, or FindPublicKeyByFP?

I see the documentation, but how do you convert a STRING representation of a HEX value such as:
"E3FC889A" and get it into a byte array?

Ok, let me backup, i can get it into a byte array using VB.NET, but it doesn't match the ID in the keyring! Here is a snippet or two of code:
Private mdSawsOnOffFP() As Byte

private sub dosomething()
Dim encoder As New System.Text.UTF8Encoding

'Bytes don't match the KEY ID when stepping thru call later on to SBB
mdSawsOnOffFP = encoder.GetBytes("E3FC889A")

end sub

immediate window:
(0): 69
(1): 51
(2): 70
(3): 67
(4): 56
(5): 56
(6): 57
(7): 65

(0): 147
(1): 9
(2): 238
(3): 9
(4): 227
(5): 252
(6): 136
(7): 154

So, the question is: "How do i use the FING functions such as KEYID and FP when i have a string reprentation of each of the targeted KEYS i wish to use"?

Posted: 03/05/2008 16:51:22
by James Willis (Standard support level)
Joined: 03/05/2008
Posts: 3

Add to this. I am using GPA (GNU Privacy Assistant) which gives the string value in the format as specified. I used the EXAMPLE and it shows the numbers above when i step thru (plus displayed) it.

What up???
Posted: 03/06/2008 01:06:27
by Ken Ivanov (EldoS Corp.)

OpenPGP KeyID is a sequence of 8 bytes, which identifies a particular key or subkey. Most of existing OpenPGP implementations *display* KeyID's in shortened 4-byte form (the actual length of the underlying KeyID is 8 bytes though). I.e. the value "E3FC889" is not the complete KeyID, but only low 4 bytes of the actual value (you may notice that it stands for ­hex-encoded 227, 252, 136, 154 bytes of Me.keyring.PublicKeys(0)­.KeyID array).

SecureBlackbox searches the key only by full 8-byte KeyID's (as it is defined in the OpenPGP specification). So if you need to perform search by four lower bytes of the KeyID, you have to implement the necessary function yourself.
Posted: 03/06/2008 08:16:56
by James Willis (Standard support level)
Joined: 03/05/2008
Posts: 3

Many thanks. I figured that out late last night! I started by reading somebodys post on a GNUGP website about how the KEYID is actuall the last 8 bytes (16 characters) of the FINGERPRINT. How ingenious! Wish I would have read that little tidbit of info before my post in this forum...

I just made a keyid off of the fingerprint string by taking the last 16 characters of the string and then HEX-ENCODING it in a c# routine that I grabbed off an ASP.NET/VB.NET/C# website. Once it hashes it out into a BYTE array, SecureBlackBox FindPublicKeyByID and FindPublicKeyByFP work like a champ!

Now, the encryption is done, on to the application itself!

Thanks again for the quick reply...



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