heartbeat

Simple server monitor system using encrypted messages over udp
git clone https://noulin.net/git/heartbeat.git
Log | Files | Refs | README

sel.h (570B)


      1 #pragma once
      2 
      3 #include "sodium.h"
      4 
      5 #ifndef u8
      6 #define u8  uint8_t
      7 #endif
      8 
      9 typedef struct {
     10 	u8 publicKey[crypto_box_PUBLICKEYBYTES];
     11 	u8 secretKey[crypto_box_SECRETKEYBYTES];
     12 	u8 remotePublicKey[crypto_box_PUBLICKEYBYTES];
     13 	u8 nonce[crypto_box_NONCEBYTES];
     14 } keyst;
     15 
     16 /*
     17 These functions return 0 when they fail.
     18 */
     19 
     20 int selInit(void);
     21 void newKeysBuf(keyst *keys);
     22 int selPublicEncrypt(u8 *ciphertext/*result*/, size_t csize, const u8 *msg, size_t mlen, keyst *keys);
     23 int selPublicDecrypt(u8 *msg/*result*/, size_t msize, const u8 *ciphertext, size_t clen, keyst *keys);