2022-01-27 19:36:36 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "lerror.h"
|
2022-02-25 04:13:05 +00:00
|
|
|
#include "lsodium.h"
|
2022-01-27 19:36:36 +00:00
|
|
|
|
|
|
|
int main(int argv, char **argc) {
|
2022-02-03 22:25:49 +00:00
|
|
|
unsigned char priv[crypto_kx_SECRETKEYBYTES], pub[crypto_kx_PUBLICKEYBYTES];
|
2022-01-27 19:36:36 +00:00
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
if (sodium_init() < 0) {
|
|
|
|
printf("Libsodium failed to init!\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2022-02-03 22:25:49 +00:00
|
|
|
crypto_kx_keypair(pub, priv);
|
2022-01-27 19:36:36 +00:00
|
|
|
|
|
|
|
printf("[~] Generated keypair!\n");
|
2022-02-03 22:25:49 +00:00
|
|
|
sodium_bin2hex(buf, 256, pub, crypto_kx_PUBLICKEYBYTES);
|
2022-01-27 19:36:36 +00:00
|
|
|
printf("[~] public key: %s\n", buf);
|
2022-02-03 22:25:49 +00:00
|
|
|
sodium_bin2hex(buf, 256, priv, crypto_kx_SECRETKEYBYTES);
|
2022-01-27 19:36:36 +00:00
|
|
|
printf("[~] private key: %s\n\n", buf);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|