[#wallet-EncryptSecret]
= xref:wallet.adoc[wallet]::EncryptSecret
:relfileprefix: ../
:mrdocs:

Encrypts a secret with the master key using the given IV&period;

== Synopsis

Declared in `&lt;wallet&sol;crypter&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
bool
EncryptSecret(
    xref:wallet/CKeyingMaterial.adoc[CKeyingMaterial] const& vMasterKey,
    xref:wallet/CKeyingMaterial.adoc[CKeyingMaterial] const& vchPlaintext,
    xref:uint256.adoc[uint256] const& nIV,
    std::vector&lt;unsigned char&gt;& vchCiphertext);
----

== Return Value

true if encryption succeeded&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *vMasterKey*
| The master key used as the encryption key&period;
| *vchPlaintext*
| The secret to encrypt&period;
| *nIV*
| Source of the initialization vector&period;
| *vchCiphertext*
| Receives the resulting ciphertext&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
