cdecrypt Function (ROM Call 0x127)

rsa.h

void cdecrypt (BN *dest, char *src, unsigned long size, BN *public_key);

Decrypt a message.

cdecrypt decrypts the message pointed to by src which is size butes long using the public key pointed to by public_key, and stores decrypted message in BN structure pointed to by dest (see BN for more info about how RSA works). Note that the message must be short enough to be decrypted in the structure pointed to by dest, because BN structure is maximally 255 bytes long.

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 BN_power17Mod. Generally, for usage in RSA, N must be equal to P * Q, where P and Q are large primes, and where (P-1) * (Q-1) is relatively prime to 17 (other part of the key).


Uses: BN_power17Mod, memcpy