key manager refactory, more stable.
only one feature left: some one did not have public key