Hi all,
I’m building a macOS-native C++ trading bot, compiled via Xcode. It sends REST API requests to a crypto exchange (Bitvavo) that require HMAC-SHA256 signatures using a pre-sign string (timestamp + method + path + body) and an API secret.
Here’s the issue:
• The exact same pre-sign string and API secret produce valid responses when signed using Python (hmac.new(secret, msg, hashlib.sha256)),
• But when I generate the HMAC signature using C++ (HMAC(EVP_sha256, ...) via OpenSSL), the exchange returns an invalid signature error.
Environment:
• Xcode 15.3 / macOS 14.x
• OpenSSL installed via Homebrew
• HMAC test vectors match Python’s output for basic strings (so HMAC lib seems correct)
Yet when using the real API keys and dynamic timestamped messages, something differs enough to break verification — possibly due to UTF-8 encoding, memory alignment, or newline handling differences in the Xcode C++ runtime?
Has anyone experienced subtle differences between Python and C++ HMAC-SHA256 behavior when compiled in Xcode?
I’ve published a GitHub repo for reproducibility: 🔗 https://github.com/vanBaardewijk/bitvavo-cpp-signature-test
Thanks in advance for any suggestions or insights.
Sascha