EDIT: this patch is for version 0.3.20 and isn't updated anymore. It is incorporated in my showwallet
branch. See this thread for more information: http://forum.bitcoin.org/index.php?topic=3906.0
after working Hal's challenge to import a private key into a wallet last week, I created a patch for bitcoin which adds 2 new RPC commands:
* dumpprivkey <bitcoinaddress> reveals the private key corresponding to the given address (if known)
* importprivkey <bitcoinprivkey> adds a private key to the wallet.
The format is similar to that of addresses, but:
* contains the 256-bit private key instead of a 160-bit hash of a public key (resulting in 51-character strings)
* uses version byte 128 (239 for testnet) instead of 0 (111 for testnet)
This is not the same format as used by Hal initially (adds version number and checksum, but I think these are useful properties).
importprivkey will perform a rescan of the block chain after adding the key, to discover transactions based on it.
dumpprivkey does not delete a key from the wallet though, so it is not really intended as a way of moving funds from one client to another, but it's a first step towards making handling private keys more accessible.