fixed issue #13 to handle encrypted and signed messages