Catch uninnitialize encryptor

18 views
Skip to first unread message

Nataliia

unread,
Jun 4, 2019, 5:11:24 AM6/4/19
to Crypto++ Users
Hi all.

How can I check is my RSA encryptor initialized? When the programm tries to encrypt something via uninnitialize encryptor, I have exception "divide by zero". 

Can I write something like this before encryption:

If (m_encryptor != 0)
      CryptoPP::StringSource(message_str, true, new CryptoPP::StreamTransformationFilter(m_encryptor, new CryptoPP::StringSink(result_str)));

I know, thet it isn't correct code, but what is another way to check encryptor?


Jeffrey Walton

unread,
Jun 4, 2019, 5:50:49 AM6/4/19
to Crypto++ Users


On Tuesday, June 4, 2019 at 5:11:24 AM UTC-4, Nataliia wrote:
Hi all.

How can I check is my RSA encryptor initialized? When the programm tries to encrypt something via uninnitialize encryptor, I have exception "divide by zero". 

Can I write something like this before encryption:

If (m_encryptor != 0)
      CryptoPP::StringSource(message_str, true, new CryptoPP::StreamTransformationFilter(m_encryptor, new CryptoPP::StringSink(result_str)));

If m_encryptor is a pointer, then first check that it is not NULL. Then, check the modulus is not 0. The RSA pages has examples at https://www.cryptopp.com/wiki/RSA_Cryptography .

Jeff

Nataliia

unread,
Jun 4, 2019, 5:52:34 AM6/4/19
to Crypto++ Users
Thanks!


вторник, 4 июня 2019 г., 2:50:49 UTC-7 пользователь Jeffrey Walton написал:
Reply all
Reply to author
Forward
0 new messages