|
There are two padding functions: (a) to format the
fixed-sized RSA block, and (b) to present the input data (to be signed) as
a suitable stream, with a format specific to the crypto-level
process.
(b) is performed by the host seeking to externally
authenticate, as required by the choice of strong authentication scheme. When
do_crypt uses RSA, this stream formatting padding function is not required: the
hash function associated with an hash+RSA signature process has its own means of
creating a known stream size and content. If do_crypt() was using DES_CBC_MAC -
as perhaps it was originally programmed to do, in the 2000 time frame (?),
then the CBC process would require that the in stream should be padded, using a
standard scheme (e.g. that in Global Platforms/.NET's scheme)
(a) is performed by the card, when preparing for
RSA-decrypt(). Its specific to safe use of the RSA math, having nothing to do
with the input stream formatting. When the card should perform no such block
formatting, we specify RSA_RAW: this assume the host will prepare the RSA block,
itself. It doesnt mean there is a absence of block formatting in the use of RSA:
it simply means that the card should assume some other actor performed the
necessary work.
Now, you understand the processes, perhaps use the
original Muscle source code, not my hacked version. its parameters are
probably tuned carefully for the applications, and the cards that are actually
supported. I have my own applications, and my own card: so I'm not the average
use case.
As its open source, you change the source to suit
your requirements, as you wish. If you wish to avoid hex formatting the octet
results, you just remove the code...! You can pipe the results into the
formatter of choice, then, in an outer script.
Peter.
----- Original Message -----
Sent: Sunday, March 13, 2005 9:14
PM
Subject: Re: Re: [Muscle] Encryption
/Signature in muscle tool
Dear sir, thanks a lot for your
suggestion.it was of great help. but i further want some favour fron you
regarding the same. that muscletool program, docrypt function, is in
one line showing it is not using any padding cryptInit.cipherMode =
MSC_MODE_RSA_NOPAD; and then in next line it is using a function
: padData(inCryptData, inDataSize, keySize); i am not able to find this
paddata function so that i can modify the program according to my
requirement. is it using some padding or mode or not.i just want to use RSA
with no padding. Moreover i want to remove bintohex format in my output and
want bintobytes format as output i.e. output in bytes format. Kindly
tell me what changes i need to do in my program to suit these two
requirements. i would not like to alter the process ,as it given in the
program i.e.encryption using privatekey. i will be very thankful if you can
help me with these problems. thanks and regards vigya -- Original
Message -- From: "Peter Williams" <[EMAIL PROTECTED]> To: "MUSCLE"
<[email protected]> Date: Sat, 12 Mar 2005 08:34:33
-0800 Subject: Re: [Muscle] Encryption /Signature in muscle tool 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_specpdf > > > >" 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 >
-------------------------------------------- Email in Indian languages. This mail has been sent to you
from http://webmail.idrbt.ac.in <
DISCLAIMER: This message is intended solely for the individual or entity
to which it is addressed.This communication may contain information that is
proprietary, privileged or confidential and otherwise legally exempt from
disclosure. If you are not the named addressee,or have been inadvertently
referenced in the address line, you are not authorized to read, print, retain,
copy or disseminate this message or any part of it.If you have received this
message in error, please notify the sender immediately by e-mail and delete
all copies of the message.Visit us at http://www.idrbt.ac.in./BODY>
_______________________________________________ Muscle mailing
list [email protected] http://lists.drizzle.com/mailman/listinfo/muscle
|