Anyway for anyone that is interested I've whipped up a little utility and a couple of scripts to accomplish this (for Windows).
Assuming you have GPG installed (with your public key in its keyring) create a dummy key-pair (I've used
sample@domain.com here) and give it the password "password".
First part is a simple tool (probably could just be a shell script in Linux) which firstly sends a hard-coded password to cout (the security of the GPG "from" should be irrelevant as it being used as a "send only" address) followed by the private key line it finds from cin (it is expecting its cin to be coming from "vanitygen"). The "address" line is output to a fixed filename ("x" in this source).
[x.cpp]
#include <string>
#include <fstream>
#include <iostream>
const char* const c_outfile = "x";
const char* const c_password = "password";
const char* const c_address_prefix = "Address: ";
const char* const c_privkey_prefix = "Privkey: ";
using namespace std;
int main( )
{
ofstream outf( c_outfile );
cout << c_password << endl;
string str, addr, privkey;
while( getline( cin, str ) )
{
if( str.find( c_address_prefix ) == 0 )
outf << str << '\n' << endl;
else if( str.find( c_privkey_prefix ) == 0 )
cout << str << endl;
}
}
The second part is a batch file you call in order to create a new bitcoin address (change Ian to your own GPG name):
@echo off
REM *** Use simple program to split out the private key for GPG encryption.
vanitygen 1 | x.exe | gpg --armor --recipient Ian --encrypt --sign --local-user sample@domain.com --batch --passphrase-fd 0 >y
copy /Y x + y z >nul
type z&del x y
REM *** Now rename the output file to the bitcoin address.
type z | find "Address: " > z.bat
cscript findrep.vbs z.bat "Address: " "ren z " >nul
call z.bat
del z.bat
The final part is the "findrep.vbs" tool (wouldn't be needed if using Linux):
Const ForReading = 1
Const ForWriting = 2
If Wscript.Arguments.Count > 2 Then
strFileName = Wscript.Arguments(0)
strOldText = Wscript.Arguments(1)
strNewText = Wscript.Arguments(2)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, strOldText, strNewText)
Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
objFile.WriteLine strNewText
objFile.Close
Else
Wscript.Echo "Usage: findrep <file> <findstr> <replace>"
Wscript.Quit
End If
So now to generate a new bitcoin address you just type "genaddr" at the command prompt. As well as displaying the address and the GPG encrypted private key it saves the output to a file which is the name of the address (which can be safely backed up anywhere).
The following a sample of the output:
Address: 16vKwvg61UycrbhygXokVNQE3CxMSx22r7
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.9 (MingW32)
hQEMA1cEJ0zSVDDtAQgAnagg9KrfhOlyZrSrItrQxB0IuoOnR8GmG0m4dXFYMCtY
2g4b1HEBhQ/xytGW+lon2LyRZpCoW5BAglW+NeFJ5Oev2c3XcBpVIDlwl9C4CsUJ
w7/dUzFzqwfyiyDl662Bq8rF0qzOyQoyaj629Wz2EeBslb7yVejkg6mylc6hiPZz
zTMxr4Qz4GByty5Qx1Z5X78h49zzeZHnm+22PoiP/5CjEZgX8LohIhyrmJnTRHDJ
47/nRE8j3w45/ozj73KVMyQ936IoxvhpiaoMwTp3UQ8cxdU4xaJBz6MOnjFJn5DV
G3/Td4YpvJuYtNRNOg9xRT5lq2x0/71mYxN+4hoItNLACwFJyFrjitExf6du3Xyy
CvT+kclF73xFGcAA+OLqbbeF1wRqqMxWrYPy2fAORua2B/iWPZgIkLNcCfLFZtL4
pABGG5DV0D+Dh+kyvDf03l2iFe3v1aedUKJ4UFnrBa7me/cQcZSnl5xknNBZD1PY
R5IY1rrBC6BJ+6DtffRREwlp3tLgECpVL/zSBUGqWx68tzOxSnuwubCd0Q1z61fq
L1wfDfjat052eB0xqM7x335LUvBbAKQJ5XxEaJ56CsJsQP4oU9EXcXZrvg2I
=A3f1
-----END PGP MESSAGE-----
When you decide to "redeem" the address simply use "gpg --decode" with the file to get the private key:
gpg: encrypted with 2048-bit RSA key, ID D25430ED, created 2012-03-25
"Ian Knowles <ian@ciyam.com>"
Privkey: 5K6X8kvffAUYewAnmAuGHLB4wAk4UH2aZ1NBHdBf2YyzkUqzqHH
gpg: Signature made 10/13/12 12:08:32 using DSA key ID 8C155FBD
gpg: Good signature from "Sample <sample@domain.com>"