An apparatus and method for ensuring data integrity of unauthenticated code is
provided. With the apparatus and method, a hash value of unauthenticated code is
embedded in associated automatically authenticated code. When the automatically
authenticated code is downloaded and executed, the automatically authenticated
code may require that the unauthenticated code also be downloaded for proper execution
of the automatically authenticated code on a particular client device. The unauthenticated
code can be downloaded and its integrity verified by generating a hash value of
the unauthenticated code and comparing the generated hash value to a hash value
embedded in the automatically authenticated code. If there is a match, the unauthenticated
code is verified. If there is not a match, the unauthenticated code has been corrupted
during transmission and is not verified. As a result, the unauthenticated code
is not used by the client device. The download of the unauthenticated code can
then be attempted again and the verification process repeated.