30 lines
585 B
C++
30 lines
585 B
C++
#include <iostream>
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <sodium.h>
|
|
|
|
// https://github.com/tkislan/base64
|
|
#include "base64.h"
|
|
|
|
using namespace std;
|
|
|
|
int main () {
|
|
vector <uint8_t> pk;
|
|
pk.resize (crypto_sign_PUBLICKEYBYTES);
|
|
vector <uint8_t> sk;
|
|
sk.resize (crypto_sign_SECRETKEYBYTES);
|
|
|
|
crypto_sign_keypair (pk.data (), sk.data ());
|
|
|
|
const string pk_s ((const char *)pk.data (), pk.size ());
|
|
string pk_b64;
|
|
Base64::Encode (pk_s, &pk_b64);
|
|
|
|
cerr << "Generated secret key with pub key " << pk_b64 << endl;
|
|
|
|
cerr << "Done." << endl;
|
|
return 0;
|
|
}
|