Esempio n. 1
0
        public void Test_KeyStore()
        {
            Random random = new Random();

            byte[] passwordBytes = new byte[random.Next() % 256];
            random.NextBytes(passwordBytes);
            string password = Convert.ToBase64String(passwordBytes);

            PrivateKey      privateKey = PrivateKey.Random();
            ExternalAddress address    = Addresser.Create(privateKey);

            KeyStore keyStore = KeyStore.Create(privateKey, address);
            string   fileName = keyStore.Store(password);

            keyStore = KeyStore.Load(password, fileName);

            File.Delete(fileName);

            Assert.AreEqual(privateKey, keyStore.PrivateKey);
            Assert.AreEqual(address, keyStore.Address);
        }