[Main]
Name=cdecrypt
Type=Function
Subtype=ROM Call
Header Files=rsa.h
Definition=void cdecrypt (BN *dest, char *src, unsigned long size, BN *public_key);

[ROM Call]
Index=$127

[Description]
Decrypt a message.

[Explanation]
cdecrypt decrypts the message pointed to by <I>src</I> which is <I>size</I> butes long using
the public key pointed to by <I>public_key</I>, and stores decrypted message in
<A HREF="$$LINK(BN)">BN</A> structure pointed to by <I>dest</I> (see <A HREF="$$LINK(BN)">BN</A> for more info
about how RSA works). Note that the message must be short enough to be decrypted in
the structure pointed to by <I>dest</I>, because <A HREF="$$LINK(BN)">BN</A> structure is maximally
255 bytes long.
<BR><BR>
TIOS use decryption with public key (N,17) where N is a 512-bit (64-byte) key,
given at the beginning of the certificate code, although others may (or may not) be used.
That's why it uses <A HREF="$$LINK(BN_power17Mod)">BN_power17Mod</A>. Generally, for usage in RSA,
N must be equal to P&nbsp;*&nbsp;Q, where P and Q are large primes, and
where (P-1)&nbsp;*&nbsp;(Q-1) is relatively prime to 17 (other part of the key).

[References]
Out=BN_power17Mod, mem.h/memcpy
