On Tuesday, August 4, 2015 at 6:40:42 PM UTC-4, Cryptaxe Patrick wrote:
>
> Okay so I'm messing around with the RSA section of the CryptoPP library
> and I have a working (demonstration only) function I have written which
> will load the local RSA pubkey, validate it, encrypt a string and then
> output the string into a filesink. I know that validating RSA keys is
> incredibly important as a malformed key could lead to recoverable data, so
> I am using the "Validate(rng, level)" function to validate the key.
> However, the way I am doing it "loads" the key two times into memory, ands
> seems to me like a inefficient way of doing things which usually means that
> I have done something wrong. I've attached the function and hopefully
> someone can tell me how to validate the public key and also use it to
> encrypt without effectively loading it two times. Either that or I am
> misunderstanding something! Thank you ahead of
>
You are only loading it once.
publicKey.Validate(randPool, 3);
That returns true/false :)
You could make it more terse with the following. It still loads once, but
it avoids the copy:
RSAES_OAEP_SHA_Encryptor encryptor;
encryptor.AccessKey().Load(...); // Same code
encryptor.AccessKey().ThrowIfInvalidKey(...);
Jeff
--
--
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.
---
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.