A long time ago, I believe I altered muscleTool's void doCrypt() method. You can do the same to invoke encrypt/decrypt cipher modes across the interface. See below.

In my modifications, I altered the sign feature, to invoke the applet's use of PKCS#1 padding, rather than use "block encryption using the private key transform." I don't recall if the removal of the hex2bin formatter on the in/out stream was me, or was there in the CVS source. The formatter hows - in any case - where you can apply additional processing, before and after the RSA decryption (using private key) operation.

If you use the existing "sign" function in its original muscle form (with RSA_RAW), and you first format your plaintext in an OAEP wrapper, you have block encipherment exploiting randomness properties of the wrapping oracle. Remember to keep the public key a secret, in such a mechanism.

This is the converse of the process specified in the documented cited below. Using RSA decryption as an enciphering function over an RSA_RAW block (using the private-key transform) may subject you to professional censure, note; so, be warned! But you get the idea. Go alter the code - to suit project requirements.

citation: ftp://ftp.rsasecurity.com/pub/rsalabs/rsa_algorithm/rsa-oaep_spec.pdf



"  if(strcmp(arg3, "sign") ==0 )
  cipherDir = (MSCUChar8)1;
 else if(strcmp(arg3, "verify") ==0 )
  cipherDir = (MSCUChar8)2;
 else {
   printf("ERR: Invalid Use: crypt [keynum] [sign/verify]\n");
   return;
 }
 //inDataSize = hexToBin(hexString, inCryptData);

 rv = MSCGetKeyAttributes( pConnection, (MSCUChar8)keyNum, &keyInfo );
 CHECK_ERR(rv != MSC_SUCCESS, "GetKeyAttributes Failed !");

 keySize = keyInfo.keySize / 8;

 cryptInit.keyNum = (MSCUChar8)keyNum;
#if 0
 cryptInit.cipherMode = MSC_MODE_RSA_NOPAD;
#else
 cryptInit.cipherMode = MSC_MODE_RSA_PAD_PKCS1
;
#endif
 cryptInit.cipherDirection = cipherDir;
 cryptInit.optParams = 0;
 cryptInit.optParamsSize = 0;

 //padData(inCryptData, inDataSize, keySize);
 //inDataSize = outDataSize = keySize;

 //binToHex(inCryptData, inDataSize, outCryptData);

 rv = MSCComputeCrypt( pConnection, &cryptInit,
  inCryptData, inDataSize,
  outCryptData, &outDataSize);


----- Original Message ----- From: "vsingh" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, March 12, 2005 12:39 AM
Subject: [Muscle] Encryption /Signature in muscle tool



Hi All!
can any one please help me with this problem:
i am using muscle tool provided with muscleframework 1.1.3.
there is an option of performimg a "Crypt" function in muscle tool.can anyone tell me is that a function for "Encryption" or "Signature" using Private key.
one more thing:Which "mode" and "padding" is being used by RSA in this case for performing this Crypt function.
please help me if anyone is aware of it.
thanks
vigya


_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to