export-a-crypto-system-sig

This is a perl program which implements RSA encryption and decryption, and is small enough to use as a signature file:
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1 lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

Software required, compatibility

To use you will need perl, and dc.

Some older versions of dc don't work, if you have problems with larger keys try getting GNU dc. If you have a SUN you will need GNU dc as the versions of dc distributed with SUN O/S, and Solaris don't seem to work.

Using

To test, save it as "rsa" then try:
% chmod 700 rsa
% echo "squeamish ossifrage" | rsa -k=10001 -n=1967cb529 > msg.rsa
% rsa -d -k=ac363601 -n=1967cb529 < msg.rsa
Here are few keys to try it out with, while its not as fast as PGP it has usable performance even for large keys

8bits:

e=11
d=ac1
n=ca1

32 bits:

e=10001
d=ac363601
n=1967cb529

128 bits:

e=10001
d=135b03530e94874283f0f0000ffff0001
n=24000c6c9620886831124848640044901

512 bits:

e=10001

d=62a03c0df0b96335047a12923a7d20bc2b7bb07c59aba2c4b094fc7d54392e8a2e7606cb
5d574407640f4bb4e0ea6aeb7fff0000ffff0000ffff0000ffff0001

n=12004001208404a43f00502200b204602600c00001da894922433e4601a2c85024024001
418004602404240109301008140000000142404002010000000000001
It is possible to use this program with your PGP keys, heres my PGP public key expressed as hex numbers suitable for perl-rsa (and heres a perl program to extract your PGP public keys), send me some RSA encrypted mail!

1024 bits:

e = 13
d = (with-held for obvious reasons)
n = b487306fc179f3bd5e55a9e7c5737722dc97ec4326838b67de814638214988cd90416f
f55fee783c32aacc55f2b90c073c69344f5a4d9a6fb3f90770ffe6a78084bbae3f2c77fe14
b70e0db894b063e01f91e169591ec2b5da7bf2a0427b7bd77bfa97129e9cfe10768b919f05
728e7484949bf29de83b6a9fe7f36ea2de58b5
Send me some mail by doing:
% rsa -k=[e] -n=[n] | uuencode "filename" | mail -s "subject" adam@cypherspace.org
ie, cut and paste this into your unix shell:
rsa -k=13 -n=b487306fc179f3bd5e55a9e7c5737722dc97ec4326838b67de814638214988cd
90416ff55fee783c32aacc55f2b90c073c69344f5a4d9a6fb3f90770ffe6a78084bbae3f2c
77fe14b70e0db894b063e01f91e169591ec2b5da7bf2a0427b7bd77bfa97129e9cfe10768b
919f05728e7484949bf29de83b6a9fe7f36ea2de58b5 | 
uuencode "perl-rsa-mail" | mail -s "rsa mail" adam@cypherspace.org
Then type the body of your message, and press ^D TWICE when you have finished composing your message. Heres my PGP public key in more conventional PGP format.

If you know perl or dc and can see any way to shorten the code please tell me, I'd really like to reduce its size as much as possible, heres the story at the moment.


Comments, html bugs to me (Adam Back) at <adam@cypherspace.org>