Ok, Jim,

i have found my problem.
I have modified the library in some cases and one of the cases make the error.
In windows all my modified sources works ok, but under linux one of them crashes.

I added support for PK encrypt with the private key und decrypt with the public key.
This works fine ...

And i added the follow's in rsa.cpp at
InvertibleRSAFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg):

    if (m_e == 17)
        m_e.RandomizeMy (rng ,Integer(3), Integer::Power2 (256));
    m_e += m_e.IsEven();

this changes the PublicExponent to a randomly generated one.
This is only for the security.
The Memberfunction RandomizeMy, i have added to the Integer class, is the crash - function  ....
Why, i don't know at this time, but i find it ... *smile*
First, i used the member m_e.Randomize (rng,Integer(3), Integer::Power2 (256), Integer::RandomNumberType::ANY) ,
but my Visual Studio Compiler have a problem with the last argument Integer::RandomNumberType::ANY
and i don't know why (The compiler not found the RandomNumberType::ANY Typ) ...
So i have added my RandomizeMy Function with fixed Integer::RandomNumberType::ANY argument or better his
Value of '0', here is the snippet :

bool Integer::RandomizeMy(RandomNumberGenerator &rng, const Integer &min, const Integer &max)
{
    return GenerateRandomNoThrow(rng, MakeParameters("Min", min)("Max", max)("RandomNumberType", 0)("EquivalentTo", Zero())("Mod", One()));
}                                                                                                                                                          |

In windows this works, but in linux it crash's ...

If i remove this mod's, so it works .....
( I not tested my encrypt mod's on linux, but the problem of my testprogram is resolved)

Very thanks for your help at this time !

@ Wai Dai ,  at the first, your Library is a very very great and fantastic work !!!
I know that you think, it is not necessarily to use an private key encode .... but ...
I need the Public Key Decrypt and Private Key encrypt, why signing for my case is NOT the right way. 
If i signing someone, so i check this sign with an 'if'. This check end's in assembler only in an 'Conditional jump' Variant.
This is, by disassemble a binary file, simple to find, and so to hack. (NOP's and direct 'jump')
When i encrypt needed data (runtime data)  for a program with a private key, and the program decrypt this at runtime to his memory,
with the included public key, so it can not hacked (or better, it is very very difficulty). The encrypted file can not be changed with the
public key. (The public key can be rebuild with the private key, but not reverse, right ?)
So the binary file is much saver
This only as information ....


Torsten



James Vanns schrieb:
Hmm, so the app linked fine (against the cryptopp library)? You could
try and look at the symbols (using 'nm' and grep) to see if the cryptopp
functions do appear (it being c++ they're probably a little mangled).

Compile it with debugging info and run it from gdb. Then do a stack
trace (bt) and post the output. This may not help much but it's a start.

What version of gcc and ld are you using? Oh BTW the obvious thing is of
course to add exception handling in your program so you can catch the
exception and at least print out what it says rather than just letting
it abort.

Jim
  

Reply via email to