View Full Version : Crypto api test problems

October 27th, 2001, 14:26
I was trying to test the RSA keys generated by the windows crypto api.

So I generate the key pair and export them to two files.

As the private key's one is encrypted, I had a loot at the pubblic one.

It should be:
BYTE bType;
BYTE bVersion;
WORD reserved;
ALG_ID aiKeyAlg;
DWORD magic; // Has to be RSA1
DWORD bitlen; // # of bits in modulus
DWORD pubexp; // public exponent
// Modulus data follows

I find that keysize=512bits and e=65537(default value)

I looked at the modulus, it is:
54C101F2283AE773F57A3EB03CCF7DD8D61AE197FF8B8AAA632B35AFBF289F26B8DFF3E6D2105C1E5AD5629F00B547974261 2C02C8AA18E4F98CAA1714C17BA

I put it in this useful utility from tmg
http://www.secretashell.com/TMG/rsatool2.zip and I found that is not the product of two prime numbers, but of many little numbers.

This is wrong.
And I cant understand where's my error.

Lookin for help...


October 28th, 2001, 02:08
Hello Unregistered !

I have a quite fast computer and quite much (and fast) memory in it. I just know that RSA-256 wil take about 2 hours to decrypt and that it's impossible to decrypt RSA-512 (even with a 2GB swap file) on my computer.

I've never played with the crypto api, but it is possible that you have to reverse the number to (try to ) factorize it.

October 28th, 2001, 05:54
I'm not sure, as it doesn't work, but the publickeyblob structure should be the one I described, so that should be the modulus.

I don't want to factor a 512bit modulus but it results to be the product of more than 2 numbers.
how could you calculate (p-1)(q-1) if n=pqrs??????

there's something wrong but i can't understand what..

I generated another publickeyblob, this time the modulus is
B5259E051CD80678479D70FEA750910238DB0AD95AD4950772B79CBD42FDD916DB825A1716061366B46742BCD48F9B346BB0 E1016D424291598E02D59DFCD9DF

This time is a 512bit one,put when I try to factor with rsatool2, it results
PRIME FACTOR: 10A5DD714B3E182A9E2F9D08B6B1A72DC1A15B69E44A8EB72EAB0969BB5787530052A7078C14241922F48B177A3B1D84BF97 DD0D84C3AD3D0302B

Please help..


October 28th, 2001, 12:36
I didnt think at that problem.

You were right.
Many thanks.