RSA Security 5.2.2 Projection Television User Manual


 
Chapter 2 Quick Start 25
Introductory Example
You may find it a useful exercise to compile and link this program. Also, it could also
be instructive to add some print statements. For instance, what are the values of
outputLenUpdate
and
outputLenFinal
?
While it is possible to print the
encryptedData
, it will not be an ASCII string it is not
any kind of string, because there is no
NULL-terminating character. The encrypted data
is binary data, so it may be more useful to print out the result byte-by-byte in hex-
ASCII strings. For an example of a function that does this, see the RSA_
PrintBuf()
routine in
samples/common/source/demoutil.c. In addition, note that when writing
Crypto-C output to (and reading it from) files, it is usually more useful (in some cases,
even necessary) to open the files in binary mode.
To run this exercise, first compile
introex.c and tstdlib.c. You can find makefiles in
the
samples/make directory. Then link the object files with bsafe.lib or the
equivalent platform-specific library.
if (encryptedData != NULL_PTR){
T_memset (encryptedData, 0, dataToEncryptLen);
T_free (encryptedData);
encryptedData = NULL_PTR;
}
} /* end main */