tests/unit/security/transform/public-key.t.cpp
BOOST_AUTO_TEST_CASE(UnsupportedEcEncryption)
{
  EcKeyTestData dataSet;

  PublicKey pKey;
  pKey.loadPkcs8Base64(reinterpret_cast<const uint8_t*>(dataSet.publicKeyPkcs8.c_str()),
                       dataSet.publicKeyPkcs8.size());
  BOOST_CHECK_EQUAL(pKey.getKeyType(), KeyType::EC);

  OBufferStream os;
  bufferSource("Y2lhbyFob2xhIWhlbGxvIQ==") >> base64Decode() >> streamSink(os);

  BOOST_CHECK_THROW(pKey.encrypt(os.buf()->data(), os.buf()->size()), PublicKey::Error);
}
// NOTE: We cannot test RSA encryption by comparing the computed ciphertext to
//       a known-good one, because OAEP padding is randomized and would produce
//       different results every time. An encrypt/decrypt round-trip test is
//       performed in private-key.t.cpp
We cannot test RSA encryption by comparing the computed ciphertext to
a known-good one, because OAEP padding is randomized and would produce
different results every time. An encrypt/decrypt round-trip test is
performed in private-key.t.cpp
We cannot test RSA encryption by comparing the computed ciphertext to a known - good one because OAEP padding is randomized and would produce different results every time . An encrypt / decrypt round - trip test is performed in private - key . t . cpp
BOOST_AUTO_TEST_CASE(UnsupportedEcEncryption)
{
  EcKeyTestData dataSet;
  PublicKey pKey;
  pKey.loadPkcs8Base64(reinterpret_cast<const uint8_t*>(dataSet.publicKeyPkcs8.c_str()),
                       dataSet.publicKeyPkcs8.size());
  BOOST_CHECK_EQUAL(pKey.getKeyType(), KeyType::EC);
  OBufferStream os;
  bufferSource("Y2lhbyFob2xhIWhlbGxvIQ==") >> base64Decode() >> streamSink(os);
  BOOST_CHECK_THROW(pKey.encrypt(os.buf()->data(), os.buf()->size()), PublicKey::Error);
}
BOOST_AUTO_TEST_CASE ( UnsupportedEcEncryption ) { EcKeyTestData dataSet ; PublicKey pKey ; pKey . loadPkcs8Base64 ( reinterpret_cast < const uint8_t * > ( dataSet . publicKeyPkcs8 . c_str ( ) ) , dataSet . publicKeyPkcs8 . size ( ) ) ; BOOST_CHECK_EQUAL ( pKey . getKeyType ( ) , KeyType :: EC ) ; OBufferStream os ; bufferSource ( " " ) >> base64Decode ( ) >> streamSink ( os ) ; BOOST_CHECK_THROW ( pKey . encrypt ( os . buf ( ) -> data ( ) , os . buf ( ) -> size ( ) ) , PublicKey :: Error ) ; }
NOTE: We cannot test RSA encryption by comparing the computed ciphertext to
a known-good one, because OAEP padding is randomized and would produce
different results every time.
NOTE : We cannot test RSA encryption by comparing the computed ciphertext to a known - good one because OAEP padding is randomized and would produce different results every time .