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

Sets the encryption key and IV directly&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
bool
SetKey(
    xref:wallet/CKeyingMaterial.adoc[CKeyingMaterial] const& new&lowbar;key,
    std::span&lt;unsigned char const&gt; new&lowbar;iv);
----

== Return Value

true if the key and IV were the expected sizes and were set&period;

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

[cols="1,4"]
|===
| Name| Description
| *new&lowbar;key*
| The key material to use&period;
| *new&lowbar;iv*
| The initialization vector to use&period;
|===


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