Good morning.
Is there a way to generate the private key in a function, convert it to
string give it back, in another function get the private-key-string and
get the public key from that string-private key?
If it is, can someone please give me a clue?
This is my code at the moment:
string CreatePrivkey()
{
string privateKey;
RandomPool randPool;
randPool.Put((byte *)"1234567890", 10);
RSAES_OAEP_SHA_Decryptor priv(randPool, 1024);
HexEncoder privSink(new StringSink(privateKey));
priv.DEREncode(privSink);
privSink.MessageEnd();
return privateKey;
}
string CreatePubkey(string privkey)
{
string publicKey;
//InvertibleRSAFunction privKey;
//int intkey;
//char* charkey;
//charkey =
//intkey = atoi((char*)privkey);
//intkey = privkey;
//RSAES_OAEP_SHA_Encryptor pub(intkey);
//HexEncoder pubSink(new StringSink(publicKey));
//pub.DEREncode(pubSink);
//pubSink.MessageEnd();
//BufferedTransformation. blubb;
// &blubb = privkey;
// privKey.Load(privkey);
/*RSAFunction pubkey;
pubkey.AssignFrom(privkey);
HexEncoder pubFile(new FileSink("D:\\public_key.txt"));
pubkey.DEREncode(pubFile);
pubFile.MessageEnd();
return privkey;*/
return privkey;
}
Thank you for your help.
Meike