예제 #1
0
        /// <summary>
        /// Creates the NEP6Account with private key.
        /// </summary>
        /// <returns>The NEP6Account</returns>
        /// <param name="privateKey">Private key.</param>
        private NEP6Account CreateAccountWithPrivateKey(byte[] privateKey, SecureString passphrase, string label = null)
        {
            var publicKeyInBytes   = Crypto.Default.ComputePublicKey(privateKey, true);
            var publicKeyInEcPoint = new ECPoint(publicKeyInBytes);
            var contract           = ContractFactory.CreateSinglePublicKeyRedeemContract(publicKeyInEcPoint);

            var account = new NEP6Account(contract)
            {
                Label = label
            };

            account.Key = _walletHelper.EncryptWif(privateKey, passphrase);
            UnlockAccount(account.Key, publicKeyInEcPoint, privateKey);
            return(account);
        }
예제 #2
0
 /// <inheritdoc />
 public string EncryptNep2(byte[] privateKey, SecureString keyPassword)
 {
     return(_walletHelper.EncryptWif(privateKey, keyPassword));
 }