Browse Source

adding the concepts of transports and cryptotech

doc_update_sequoia
vb 8 years ago
parent
commit
16f689fc95
7 changed files with 116 additions and 0 deletions
  1. +4
    -0
      pEpEngine.vcxproj
  2. +12
    -0
      pEpEngine.vcxproj.filters
  3. +20
    -0
      src/cryptotech.c
  4. +37
    -0
      src/cryptotech.h
  5. +4
    -0
      src/pEpEngine.h
  6. +15
    -0
      src/transport.c
  7. +24
    -0
      src/transport.h

+ 4
- 0
pEpEngine.vcxproj View File

@ -81,16 +81,20 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\cryptotech.c" />
<ClCompile Include="src\keymanagement.c" />
<ClCompile Include="src\pEpEngine.c" />
<ClCompile Include="src\platform_windows.cpp" />
<ClCompile Include="src\sqlite3.c" />
<ClCompile Include="src\transport.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\cryptotech.h" />
<ClInclude Include="src\keymanagement.h" />
<ClInclude Include="src\pEpEngine.h" />
<ClInclude Include="src\platform_windows.h" />
<ClInclude Include="src\sqlite3.h" />
<ClInclude Include="src\transport.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">


+ 12
- 0
pEpEngine.vcxproj.filters View File

@ -27,6 +27,12 @@
<ClCompile Include="src\sqlite3.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="src\transport.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="src\cryptotech.c">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\keymanagement.h">
@ -41,5 +47,11 @@
<ClInclude Include="src\sqlite3.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="src\transport.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="src\cryptotech.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
</Project>

+ 20
- 0
src/cryptotech.c View File

@ -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;
}

+ 37
- 0
src/cryptotech.h View File

@ -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;

+ 4
- 0
src/pEpEngine.h View File

@ -1,3 +1,5 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
@ -347,6 +349,7 @@ typedef enum _PEP_comm_type {
PEP_ct_unconfirmed_encryption = 0x10, // generic
PEP_ct_OpenPGP_1024_RSA_unconfirmed = 0x11, // RSA 1024 is weak
PEP_ct_SMIME_unconfirmed = 0x20,
PEP_ct_CMS_unconfirmed = 0x30,
PEP_ct_OpenPGP_unconfirmed = 0x3f, // key at least 2048 bit RSA
// or 1024 bit DSA
@ -363,6 +366,7 @@ typedef enum _PEP_comm_type {
PEP_ct_confirmed_encryption = 0x90, // generic
PEP_ct_OpenPGP_1024_RSA = 0x91, // RSA 1024 is weak
PEP_ct_SMIME = 0xa0,
PEP_ct_CMS = 0xb0,
PEP_ct_OpenPGP = 0xbf, // key at least 2048 bit RSA or 1024 bit DSA


+ 15
- 0
src/transport.c View File

@ -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;
}

+ 24
- 0
src/transport.h View File

@ -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;

Loading…
Cancel
Save