[cryptography] preventing protocol failings