@@ -42,7 +42,15 @@ namespace SDMS{
4242        std::fill_n (output.get (), paddedLength + SDMS::CipherEngine::NULL_TERMINATOR_SIZE, 0 );  //  manually zero-initialize
4343        const  int  outputLength = EVP_EncodeBlock (reinterpret_cast <unsigned  char *>(output.get ()), input, length);
4444        if  (paddedLength != outputLength)
45-         {  DL_ERROR (log_context, " Output Length ("   << outputLength <<" ) and Predicted Padded Length ("  << paddedLength <<"  ) of encoded bytes not equal!"  ); }
45+         {
46+           std::ostringstream oss;
47+           oss << " Output Length ("   << outputLength
48+               << " ) and Predicted Padded Length ("   << paddedLength
49+               << " ) of encoded bytes not equal!"  ;
50+ 
51+           DL_ERROR (log_context, oss.str ());
52+           EXCEPT_PARAM (1 , oss.str ());
53+         }
4654        return  output;
4755    }
4856
@@ -54,8 +62,15 @@ namespace SDMS{
5462        auto  output = std::make_unique<unsigned  char []>(paddedLength+SDMS::CipherEngine::NULL_TERMINATOR_SIZE);
5563        std::fill_n (output.get (), paddedLength+SDMS::CipherEngine::NULL_TERMINATOR_SIZE, 0 );
5664        const  int  outputLength = EVP_DecodeBlock (output.get (), reinterpret_cast <const  unsigned  char *>(input), length);
57-         if  (paddedLength != outputLength)
58-         { DL_ERROR (log_context, " Output Length ("   << outputLength <<" ) and Predicted Padded Length ("  << paddedLength <<"  ) of decoded bytes not equal!"  ); }
65+         if  (paddedLength != outputLength) {
66+           std::ostringstream oss;
67+           oss << " Output Length ("   << outputLength
68+               << " ) and Predicted Padded Length ("   << paddedLength
69+               << " ) of decoded bytes not equal!"  ;
70+ 
71+           DL_ERROR (log_context, oss.str ());
72+           EXCEPT_PARAM (1 , oss.str ());
73+         }
5974        return  output;
6075    }
6176    void  CipherEngine::generateIV (unsigned  char  *iv)
@@ -107,7 +122,7 @@ bool CipherEngine::tokenNeedsUpdate(const Value::Object &obj)
107122    CipherEngine::CipherBytes CipherEngine::encryptAlgorithm (unsigned  char  *iv, const  std::string& msg, LogContext log_context)
108123    {
109124        if  (msg.length () > MAX_MSG_LENGTH) {
110-             throw   TraceException (__FILE__, __LINE__,  0 , std::string (" Message too long for encryption"  ));
125+             EXCEPT_PARAM ( 0 , std::string (" Message too long for encryption"  ));
111126        }
112127        EVP_CIPHER_CTX *ctx = nullptr ;
113128        CipherBytes bytes_result = {};
0 commit comments