Cryptography Reference
In-Depth Information
BigInteger eSender,
BigInteger nSender) {
return RSADecipherWSalt(RSADecipherWSalt(msg,dRecip,nRecip),eSender,nSender);
}
Of course, the variables eSender , dSender , and nSender refer to the message sender's
key information, while eRecip , dRecip , and nRecip refers to the recipient's keys. Note that
neither the sender nor the recipient needs to know the other's private info for message
exchange. Also, note that enciphering is an application of RSAEncipher() twice , first using
the sender's private exponent, then using the recipient's public exponent. It is done this way
so that padding and blocking issues will be handled correctly. Because of the symmetric
nature of the RSA enciphering and deciphering transformations, this works. Likewise, deci-
phering involves applying RSADecipher() twice with different exponents. You will find that
writing methods to sign using other algorithms won't be quite so easy.
Following is the output of a simple console program TestRSACipherSigned. The code
can be found on the topic's website:
Plaintext message:
Little Willy Willy won't GO HOME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Sender's keys:
n=47782317390949840599719361406282787031971169706340889205910600511651090
1324842762783453285232353074783464254995516764280738329563279965438228948
9280441812866482827362912397521119899724567407854726573606946785783804821
1490867893827447459512197749446350191839654657188532964841056340856133204
8607351598198101709
e=83312974644643859903267946834708159485647858625179212485115616222287237
1938788281455011764149010812987977689838516046837523319281290153766339312
0677513551158027200673951042206830189406463160246696648959448501005242846
6888908193934245905541876379902315861267261663565682552051628101445975498
10696099572097327
d=46848389164242330225071449666604637411224713799115112040609272701499826
8502130258770328850822705030787904612308076555045283496664108139377795438
1875804833671832013034092429080034687115183115320067520484468472483902330
5828867419996923021611059513161144563449042171090062883791376144836807314
5108476860945640143
Recipient's keys:
n=40030064890131045556164143906639977210278139426559384091698962934025781
2870529067795493232933422841793524046547588390029559846808892299192424339
2777303590896263511254432673090184816373225509026440453562416752000207951
Search WWH ::




Custom Search