I know that PyWallet has a -dumpwallet but without using pywallet, how can I export all the addresses and privatekeys with the stock bitcoind?
Is there an API command that lists all addresses held by the wallet?
You could send the dumpprivkey JSON-RPC call to the client. It takes a single parameter of BitcoinAddress to reveal the private key for that specific address.
To export all private keys for all addresses, you would have to call listreceivedbyaddress to list the addresses and then call dumpprivkey for each.
Using bitcoin-qt for an interface:
is the command which will list all addresses in use. Run it in the debug console window from the 'Help/Debug Window' screen.
Then, apparently, you can dump all the private keys, but only one at a time, using dumpprivkey for each key.
Just go to your QT Wallet Console (Help -> Debug Window -> Console)
The command will export every of your private keys into that text file.
P/s: in case you have encrypted Wallet before you need run this command before run dumpwallet
walletpassphrase "your pass phrase" 600