mirror of https://github.com/oxen-io/oxen-mq.git
Fix verify pubkey initialization
This commit is contained in:
parent
98a4aed68f
commit
b11d2870bd
|
@ -372,7 +372,7 @@ LokiMQ::LokiMQ(
|
||||||
// Verify the pubkey. We could get by with taking just the privkey and just generate this
|
// Verify the pubkey. We could get by with taking just the privkey and just generate this
|
||||||
// for ourselves, but this provides an extra check to make sure we and the caller agree
|
// for ourselves, but this provides an extra check to make sure we and the caller agree
|
||||||
// cryptographically (e.g. to make sure they don't pass us an ed25519 keypair by mistake)
|
// cryptographically (e.g. to make sure they don't pass us an ed25519 keypair by mistake)
|
||||||
std::string verify_pubkey{crypto_box_PUBLICKEYBYTES, 0};
|
std::string verify_pubkey(crypto_box_PUBLICKEYBYTES, 0);
|
||||||
crypto_scalarmult_base(reinterpret_cast<unsigned char*>(&verify_pubkey[0]), reinterpret_cast<unsigned char*>(&privkey[0]));
|
crypto_scalarmult_base(reinterpret_cast<unsigned char*>(&verify_pubkey[0]), reinterpret_cast<unsigned char*>(&privkey[0]));
|
||||||
if (verify_pubkey != pubkey)
|
if (verify_pubkey != pubkey)
|
||||||
throw std::invalid_argument("Invalid pubkey/privkey values given to LokiMQ construction: pubkey verification failed");
|
throw std::invalid_argument("Invalid pubkey/privkey values given to LokiMQ construction: pubkey verification failed");
|
||||||
|
|
Loading…
Reference in New Issue