hi all,
i am using the following code to create RSA keys....

 generateRSAKeyPair(PrivateKey_str &privateKey,PublicKey_str
&publicKey)
{

    GenerateRSAKey(RSAkeyLength, privateKeyFile, publicKeyFile,
reinterpret_cast<char *>(seed) );
    readFileText (privateKey , privateKeyFile );
    readFileText (publicKey , publicKeyFile );
    remove (privateKeyFile);
    remove (publicKeyFile);

}

void GenerateRSAKey(unsigned int keyLength, const char *privFilename,
const char *pubFilename, const char *seed)
{


    RandomPool randPool;
    randPool.Put((byte *)seed, strlen(seed));

    RSAES_OAEP_SHA_Decryptor priv(randPool, keyLength);
    HexEncoder privFile(new FileSink(privFilename));
    priv.DEREncode(privFile);
    privFile.MessageEnd();

    RSAES_OAEP_SHA_Encryptor pub(priv);
    HexEncoder pubFile(new FileSink(pubFilename));
    pub.DEREncode(pubFile);
    pubFile.MessageEnd();

}


at times i am getting some runtime exceptions(in redhat linux).below
is the stack trace of the same.

0x00564cab in _int_malloc () from /lib/tls/libc.so.6
#1  0x00563e9d in malloc () from /lib/tls/libc.so.6
#2  0x001db82e in operator new () from /usr/lib/libstdc++.so.5
#3  0x001db97f in operator new[] () from /usr/lib/libstdc++.so.5
#4  0x0809a1ec in CryptoPP::AllocatorWithCleanup<unsigned
int>::allocate (this=0x89a7878, n=16) at secblock.h:97
#5  0x08063051 in SecBlock (this=0x89a7878, size=16) at secblock.h:222
#6  0x080f5029 in Integer (this=0x89a7874, [EMAIL PROTECTED]) at lib/
cryptopp/integer.cpp:2759
#7  0x080b891d in _Construct<CryptoPP::Integer, CryptoPP::Integer>
(__p=0x89a7874, [EMAIL PROTECTED])
    at stl_construct.h:78
#8  0x080c49f8 in
std::__uninitialized_fill_n_aux<__gnu_cxx::__normal_iterator<CryptoPP::Integer*,
std::vector<CryptoPP::Integer, std::allocator<CryptoPP::Integer> > >,
unsigned int, CryptoPP::Integer> (__first=
      {<std::iterator<std::random_access_iterator_tag,
CryptoPP::Integer, int, CryptoPP::Integer*, CryptoPP::Integer&>> =
{<No data fields>}, _M_current = 0x89a77e8}, __n=9, [EMAIL PROTECTED])
at stl_uninitialized.h:191
#9  0x080c193b in
uninitialized_fill_n<__gnu_cxx::__normal_iterator<CryptoPP::Integer*,
std::vector<CryptoPP::Integer, std::allocator<CryptoPP::Integer> > >,
unsigned int, CryptoPP::Integer> (__first=
      {<std::iterator<std::random_access_iterator_tag,
CryptoPP::Integer, int, CryptoPP::Integer*, CryptoPP::Integer&>> =
{<No data fields>}, _M_current = 0x89a77e8}, __n=16, [EMAIL PROTECTED])
at stl_uninitialized.h:216
#10 0x080bdbf2 in std::vector<CryptoPP::Integer,
std::allocator<CryptoPP::Integer> >::_M_fill_insert (this=0x89a87f0,
    __position=
      {<std::iterator<std::random_access_iterator_tag,
CryptoPP::Integer, int, CryptoPP::Integer*, CryptoPP::Integer&>> =
{<No data fields>}, _M_current = 0x0}, __n=16, [EMAIL PROTECTED]) at
stl_vector.h:992
#11 0x080b87aa in std::vector<CryptoPP::Integer,
std::allocator<CryptoPP::Integer> >::insert (this=0x89a87f0, __pos=
      {<std::iterator<std::random_access_iterator_tag,
CryptoPP::Integer, int, CryptoPP::Integer*, CryptoPP::Integer&>> =
{<No data fields>}, _M_current = 0x0}, __n=16, [EMAIL PROTECTED]) at
stl_vector.h:615
#12 0x080b3220 in std::vector<CryptoPP::Integer,
std::allocator<CryptoPP::Integer> >::resize (this=0x89a87f0,
    __new_size=16, [EMAIL PROTECTED]) at stl_vector.h:691
#13 0x0809acb6 in
CryptoPP::AbstractGroup<CryptoPP::Integer>::SimultaneousMultiply
(this=0xbfffa704, results=0xbfffa900,
    [EMAIL PROTECTED], expBegin=0xbfffa8f4, expCount=1) at algebra.cpp:
267
#14 0x0809b443 in
CryptoPP::AbstractRing<CryptoPP::Integer>::SimultaneousExponentiate
(this=0xbfffa700, results=0xbfffa900,
    [EMAIL PROTECTED], exponents=0xbfffa8e0, expCount=1) at algebra.cpp:
335
#15 0x080ff6e9 in
CryptoPP::MontgomeryRepresentation::SimultaneousExponentiate
(this=0xbfffa700, results=0xbfffa900,
    [EMAIL PROTECTED], exponents=0xbfffa8e0, exponentsCount=1) at
modarith.h:149
#16 0x080fc91c in
CryptoPP::ModularArithmetic::SimultaneousExponentiate
(this=0xbfffa7d0, results=0xbfffa900,
    [EMAIL PROTECTED], exponents=0xbfffa8e0, exponentsCount=1) at lib/
cryptopp/integer.cpp:4148
#17 0x0809b3a2 in
CryptoPP::AbstractRing<CryptoPP::Integer>::Exponentiate
(this=0xbfffa7d0, [EMAIL PROTECTED],
    [EMAIL PROTECTED]) at algebra.cpp:318
#18 0x080fb149 in CryptoPP::a_exp_b_mod_c ([EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED]) at lib/cryptopp/integer.cpp:3946
#19 0x08129566 in CryptoPP::IsStrongProbablePrime ([EMAIL PROTECTED],
[EMAIL PROTECTED]) at lib/cryptopp/nbtheory.cpp:119
#20 0x08132854 in FastProbablePrimeTest ([EMAIL PROTECTED]) at lib/
cryptopp/nbtheory.cpp:257
#21 0x0812c89d in CryptoPP::FirstPrime ([EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
    pSelector=0xbfffb100) at lib/cryptopp/nbtheory.cpp:431
#22 0x0812c611 in CryptoPP::FirstPrime ([EMAIL PROTECTED],
[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
    pSelector=0xbfffb100) at lib/cryptopp/nbtheory.cpp:420

Any help is apprecated.....

cheers
AV


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to