2017-02-06 22:11:22 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "libp2p/crypto/ephemeral.h"
|
|
|
|
/**
|
|
|
|
* Try to generate an ephemeral private key
|
|
|
|
*/
|
|
|
|
int test_ephemeral_key_generate() {
|
2017-02-06 22:28:11 +00:00
|
|
|
struct EphemeralPrivateKey* private_key;
|
2017-02-07 00:04:01 +00:00
|
|
|
int retVal = libp2p_crypto_ephemeral_keypair_generate("P-256", &private_key);
|
2017-02-06 22:11:22 +00:00
|
|
|
if (retVal && private_key->secret_key > 0 && private_key->public_key->x > 0 && private_key->public_key->y > 0)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|