The code for CardEdge (the javacard embodiment (see below), versus the oberthur
7816-4 version using interindustry commands) has the client signal the required signing
"mode" through the first byte of the ComputeCrypt PDU (in procedure "init").


Based on this, one can deduce the required algorithm, from the padding mode, as in
my code fragment. However, there appears to be no ability to indicate which
of the several alternative digest algorithms one might use, within the PKCS1 padding
mode.


In my own development work, given this constrain, i hard coded the signing algorithm to
be md5WithRSA, if one signals the PKCS1 type 1 padding mode for the rsa plaintext
under RSA.decrypt.


a) There is a need to allow a new CM_PAD_OAEP for the padding mode (to guard
against RSA ciphertext block attacks on the same plaintext under signing) and


b) a parallel need for a new byte to allow indication of alternative md2, Ripem160,
NSAsha, NSAsha1, NSAsha1-revised etc. digest algorithms.


Peter.

From ComputeCrypt():

case OP_INIT: ... byte ciph_mode = buffer[ISO7816.OFFSET_CDATA]; ciph_dir = buffer[(short) (ISO7816.OFFSET_CDATA + 1)]; byte ciph_alg_id;

...
           switch (ciph_dir) {
           case CD_SIGN:
           case CD_VERIFY:

               switch (key.getType()) {
               case KeyBuilder.TYPE_RSA_PUBLIC:
               case KeyBuilder.TYPE_RSA_PRIVATE:

                   if (ciph_mode == CM_RSA_PAD_PKCS1)
                       ciph_alg_id = Signature.ALG_RSA_MD5_PKCS1;
                   else if (ciph_mode == CM_RSA_NOPAD) {
                       ISOException.throwIt(SW_UNSUPPORTED_FEATURE);
                       return;
                   } else {
                       ISOException.throwIt(SW_INVALID_PARAMETER);
                       return;
                   }

_________________________________________________________________
Rethink your business approach for the new year with the helpful tips here. http://special.msn.com/bcentral/prep04.armx


_______________________________________________
Muscle mailing list
[EMAIL PROTECTED]
http://lists.musclecard.com/mailman/listinfo/muscle

Reply via email to