Hello,
I preliminarily doubt that Rabin's functions is not complete after
tracing cryptopp source code.
Actually, it seems that Rabin's functions are less than RSA's. Some
rare functions may be not implemented yet. But I can't sure that.
I tried to implement a simple Rabin singer and verifier by Integer
class, but I find some troubles as well. I ever implemented Rabin
encrypt/decrypt, sign/verify scheme in java BigInteger class before.
But problems are existing if I just don't familiar cryptopp very much.
I have a suddenly interesting idea. Rabin signature scheme signs
message by two primes, and verifies signature by composite of this two
primes.
Why can't I directly apply RSA's key parameters for Rabin's signature.
I tried to extract parameters p, q, n from RSA's key pair by the
following code, but I still have no idea how to apply parameters p, q,
n to Rabin's. Could you give me an example? Thank you.
CryptoPP::Integer p = CryptoPP::Integer();
CryptoPP::Integer q = CryptoPP::Integer();
CryptoPP::Integer n = CryptoPP::Integer();
try{
CryptoPP::FileSource pubFile(PublicKeyFile.c_str(),
true, new CryptoPP::HexDecoder );
CryptoPP::FileSource privFile(PrivateKeyFile.c_str(),
true, new CryptoPP::HexDecoder);
CryptoPP::RSAES_OAEP_SHA_Decryptor Decryptor( privFile );
CryptoPP::RSAES_OAEP_SHA_Encryptor Encryptor( pubFile );
n = CryptoPP::Integer(Encryptor.GetTrapdoorFunction
().GetModulus());
p = CryptoPP::Integer(Decryptor.GetTrapdoorFunction().GetPrime1
());
q = CryptoPP::Integer(Decryptor.GetTrapdoorFunction().GetPrime2
());
}catch(CryptoPP::Exception& e){
std::cerr
<< "Error: "
<< e.what()
<< std::endl;
}catch(...){
std::cerr
<< "Unknown Error"
<< std::endl;
}
On Mar 20, 11:49 pm, Jeffrey Walton <[email protected]> wrote:
> Hi Chan,
>
> I ran Wei's Rabi1024.dat file through a hex decoder and saved as binary.
>
> FileSource( "Rabi1024.dat", true,
> new HexDecoder(
> new FileSink( "Rabin.key", true )
> )
> );
>
> I then opened it with ObjectiveSystem's ASN.1 View. It appears that is
> a DER encoded file. There are 6 integers laid out end to end. No OIDs,
> no subjectPublicKeyInfo or PrivateKeyInfo. So we must use BERDecode()
> to load the key. But it must be done through AccessKey(). So try this:
>
> RabinSS<PSSR, SHA1>::Signer signer;
> signer.AccessKey().BERDecode(...);
>
> I can't explain why Signer.AccessPrivateKey().BERDecode(...) and the
> like does not work, and why it does not work on the
> InvertibleRabinFunction.
>
> Jeff
>
> On 3/20/09, Jeffrey Walton <[email protected]> wrote:
>
> > Hi Chan,
>
> > I would expect the following to be the most straight forward way to do
> > this. But it does not work.
>
> > InvertibleRabinFunction params;
> > params.GenerateRandomWithKeySize(rng, keylength);
>
> > Rabin::PrivateKey prv( params );
> > Rabin::PublicKey pub( params );
>
> > prv.Save( HexEncoder( new FileSink( "private.bin", false ) ) );
> > pub.Save( HexEncoder( new FileSink( "public.bin", false ) ) );
>
> > I also looked at Rabi1024.dat. It is a hex encoded ASN.1 object (it
> > starts with 3082015202818100D1... ). I would be surprised if it was
> > not generated from Crypto++.
>
> > I don't know what Wei's motivation was for stripping out the
> > X509PublicKey and PKCS8PrivateKey form the Rabin gear. Perhaps Wei can
> > help out here.
>
> > Jeff
>
> > [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.
-~----------~----~----~----~------~----~------~--~---