Beispiel #1
0
        public void CanDecryptCiphertextFromPython()
        {
            // generated with python
            string password      = "******";
            string b64CipherText = "Gup4moWGF4RRcyPUErUuctQE2MlgH7hHIiy0+gxNT3Mc+Ktax/t25W47Lk4jOJt0QT8W2LhkwH8qg28qZ2bM0XozLEIPZe/mi9BuryrMJX8=";
            var    plaintext     = Cryptor.DecryptWithPassword(b64CipherText, password);

            Assert.True(plaintext == "poops");
        }
Beispiel #2
0
        public async Task <byte[]> GetIntermediateKey(string password)
        {
            if (_uiConfig.HasIntermediateKey)
            {
                // throws if it fails
                string encIKeyString = await _hsm.GetAsync(I_KEY_LOC);

                byte[] encIKey = Convert.FromBase64String(encIKeyString);
                byte[] iKey    = AesThenHmac.DecryptWithPassword(encIKey, password);
                return(iKey);
            }
            return(null);
        }