On Wednesday, December 26, 2018 at 7:14:06 AM UTC-5, Richard Závodný wrote:
> What is the (best) way to encrypt SecByteBlock or RSA::PrivateKey, 
RSA::PublicKey?
> Sorry for stupid question, but how do I go about this?

It is hard to say in a vacuum. I'm guessing you want to locally store the 
key to disk...

You could use a modern Authenticated Encryption mode 
(https://www.cryptopp.com/wiki/Authenticated_Encryption), like EAX or GCM. 
Take the password and derive a key and IV. Encrypt the public key using the 
block cipher.

There's a DefaultEncryptorWithMAC 
(https://www.cryptopp.com/wiki/DefaultEncryptorWithMAC) that takes a 
password. The design is kind of old and uses a custom Mash() function. 
Nowadays you usually see a distinct KDF function.

Finally, there are Integrated Encryption schemes, like 
DLIES(https://www.cryptopp.com/wiki/Discrete_Logarithm_Integrated_Encryption_Scheme)
 
and ECIES 
(https://www.cryptopp.com/wiki/Elliptic_Curve_Integrated_Encryption_Scheme). 
These are probably your best bet nowadays, but they require a public 
keypair to encrypt a secret.

Jeff

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to