EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Functions
crypt_commands.h File Reference

File containing the definition of the crypt commands. More...

#include <stdbool.h>
#include <inttypes.h>
Include dependency graph for crypt_commands.h:

Go to the source code of this file.

Functions

int put_crypt_cmd (struct supervisor_context *context, char *key, char *value)
 PUT_CRYPT command. More...
 
int get_crypt_cmd (struct supervisor_context *context, char *key, char **value)
 GET_CRYPT command. More...
 
int gen_randkey_cmd (struct supervisor_context *context, char *keyid, uint8_t size)
 GEN_RANDKEY command. More...
 
int gen_privkey_cmd (struct supervisor_context *context, char *keyid, uint8_t size)
 GEN_PRIVKEY command. More...
 
int gen_pubkey_cmd (struct supervisor_context *context, char *pubid, char *keyid)
 GEN_PUBKEY command. More...
 
int gen_cert_cmd (struct supervisor_context *context, char *certid, char *keyid, struct certificate_meta *meta)
 GEN_CERT command. More...
 
char * encrypt_blob_cmd (struct supervisor_context *context, char *keyid, char *ivid, char *blob)
 ENCRYPT_BLOB command. More...
 
char * decrypt_blob_cmd (struct supervisor_context *context, char *keyid, char *ivid, char *blob)
 DECRYPT_BLOB command. More...
 
char * sign_blob_cmd (struct supervisor_context *context, const char *keyid, const char *blob)
 SIGN_BLOB command. More...
 

Detailed Description

File containing the definition of the crypt commands.

Author
Alexandru Mereacre
Date
2021

Function Documentation

◆ decrypt_blob_cmd()

char* decrypt_blob_cmd ( struct supervisor_context context,
char *  keyid,
char *  ivid,
char *  blob 
)

DECRYPT_BLOB command.

Parameters
contextThe supervisor structure instance
keyidThe private key id
ividThe iv id
blobThe blob base64 string to decrypt
Returns
char* the decrypted blob in base64, NULL on failure

◆ encrypt_blob_cmd()

char* encrypt_blob_cmd ( struct supervisor_context context,
char *  keyid,
char *  ivid,
char *  blob 
)

ENCRYPT_BLOB command.

Parameters
contextThe supervisor structure instance
keyidThe private key id
ividThe iv id
blobThe blob base64 string to encrypt
Returns
char* the encrypted blob in base64, NULL on failure

◆ gen_cert_cmd()

int gen_cert_cmd ( struct supervisor_context context,
char *  certid,
char *  keyid,
struct certificate_meta meta 
)

GEN_CERT command.

Parameters
contextThe supervisor structure instance
certidThe certificate id
keyidThe private key id
metaThe certificate metadata
Returns
0 on success, -1 on failure

◆ gen_privkey_cmd()

int gen_privkey_cmd ( struct supervisor_context context,
char *  keyid,
uint8_t  size 
)

GEN_PRIVKEY command.

Parameters
contextThe supervisor structure instance
keyidThe key id
sizeThe key size in bytes
Returns
0 on success, -1 on failure

◆ gen_pubkey_cmd()

int gen_pubkey_cmd ( struct supervisor_context context,
char *  pubid,
char *  keyid 
)

GEN_PUBKEY command.

Parameters
contextThe supervisor structure instance
pubidThe public id
keyidThe private key id
Returns
0 on success, -1 on failure

◆ gen_randkey_cmd()

int gen_randkey_cmd ( struct supervisor_context context,
char *  keyid,
uint8_t  size 
)

GEN_RANDKEY command.

Parameters
contextThe supervisor structure instance
keyidThe key id
sizeThe key size in bytes
Returns
0 on success, -1 on failure

◆ get_crypt_cmd()

int get_crypt_cmd ( struct supervisor_context context,
char *  key,
char **  value 
)

GET_CRYPT command.

Sets value to point new string containing the crypt output value. Please remember to os_free() the value when you're finished with using it.

Parameters
[in]contextThe supervisor structure instance
[in]keyThe crypt key
[out]valuePointer to crypt output value
Returns
0 on success, -1 on failure

◆ put_crypt_cmd()

int put_crypt_cmd ( struct supervisor_context context,
char *  key,
char *  value 
)

PUT_CRYPT command.

Parameters
contextThe supervisor structure instance
keyThe crypt key
valueThe crypt value
Returns
0 on success, -1 on failure

◆ sign_blob_cmd()

char* sign_blob_cmd ( struct supervisor_context context,
const char *  keyid,
const char *  blob 
)

SIGN_BLOB command.

Parameters
contextThe supervisor structure instance
keyidThe private key id
blobThe blob base64 string to sign
Returns
char* the signed blob in base64, NULL on failure