Hi Chan, The following will not work because the Rabin InvertibleRabinFinction [1] does not implement X509PublicKey and PKCS8PrivateKey as does (for example) InvertibleRSAFunction [2]. Lack of X509PublicKey and PKCS8PrivateKey means familar operations such as Load and Save are not available.
However, Wei show us how to Rabin in validate2.cpp, ValidateRabin() on line 538. In his example, Crypto++ is using the Signer and Verifier, which do implement PKCS8PrivateKey and X509PublicKey. So you will be able to save and load using those objects. Jeff [1] http://cryptopp.com/docs/ref/class_invertible_rabin_function.html [2] http://www.cryptopp.com/docs/ref/class_invertible_r_s_a_function.html On 3/20/09, Mo-Che Chan <[email protected]> wrote: > > There is a problem about Rabin cryptosystem. I'm going to generate the > Rabin key pair, so I wrote the following code by refering RSA sample > codes. However, an runtime error occurs when executing this compiled > program. This is my code. > > try{ > CryptoPP::AutoSeededRandomPool rng; > CryptoPP::RabinDecryptor Decryptor(rng, keylength); > > CryptoPP::HexEncoder privFile(new > CryptoPP::FileSink( PrivateKeyFile.c_str() ) > ); // Hex Encoder > > Decryptor.DEREncode(privFile); > privFile.MessageEnd(); > > CryptoPP::RabinEncryptor Encryptor(Decryptor); > CryptoPP::HexEncoder pubFile(new > CryptoPP::FileSink( PublicKeyFile.c_str() ) > ); // Hex Encoder > Encryptor.DEREncode(pubFile); > pubFile.MessageEnd(); > }catch( CryptoPP::Exception& e ) { > std::cerr > << "Error: " > << e.what() > << std::endl; > }catch(...){ > std::cerr > << "Unknown Error" > << std::endl; > } > > [SNIP] --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
