gpg --output keys.pgp --dearmor keys.asc
== <EOF> ==
Disastry http://i.am/disastry/
http://disastry.dhs.org/pgp <----PGP plugins for Netscape and MDaemon
^--GPG for Win32 (supports loadable modules and IDEA)
^----PGP 2.6.3ia-multi05 (supports IDEA, CAST5, BLOWFISH, TWOFISH,
AES, 3DES ciphers and MD5, SHA1, RIPEMD160, SHA2 hashes)
-----BEGIN PGP SIGNATURE-----
Version: Netscape PGP half-Plugin 0.14 by Disastry / PGPsdk v1.7.1
iQA/AwUBO8PTnzBaTVEuJQxkEQPooACgsT9+9tqng9xZEB2hgEs6ui4LymAAoKKn
5NBQ/xTfey4ZuCSo1wr1TDP6
=QPtn
-----END PGP SIGNATURE-----
gpg --output keys.pgp --dearmor keys.asc
Perhaps I was not overly clear in my original message - I am looking for a
way to _programatically_ convert a key. Or make sense of the the
pubring,pkr & secring.skr files. Are you inferring that I take a look at
the gpg source code? I would rather have a format specification on both the
file formats and the [binary] key format.
P.S. I am assuming that the command you suggested will output all keys into
a binary file (keys.pgp). This would again not be of much use since I don't
know the format of the file and I wouldn't know where one key ends and the
other begins. I am mostly concerned with Win32 platforms, and with private
keys (storing them onto a removable device that is spacelimited). So, I
need a way to convert the output of PGP for windows exporting a key
(currently only to base-64 ASCII format) to binary, to optimize storage
space. As it's been suggested elsewhere, I could just hack it myself and
pack 4 base-64 characters into 3 bytes, but I am wondering if there is a
better way.
Duke wrote:
> <disa...@hackserv.saiknes.lv> wrote in message
> news:3BC3EFDC...@saiknes.lv.NO.SPaM.NET...
> > gpg --output keys.pgp --dearmor keys.asc
>
> Perhaps I was not overly clear in my original message - I am looking for a
> way to _programatically_ convert a key.
I see...
it's BASE64 encoded, it shouldn't be hard to find how to decode it,
or even ready made functions for that.
> Or make sense of the the pubring,pkr & secring.skr files.
> Are you inferring that I take a look at the gpg source code?
you can do, but thats probably not the easiest way..
> I would rather have a format specification on both the
> file formats and the [binary] key format.
see RFC 2440
> P.S. I am assuming that the command you suggested will output all keys into
> a binary file (keys.pgp). This would again not be of much use since I don't
> know the format of the file
see RFC 2440
> and I wouldn't know where one key ends and the
> other begins. I am mostly concerned with Win32 platforms, and with private
> keys (storing them onto a removable device that is spacelimited). So, I
> need a way to convert the output of PGP for windows exporting a key
> (currently only to base-64 ASCII format) to binary, to optimize storage
> space. As it's been suggested elsewhere, I could just hack it myself and
> pack 4 base-64 characters into 3 bytes, but I am wondering if there is a
> better way.
it's not only best, but only way.
and you'll probaly want to remove signatures (and
maybe even user-ids) from key so that it is smaller..
== <EOF> ==
Disastry http://i.am/disastry/
http://disastry.dhs.org/pgp <----PGP plugins for Netscape and MDaemon
^--GPG for Win32 (supports loadable modules and IDEA)
^----PGP 2.6.3ia-multi05 (supports IDEA, CAST5, BLOWFISH, TWOFISH,
AES, 3DES ciphers and MD5, SHA1, RIPEMD160, SHA2 hashes)
-----BEGIN PGP SIGNATURE-----
Version: Netscape PGP half-Plugin 0.14 by Disastry / PGPsdk v1.7.1
iQA/AwUBO8UZ+DBaTVEuJQxkEQOyEQCg5asM7iH40kbEKO2g+w4bGvSvI0YAoMZD
oZT+0vyloN4keJIRePeEdvc0
=yQ65
-----END PGP SIGNATURE-----
U da man! I'm working with it right now.
Funny how even PGP 7.0.3 uses what GPG calls 'Old format' packet headers ;)
Duke wrote:
> > > I would rather have a format specification on both the
> > > file formats and the [binary] key format.
> >
> > see RFC 2440
>
> U da man! I'm working with it right now.
>
> Funny how even PGP 7.0.3 uses what GPG calls 'Old format' packet headers ;)
and even GPG does ;)
'old' not always means 'bad' :)
__
Disastry http://disastry.dhs.org/
http://disastry.dhs.org/pgp <----PGP plugins for Netscape and MDaemon
^--GPG for Win32 (supports loadable modules and IDEA)
^----PGP 2.6.3ia-multi05 (supports IDEA, CAST5, BLOWFISH, TWOFISH,
AES, 3DES ciphers and MD5, SHA1, RIPEMD160, SHA2 hashes)
-----BEGIN PGP SIGNATURE-----
Version: Netscape PGP half-Plugin 0.14 by Disastry / PGPsdk v1.7.1
iQA/AwUBO8b+MzBaTVEuJQxkEQPRxgCfTH0YJ/C0RHPGzP9XU4zRdZiqKRwAn2ke
LgziNdFi+m/+gxWWc+R++jyB
=jQJb
-----END PGP SIGNATURE-----
95 = 10010101 which tells me this is an old format header, private key
packet, 2-octet length follows.
Then from the RFC:
---
3.1 Scalar numbers
Scalar numbers are unsigned, and are always stored in big-endian format.
---
AND
---
4.2.2.2 Two-Octet Lengths
A two-octet Body Length header encodes a length of from 192 to 8383 octets.
It is recognized because its first octet is in the range 192 to 223. The
body length is equal to:
bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192
---
So, if this big-endian, 01 is MSB and CF LSB. However, this doesn't fly
when plugged into bodyLen = ((0x01 - 192) << 8) + (0xCF) + 192. It looks to
me like it's in little-endian format. If I plug it in little endian format,
I end up with 4033. But the file is larger than 4036 bytes (4033 + 3 byte
header).
Then onto byte 4037, which I assume to be the PTag of another header (this
is a DH/DSS key so 2 keys, right?):
C4 or 11000100
So, mixed Header types (first key old header format, new key new header
format???). RFC just says:
---
New format packets contain:
Bits 5-0 -- content tag
---
So how the heck do I know how many bytes follow encoding packet length???
Hopefully a kind soul who's been thru this can help me out. Once I get all
this sorted out I should be in business.
Duke wrote:
> First 3 bytes of my private key (hex):
> 95 01 CF
or get pgpdump, it will show all the packets
or do
gpg --list-packets file
it will also show packets
__
Disastry http://disastry.dhs.org/
http://disastry.dhs.org/pgp <----PGP plugins for Netscape and MDaemon
^--GPG for Win32 (supports loadable modules and IDEA)
^----PGP 2.6.3ia-multi05 (supports IDEA, CAST5, BLOWFISH, TWOFISH,
AES, 3DES ciphers and MD5, SHA1, RIPEMD160, SHA2 hashes)
-----BEGIN PGP SIGNATURE-----
Version: Netscape PGP half-Plugin 0.14 by Disastry / PGPsdk v1.7.1
iQA/AwUBO8cHeDBaTVEuJQxkEQMAOwCgjm/LW5SC0llIiqx/bqTVU0s764AAoMcK
73+2Os0y3PJzVVstw16kdknr
=P8eL
-----END PGP SIGNATURE-----
Duke wrote:
> First 3 bytes of my private key (hex):
> 95 01 CF
>
> 95 = 10010101 which tells me this is an old format header, private key
> packet, 2-octet length follows.
>
> Then from the RFC:
> ---
> 3.1 Scalar numbers
> Scalar numbers are unsigned, and are always stored in big-endian format.
> ---
> AND
> ---
> 4.2.2.2 Two-Octet Lengths
> A two-octet Body Length header encodes a length of from 192 to 8383 octets.
> It is recognized because its first octet is in the range 192 to 223. The
> body length is equal to:
>
> bodyLen = ((1st_octet - 192) << 8) + (2nd_octet) + 192
it is old packet so 4.2.1 aplies, not the 4.2.2.2
so bodyLen = 0x1CF = 463
> ---
> New format packets contain:
> Bits 5-0 -- content tag
it is old packet, tag = 0101 = 5 = Secret Key Packet
__
Disastry http://disastry.dhs.org/
http://disastry.dhs.org/pgp <----PGP plugins for Netscape and MDaemon
^--GPG for Win32 (supports loadable modules and IDEA)
^----PGP 2.6.3ia-multi05 (supports IDEA, CAST5, BLOWFISH, TWOFISH,
AES, 3DES ciphers and MD5, SHA1, RIPEMD160, SHA2 hashes)
-----BEGIN PGP SIGNATURE-----
Version: Netscape PGP half-Plugin 0.14 by Disastry / PGPsdk v1.7.1
iQA/AwUBO8cGxjBaTVEuJQxkEQOl3QCfdK29nGmdjiuKSgvZ9c5ejX9e+W8An1uR
jFyYf+bUlp1exStNyVi9JI84
=K741
-----END PGP SIGNATURE-----
Got it.
> or get pgpdump, it will show all the packets
Perfect!
Thx