title: C++ OpenSSL 1.0 migration to 3.0
body: <p>I'm trying to make a bot to access and do stuff with BitStamp API (<a href="https://www.bitstamp.net/api/" rel="nofollow noreferrer">https://www.bitstamp.net/api/</a>), but I'm hitting a snag.</p>
  <p>In the page linked, they show an example of how to authenticate with c++ (the V2 version). I'm having problems with this part for the authentication using openSSL:</p>
  <pre><code>HMAC_CTX ctx;
  HMAC_CTX_init(&amp;ctx);
  
  HMAC_Init_ex(&amp;ctx, api_secret.c_str(), api_secret.length(), EVP_sha256(), NULL);
  HMAC_Update(&amp;ctx, (unsigned char*)data_to_sign.c_str(), data_to_sign.length());
  HMAC_Final(&amp;ctx, result, &amp;len);
  HMAC_CTX_cleanup(&amp;ctx);
  
  std::string x_auth_signature = b2a_hex( (char *)result, 32 );
  free(result);
  </code></pre>
  <p>and</p>
  <pre><code>std::string b2a_hex(char *byte_arr, int n)
  {
      const static std::string hex_codes = &quot;0123456789abcdef&quot;;
      std::string hex_string;
      for ( int i = 0; i &lt; n ; ++i ) {
          unsigned char bin_value = byte_arr[i];
          hex_string += hex_codes[( bin_value &gt;&gt; 4 ) &amp; 0x0F];
          hex_string += hex_codes[bin_value &amp; 0x0F];
      }
      return hex_string;
  }
  </code></pre>
  <p>Using openSSL 3.0, seems like HMAC_CTX has been deprecated.</p>
  <p>When compiling I get the following error messages:</p>
  <p>Error   C4996   'HMAC_Update': Since OpenSSL 3.0    StonksBot   C:\CodeProjects\StonksBot\StonksBot\Source\StonksBot\Requests\AuthenticationRequest.cpp 70<br />
  Error   C4996   'HMAC_Init_ex': Since OpenSSL 3.0   StonksBot   C:\CodeProjects\StonksBot\StonksBot\Source\StonksBot\Requests\AuthenticationRequest.cpp 69<br />
  Error   C4996   'HMAC_Final': Since OpenSSL 3.0 StonksBot   C:\CodeProjects\StonksBot\StonksBot\Source\StonksBot\Requests\AuthenticationRequest.cpp 71<br />
  Error   C4996   'HMAC_CTX_reset': Since OpenSSL 3.0 StonksBot   C:\CodeProjects\StonksBot\StonksBot\Source\StonksBot\Requests\AuthenticationRequest.cpp 72<br />
  Error   C4996   'HMAC_CTX_new': Since OpenSSL 3.0   StonksBot   C:\CodeProjects\StonksBot\StonksBot\Source\StonksBot\Requests\AuthenticationRequest.cpp 68</p>
  <p>I have scoured the internet looking for any migration tips, but i can't find anything. Any kind soul can help me or point me in the direction of how to migrate this piece of code to openSSL3.0 supported code?</p>