Hi Gary,

Use the following.

InvertibleRSAFunction privkey;
privkey.Initialize( rng, 1024 /*, 17 */ );


Jeff


On 2/21/09, Gary <[email protected]> wrote:
>
> Hi there!
> I compiled the code below and got 1 error:
> (In visual C++ 2008 and using "CryptoPP 5.5.2" version!)
>
> #include "stdafx.h"
>
> // Crypto++ Includes
> #include "rsa.h"
> #include "osrng.h"  // PRNG
> #include "base64.h"
> #include "files.h"  // File Source and Sink
>
> int main(int argc, char* argv[])
> {
>    try
>    {
>        std::string PrivateKeyFile = "key.pv";
>        std::string PublicKeyFile  = "key.pb";
>
>        CryptoPP::AutoSeededRandomPool rng;
>
>        // Specify 1024 bit modulus, accept e = 17
>        CryptoPP::InvertibleRSAFunction privkey( rng, 1024 /*, 17
> */ );
>        CryptoPP::Base64Encoder privkeysink(new
>            CryptoPP::FileSink( PrivateKeyFile.c_str() )
>        ); // Hex Encoder
>
>        privkey.DEREncode(privkeysink);
>        privkeysink.MessageEnd();
>
>        CryptoPP:: RSAFunction pubkey(privkey);
>        CryptoPP::Base64Encoder pubkeysink(new
>            CryptoPP::FileSink( PublicKeyFile.c_str() )
>        ); // Hex Encoder
>        pubkey.DEREncode(pubkeysink);
>             pubkeysink.MessageEnd();
>    }
>
>    catch( CryptoPP::Exception& e ) {
>        std::cerr << "Error: " << e.what() << std::endl;
>    }
>
>    catch (...) {
>        std::cerr << "Unknown Error" << std::endl;
>    }
>
>        return 0;
> }
>
>
> And the error:
>
>
> ------ Build started: Project: RSAKeyGen, Configuration: Debug Win32
> ------
> Compiling...
> RSAKeyGen.cpp
> d:\rsakeygen.cpp(19) : error
> C2661:'CryptoPP::InvertibleRSAFunction::InvertibleRSAFunction'
>
> : no overloaded function takes 2 arguments
>
>
> RSAKeyGen - 1 error(s), 0 warning(s)
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
> ==========
>
>
>
> I changed "InvertibleRSAFunction" as below:
> "CryptoPP::InvertibleRSAFunction privkey( rng, 1024 , 17  );"
> (With 3 arguments!)
>
>
> And then got this error:
> ------ Build started: Project: RSAKeyGen, Configuration: Debug Win32
> ------
> Compiling...
> RSAKeyGen.cpp
> d:\rsakeygen.cpp(19) : error
> C2661:'CryptoPP::InvertibleRSAFunction::InvertibleRSAFunction'
> : no overloaded function takes 3 arguments
>
> RSAKeyGen - 1 error(s), 0 warning(s)
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
> ==========
>
>
> What is wrong with this code?
> Thank you
> Gary
> >
>

--~--~---------~--~----~------------~-------~--~----~
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