Download Java Card Development Kit User's Guide, Version 2.2.2

Transcript
2.The sign method returns an indication to the user of the portion of the message
that was included as padding in the signature. This is required so that the user
knows what remaining data must still be sent along with the signature block.
Verifying
1.The user initializes the signature object with signature at the very beginning so it
can get the recoverable data at the earliest.
2.The user invokes a combination of the update and verify methods to verify the
signature based on the message data provided by the user.
3.The verify method verifies the signature by comparing the accumulated hash with
the hash in the message representative recovered during initialization.
Sample Application
This demo consists of two scripts representing two scenarios for Signature with
Message Recovery. The first script, sigMsgFullRec.scr, shows the scenario in
which the message to sign is small enough that the entire message itself becomes
part of the signature padding (hence the name “Full Recovery” since you can
recover the full message from the signature itself). The second script,
sigMsgPartRec.scr, demonstrates the scenario in which the message to sign is
large enough that only some part of it is included in the signature padding (hence
the name “Partial Recovery”). The scenarios are detailed below:
sigMsgFullRec.scr Script
The sequence of events resulting from running this script are:
1. The script sends to the sample application a small message to sign.
2. The application initializes the signature object with the algorithm
Signature.ALG_RSA_SHA_ISO9796_MR and signs the message. Because the
message is small enough, the application returns the signature data to the script.
3. The script then simulates the verification phase in which it sends the signature
data to the sample application asking it to verify the message.
The application recovers the original message from the signature data and also
verifies the signature, then returns the original data back to the script. (If the
signature verification fails, it returns an error code).
46
Development Kit User’s Guide, Java Card Platform, Version 2.2.2 • March 2006