refactor CryptoHandler