Add options to lock and unlock keyring

Thanks Vinícius dos Santos Oliveira <vini.ipsmaker@gmail.com> for the
initial patch.