Esempio n. 1
0
        private string DecryptPrivateKeyFromScryptKeystore(string scrypt_keystore, string password)
        {
            var keyStoreScryptService = new KeyStoreScryptService();
            var keyStore            = keyStoreScryptService.DeserializeKeyStoreFromJson(scrypt_keystore);
            var privateKeyDecrypted = keyStoreScryptService.DecryptKeyStore(password, keyStore);

            return(privateKeyDecrypted.ToHex());
        }
        public void ShouldDecryptScrypt_Kdf()
        {
            string password              = "******";
            string privateKey            = "7a28b5ba57c53603b0b07b56bba752f7784bf506fa95edc395f5cf6c7514fe9d";
            var    keyStoreScryptService = new KeyStoreScryptService();
            var    keyStore              = keyStoreScryptService.DeserializeKeyStoreFromJson(scryptKeyStoreDocument);
            var    privateKeyDecrypted   = keyStoreScryptService.DecryptKeyStore(password, keyStore);

            Assert.Equal(privateKey, privateKeyDecrypted.ToHex());
        }
        public void ShouldEncryptAndDecryptScrypt_Kdf()
        {
            string password              = "******";
            string privateKey            = "7a28b5ba57c53603b0b07b56bba752f7784bf506fa95edc395f5cf6c7514fe9d";
            string account               = "x";
            var    keyStoreScryptService = new KeyStoreScryptService();
            var    keyStoreJson          = keyStoreScryptService.EncryptAndGenerateKeyStoreAsJson(password, privateKey.HexToByteArray(), account);
            var    keyStore              = keyStoreScryptService.DeserializeKeyStoreFromJson(keyStoreJson);
            var    privateKeyDecrypted   = keyStoreScryptService.DecryptKeyStore(password, keyStore);

            Assert.Equal(privateKey, privateKeyDecrypted.ToHex());
        }
 public void ShouldDecryptScrypt_Kdf()
 {
     string password = "******";
     string privateKey = "7a28b5ba57c53603b0b07b56bba752f7784bf506fa95edc395f5cf6c7514fe9d";
     var keyStoreScryptService = new KeyStoreScryptService();
     var keyStore = keyStoreScryptService.DeserializeKeyStoreFromJson(scryptKeyStoreDocument);
     var privateKeyDecrypted = keyStoreScryptService.DecryptKeyStore(password, keyStore);
     Assert.Equal(privateKey, privateKeyDecrypted.ToHex());
 }
        public void ShouldEncryptAndDecryptScrypt_Kdf()
        {
            string password = "******";
            string privateKey = "7a28b5ba57c53603b0b07b56bba752f7784bf506fa95edc395f5cf6c7514fe9d";
            string account = "x";
            var keyStoreScryptService = new KeyStoreScryptService();
            var keyStoreJson = keyStoreScryptService.EncryptAndGenerateKeyStoreAsJson(password, privateKey.HexToByteArray(), account);
            var keyStore = keyStoreScryptService.DeserializeKeyStoreFromJson(keyStoreJson);
            var privateKeyDecrypted = keyStoreScryptService.DecryptKeyStore(password, keyStore);
            Assert.Equal(privateKey, privateKeyDecrypted.ToHex());

        }