Jump to content
Tuts 4 You

Rsa keys


Accede

Recommended Posts

I generate some rsa keys with lockbox(c++ builder xe2) now if i whant us this keys i get an error invalid integer value:

Her the keys i whant us:

Puplic exponent E=EB0C

Modulus N=75E7D3A2D3BC5366050B13B0D149479E8997EA705ABFE096528E9967DA0D763DCDC8B814F12BC005F08838350889832C67AFBEBCE3ECA772B8EA04F81C215A45FDC80CC29294F7E1474B656B8741AB6B8CDDB52274EF230E283F7DC4C570D855

Private exponent D=C3C37306BB25C9FFE62EE26B9393FF1986612B9A5256C5EF1A7BFEED58C3CDAB482F12DBAF751AB72C60737C3B0E0B421210A80DCF431B88ACD946A32AC7F90980E73BC6A7607E12F6133AF2D48048393C3E0AD89E0A150A3C86AB618E929B46

The keys looks like littel endian to me but i am not sure.

This is the code i us to gen the rsa keys:

void __fastcall TForm1::btnCreateKeysClick(TObject *Sender)

{

Screen->Cursor = crHourGlass;

FreeKey(PublicKey);

FreeKey(PrivateKey);

StatusBar1->SimpleText = "Generating key pair, this may take a while";

try {

GenerateRSAKeysEx(PrivateKey, PublicKey, TLbAsymKeySize(cbxKeySize->ItemIndex),

StrToIntDef(edtIterations->Text, 20), 0);

edtPublicE->Text = PublicKey->Exponent->IntStr;

edtPublicM->Text = PublicKey->Modulus->IntStr;//Intstr intostring

edtPrivateE->Text = PrivateKey->Exponent->IntStr;//same

edtPrivateM->Text = PrivateKey->ModulusAsString;//same

}

catch (...) {

} // swallow any errors

Screen->Cursor = crDefault;

StatusBar1->SimpleText = "";

}

Ther is no code on the lockbox for big endian or base 10 to 64 conversion.

How i can us this keys?

I hope this is the right place if not please move it to the right section.

Link to comment

1. By 'LockBox' do you mean TurboPower LockBox available from SourceForge for Delphi? http://sourceforge.n...ects/tplockbox/

I've been searching Google but the only ones i can find have been for Delphi and it all ends up pointing back to SourceForge, if you mean another crypto library can you provide a link to their homepage or something please?.

It is this lib and its not only available for delphi her is the link for the c++ builder version:

https://rapidshare.c...723/LockBox.zip

I testet this lib http://www.di-mgt.co..._alg.html#note2 <--crashes after i compile the example with out any reason.

To gen are rsa key with lockbox for c++ builder i us this examble:

https://rapidshare.c...c___builder.rar

Its automatet generation of the keys your see it on the second link i postet.

And the orther libs of rsa dont work with c++ builder (not visual studio) i us embarcadero.

The only one how works are littel bit correct is fgint (it need to be convertet to c++ builder version).

her is the link i found the info about lockbox for c++ builder:

http://pumka.net/2009/11/15/rsa-encryption-cplusplus-delphi-cryptoapi-php-openssl-1/

Edited by accede
Link to comment

The first link i know but the lib is 46 mb <---how whants that his shared file gets from 8 kb to 9 mb?

And Miracl is not compatible with c++ builder xe/xe2

I check it some day if hate more time.

Link to comment

larger than 1

careful, it has to be reasonable large! Was it smartftp that got genned because it was using an E of 173?

There`s no reason not to use the good, old 10001h. :)

Link to comment

I compile the miracl lib but this examble fact.exe,factor.exe dont work for me i get this message from the exe files.

I dont us this #define mr_dltype __int64 ->define mr_dltype __int64

or this #define mr_unsign64 unsigned __int64 ->define mr_unsign64 unsigned __int64

Now way the test exe files dont work.

post-34720-0-09700700-1333896974_thumb.p

Link to comment

@mm

?

@a.

check the architecture of

-the fact.exe file

-your os

does miracl link to dll? if so -> architecture?

Also check the notes on cimpiling ofr different architecutres in the miracle docs.

Call me blind and stupid, but i wasnt able to find a working dl link for miracl? O.O

Link to comment

No i link the lib file with this parems on the mirdef.h32

#define MIRACL 32 //means x86 os

#define MR_LITTLE_ENDIAN //her i can define big endian to

#define mr_unsign32 unsigned int

#define MR_IBITS 32

#define MR_LBITS 32

#define MR_FLASH 52

#define MR_BITSINCHAR 8

#define mr_utype int

#define MR_SPECIAL //this is for primes like this 2#224-2#96+1

#define MR_EDWARDS //this is the EDWARDS method

#define MR_KCM 16 //is used for cm.cpp cm.cpp need this to MR_SPECIAL to gen formula for P =2#224-2#96+1 *

#define MAXBASE ((mr_small)1<<(MIRACL-1))

I read the docs , then is us the bc32doit.bat but the exe files dont work i get the msg from above.

her is the mircal zip file if some on whant it: https://rapidshare.c...8614/miracl.zip

*cm=Program tries to find Elliptic Curve mod a prime P and point of prime order

that is a point (X,Y) on the curve y^2=x^3+Ax+B of order R

where R is large and prime > |P/K|. (K defaults to 256)

Now says me how you see somthing about x64? on the mirdef.h32

Edited by accede
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...