@ -0,0 +1,20 @@ | |||
#include "cryptotech.h" | |||
#include <stdlib.h> | |||
#include <memory.h> | |||
#include <assert.h> | |||
PEP_STATUS init_cryptotech(PEP_cryptotech_t *cryptotech) | |||
{ | |||
assert(PEP_crypt__count == 2); | |||
memset(cryptotech, 0, sizeof(PEP_cryptotech_t) * PEP_crypt__count); | |||
cryptotech[0].id = PEP_crypt_none; | |||
cryptotech[1].id = PEP_crypt_OpenPGP; | |||
cryptotech[1].decrypt_and_verify = decrypt_and_verify; | |||
cryptotech[1].encrypt_and_sign = encrypt_and_sign; | |||
cryptotech[1].verify_text = verify_text; | |||
return PEP_STATUS_OK; | |||
} |
@ -0,0 +1,37 @@ | |||
#pragma once | |||
#include "pEpEngine.h" | |||
typedef enum _PEP_cryptotech { | |||
PEP_crypt_none = 0, | |||
PEP_crypt_OpenPGP = 0x2f, | |||
// PEP_ctypt_PEP = 0x6f, | |||
// PEP_crypt_SMIME = 0x10, | |||
// PEP_crypt_CMS = 0x20, | |||
PEP_crypt__count | |||
}; | |||
typedef PEP_STATUS (*decrypt_and_verify_t)( | |||
PEP_SESSION session, const char *ctext, size_t csize, | |||
char **ptext, size_t *psize, stringlist_t **keylist | |||
); | |||
typedef PEP_STATUS (*verify_text_t)( | |||
PEP_SESSION session, const char *text, size_t size, | |||
const char *signature, size_t sig_size, stringlist_t **keylist | |||
); | |||
typedef PEP_STATUS (*encrypt_and_sign_t)( | |||
PEP_SESSION session, const stringlist_t *keylist, const char *ptext, | |||
size_t psize, char **ctext, size_t *csize | |||
); | |||
typedef struct _PEP_cryptotech_t { | |||
uint8_t id; | |||
decrypt_and_verify_t decrypt_and_verify; | |||
verify_text_t verify_text; | |||
encrypt_and_sign_t encrypt_and_sign; | |||
} PEP_cryptotech_t; | |||
typedef uint64_t cryptotech_mask; |
@ -0,0 +1,15 @@ | |||
#include "transport.h" | |||
#include <stdlib.h> | |||
#include <memory.h> | |||
#include <assert.h> | |||
PEP_STATUS init_transport_system(PEP_transport_t* transports) | |||
{ | |||
assert(PEP_trans__count == 1); | |||
memset(transports, 0, sizeof(PEP_transport_t) * PEP_trans__count); | |||
transports[0].id = PEP_trans_auto; | |||
return PEP_STATUS_OK; | |||
} |
@ -0,0 +1,24 @@ | |||
#pragma once | |||
#include "pEpEngine.h" | |||
typedef enum _PEP_transports { | |||
PEP_trans_auto = 0, | |||
// PEP_trans_email = 1, | |||
// PEP_trans_whatsapp = 2, | |||
PEP_trans__count | |||
} PEP_transports; | |||
typedef struct _PEP_transport_t PEP_transport_t; | |||
typedef PEP_STATUS (*sendto_t)(PEP_SESSION session, const pEp_identity *address, const char *shortmsg, const char *longmsg, const char *longmsg_formatted); | |||
typedef PEP_STATUS (*readnext_t)(PEP_SESSION session, pEp_identity *from, pEp_identity *reached, char **shortmsg, size_t shortmsg_size, char ** longmsg, size_t longmsg_size, char ** longmsg_formatted, size_t longmsg_formatted_size, PEP_transport_t **via); | |||
struct _PEP_transport_t { | |||
uint8_t id; | |||
sendto_t sendto; | |||
readnext_t readnext; | |||
}; | |||
typedef uint64_t transports_mask; |