fixes to key password handling

refactoring of the code using ask_key_password for better support
of dev-mode password supplied from CLI. This also fixes all uses of
passwd command to change a key's password.
setkey now works also in dev-mode

includes some minor code refactoring mostly around setkey
test suite updated