コード例 #1
0
        public void CanDecryptPrivateKey()
        {
            // password for nano produced simple wallet file
            var password = "******";

            // private key from nano produced wallet file
            var expectedPrivateKey = "9b4ed1b56be9e8106da2ef4fc681db0f9f4c22ccbad5f9bb9d3fbe68a1b20007";

            // encrypted private key from nano produced wallet file
            var encrypted = "590c675be30dc85d2512620b0526c5ddb6756adf98ebf827f7c124e9f115a81943b741d71de4397901cdb1b917bf1d65";

            // iv from nano produced wallet file
            var iv = "d590ab155351abdd9c511e8fb46ee7a9";

            var pass = CryptoUtils.DerivePassSha(password, 20);

            // Act:
            var decrypted = CryptoUtils.AesDecryptor(pass, iv.FromHex(), encrypted.FromHex()).ToHexLower();

            // Assert:
            Assert.AreEqual(expectedPrivateKey, decrypted);
        }