move self_sign to Certificate
self sign certificate test
tidy
don't write password file if password is not defined
fix scope