1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META http-equiv="Content-Style-Type" content="text/css">
6<TITLE>NWC24SetDlKeys</TITLE>
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<LINK rel="stylesheet" type="text/css" href="../nwc24.css">
9</HEAD>
10<BODY>
11<H1>NWC24SetDlKeys</H1>
12
13<H2>Syntax</H2>
14<DL>
15  <DD><PRE><CODE>#include &lt;revolution/nwc24.h&gt;</CODE></PRE>
16  <DD><PRE><CODE>#define NWC24_DL_PUBLICKEY_LENGTH               (2048 / 8)
17#define NWC24_DL_SECRETKEY_LENGTH               (128 / 8)
18
19<A HREF="../Types/NWC24Err.html">NWC24Err</A> NWC24SetDlKeys( const u8 <VAR>publicKey[NWC24_DL_PUBLICKEY_LENGTH]</VAR>, const u8 <VAR>secretKey[NWC24_DL_SECRETKEY_LENGTH]</VAR> );</CODE></PRE>
20</DL>
21
22<H2>Description</H2>
23<P>
24Specifies the RSA public key that the application will use for signature verification as well as the AES shared key for decryption. The specified key will not be used merely by calling this function. Use the <A href="NWC24SetDlFlags.html"><CODE>NWC24SetDlFlags</CODE></A> function to enable specified keys for use.
25</P>
26<P>
27A check must be made using the <CODE>NANDCheck</CODE> function in order to create the file (wc24pubk.mod) that contains a key to the home directory when executing for the first time.<BR>The key file consumes 1 FS block and 1 i-node.
28</P>
29<P>
30If a key has already been set (the key file exists), it will be overwritten by a new key. Only one public key and shared key can be set per one application.
31</P>
32<P>
33To delete a key file, use the <A href="NWC24ClearDlKeys.html"><CODE>NWC24ClearDlKeys</CODE></A> function. Key files are handled in the same way as save data. They will not automatically be deleted, even if tasks have been cleared.
34</P>
35
36
37<H2>Arguments</H2>
38<TABLE border="1" cellpadding="3" cellspacing="0.1" class="argument">
39  <TR>
40    <TD class="name"><code><VAR>publicKey</VAR></code></TD>
41    <TD class="description">
42Specifies the public key for the application. Do not directly specify in ASN.1 format. Rather, use only the 2048-bit public coefficient portion. (Takes the ASN.1 format if created with OpenSSL.)<BR>If <CODE>NULL</CODE> is specified, the contents are zeroed out.
43    </TD>
44  </TR>
45  <TR>
46    <TD class="name"><code><VAR>secretKey</VAR></code></TD>
47    <TD class="description">
48Specifies the shared secret key for the application. Specify <CODE>NULL</CODE> to zero-clear its contents.
49    </TD>
50  </TR>
51</TABLE>
52
53<h2>Return Values</h2>
54<P>
55<code>NWC24_OK</code>: Ended normally.<BR> <code>NWC24_ERR_LIB_NOT_OPENED</code>: The library has not been opened.<BR> <code>NWC24_ERR_FILE_*</code>: Error related to internal file operations.<BR> <code>NWC24_ERR_FATAL</code>: A fatal error has occurred.<BR>
56</P>
57
58<H2>See Also</H2>
59<P>
60<A href="NWC24SetDlFlags.html"><CODE>NWC24SetDlFlags</CODE></A>, <A href="NWC24ClearDlKeys.html"><CODE>NWC24ClearDlKeys</CODE></A>
61</P>
62
63<H2>Revision History</H2>
64<P>
652008/08/20 Added indication that there is one key per application, and that it is not automatically deleted. <BR> 2007/12/21 Corrected mistake in function declaration. <BR> 2007/07/13 Initial version
66</P>
67
68<hr><p>CONFIDENTIAL</p></body>
69</HTML>