gpgkey2bc: Generating address of Bitcoin from public key
NIIBE Yutaka
gniibe at fsij.org
Thu Jan 16 08:48:36 CET 2014
Hello,
Attached 'gpgkey2bc.py'.
Few people use OpenPGP key for OpenSSH, but I think that this is very
useful feature of GnuPG. There is a command 'gpgkey2ssh' to convert
OpenPGP key to SSH key.
Likewise, I write 'gpgkey2bc.py' to convert OpenPGP key to Bitcoin
address. This requires Python 3.2 or later, and the key should be
a subkey of secp256k1.
After getting my public key on keyserver, you can get my Bitcoin's
address by:
$ python3.3 gpgkey2bc.py 975B9053
No, I haven't had wallet yet. You could give me some pressure by
sending some Satoshi to my address. :-p
Here is a session creating a subkey of secp256k1.
====================================
$ gpg2 --version
gpg (GnuPG) 2.1.0-beta285
libgcrypt 1.7.0-beta31
NOTE: THIS IS A DEVELOPMENT VERSION!
It is only intended for test purposes and should NOT be
used in a production environment or with production keys!
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECC, ECC
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES128, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
$ gpg2 --expert --edit-key 4ca7babe
@GPG@ (@GNUPG@) 2.1.0-beta285; Copyright (C) 2012 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gpg: NOTE: THIS IS A DEVELOPMENT VERSION!
gpg: It is only intended for test purposes and should NOT be
gpg: used in a production environment or with production keys!
Secret key is available.
pub 2048R/4CA7BABE created: 2010-10-15 expires: never usage: SC
trust: ultimate validity: ultimate
sub 2048R/084239CF created: 2010-10-15 expires: never usage: E
sub 2048R/5BB065DC created: 2010-10-22 expires: never usage: A
[ultimate] (1). NIIBE Yutaka <gniibe at fsij.org>
[ultimate] (2) NIIBE Yutaka <gniibe at debian.org>
gpg> addkey
Please select what kind of key you want:
(3) DSA (sign only)
(4) RSA (sign only)
(5) Elgamal (encrypt only)
(6) RSA (encrypt only)
(7) DSA (set your own capabilities)
(8) RSA (set your own capabilities)
(10) ECDSA (sign only)
(11) ECDSA (set your own capabilities)
(12) ECDH (encrypt only)
(13) Existing key
Your selection? 11
Possible actions for a ECC key: Sign Authenticate
Current allowed actions: Sign
(S) Toggle the sign capability
(A) Toggle the authenticate capability
(Q) Finished
Your selection? a
Possible actions for a ECC key: Sign Authenticate
Current allowed actions: Sign Authenticate
(S) Toggle the sign capability
(A) Toggle the authenticate capability
(Q) Finished
Your selection? q
Please select which elliptic curve you want:
(1) Curve 25519
(2) NIST P-256
(3) NIST P-384
(4) NIST P-521
(5) Brainpool P-256
(6) Brainpool P-384
(7) Brainpool P-512
(8) secp256k1
Your selection? 8
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y
Really create? (y/N) y
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
pub 2048R/4CA7BABE created: 2010-10-15 expires: never usage: SC
trust: ultimate validity: ultimate
sub 2048R/084239CF created: 2010-10-15 expires: never usage: E
sub 2048R/5BB065DC created: 2010-10-22 expires: never usage: A
sub 256E/975B9053 created: 2014-01-16 expires: never usage: SA
[ultimate] (1). NIIBE Yutaka <gniibe at fsij.org>
[ultimate] (2) NIIBE Yutaka <gniibe at debian.org>
gpg> quit
Save changes? (y/N) y
$
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gpgkey2bc.py
Type: text/x-python
Size: 1895 bytes
Desc: not available
URL: </pipermail/attachments/20140116/59b2d866/attachment.py>
More information about the Gnupg-devel
mailing list