[Cryptech Tech] Specifications and test vectors for RSA

Fredrik Thulin fredrik at thulin.net
Sat Dec 6 20:22:28 UTC 2014


On Friday, December 05, 2014 12:18:28 PM Joachim Strömbergson wrote:
> Aloha!
> 
> Rob Austein wrote:
> > Also, Joachim sends a plea for test vectors, which he has not been
> > able to find.   Given the part of RSA that he thinks he's doing,
> > this means: please supply sample input to the RSA process with
> > padding already done, along with the corresponding expected output
> > for a supplied RSA keypair.   Plan is to collect a few of these, put
> > them up for scrutiny to make sure we believe that they're correct,
> > then use them as test vectors for the Verilog code.
> 
> Yes, that would be very helpful. And if possible for 1024, 2048, 4096
> and possible even 8192 keys.
> 
> Basically:
> 
> Message (M)  = 0x...
> Exponent (e) = 0x...
> Modulus (n)  = 0x...
> Expected     = 0x...
> 
> Thanks for any help.

I hope this will get you started. cryptech.py is attached.

  $ git clone https://github.com/andrewdyates/rsa_x509_pem
  $ cd rsa_x509_pem
  $ cp /path/to/cryptech.py .

Then, run cryptech.py without an argument to get RSA-2048 output using the key 
found in keys/privkey_1_rsa_2048.pem, or with another PEM file as argument to 
use that one instead.

Since it is more suitable for e-mail, this is example output using the RSA-512 
bit key found in keys/. To be extra clear, this is NOT me saying we should 
support RSA-512 =).

$ python cryptech.py keys/privkey_1_rsa_512.pem
RSA 'n' is 
124259526778771587955159784219287810221844766997856404846255864035842250488610
14439743625969045650595758282225279051427267794450184247981252100167820225861L
RSA 'e' is 65537L
RSA 'd' is 
11013985856201598401384304843521108527682015525436743454108371060381275204667
94893042692856710197377869722575526312285076879224388940454204587468797665997L
RSA 'p' is 
107401053921562542502157416785660572554649150465443383856828210469099766162107L
RSA 'q' is 
115696748068711854120111013555708747135747460859093084090490757924932300468223L
RSA 'u' is 
93943807197141370332463210515878613140658050525019025748357080640519275375485L

Signature of message 'Hello.' using key loaded from 
keys/privkey_1_rsa_512.pem:

aa5a64f0de3386768ee04468fdf3815350353107f3a1c41248341bcae65fc508e24591f9b0a888
d08790408871d366dd9d36fae5e031bb00547b7a8cccc5a617
$

/Fredrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cryptech.py
Type: text/x-python
Size: 561 bytes
Desc: not available
URL: <https://lists.cryptech.is/archives/tech/attachments/20141206/c9b35c69/attachment.py>


More information about the Tech mailing list