I am struggling like mad, I have an existing system using tomlibcrypt to verify a key agreement, and when running key agreement in openSSL the two agree byte for byte on the shared key. However when using BouncyCastle, I absolutely am unable to come up with the same result. I've tried various things, but essentially variations on:
var agree = new ECDHBasicAgreement(); agree.Init(privateKey); return agree.CalculateAgreement(otherPublicKey).ToByteArrayUnsigned();
The keys are being read from raw bytes and converted to BC style keys using prime256v1. (32 bytes private, 64 bytes public)
Any pointers or help here would be massively appreciated, I'm tearing my hair out!