コード例 #1
0
ファイル: Wallet.cs プロジェクト: moskv08/Bitcoin-Wallet
        /// <summary>
        ///  Decrypt the wallet
        /// </summary>
        /// <param name="walletFilePath"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        internal static Safe DecryptWallet(string walletFilePath, string password)
        {
            Safe output = null;

            try
            {
                /// Load safe with password
                output = Safe.Load(password, walletFilePath);
                Assertion.AssertCorrectNetwork(output.Network);
            }
            catch
            {
                throw new SecurityException("Invalid password, try again.");
            }

            if (output == null)
            {
                throw new Exception("Wallet could not be decrypted.");
            }

            return(output);
        }