You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
1.8 KiB

#include "pEp_internal.h"
#ifdef NO_GPG
#include "pgp_netpgp.h"
#else
#include "pgp_gpg.h"
#endif
#include <stdlib.h>
#include <memory.h>
#include <assert.h>
PEP_STATUS init_cryptotech(PEP_SESSION session)
{
pEpSession *_session = (pEpSession *) session;
PEP_cryptotech_t *cryptotech = _session->cryptotech;
PEP_STATUS _status;
assert(PEP_crypt__count == 2);
memset(cryptotech, 0, sizeof(PEP_cryptotech_t) * PEP_crypt__count);
cryptotech[PEP_crypt_none].id = PEP_crypt_none;
cryptotech[PEP_crypt_none].unconfirmed_comm_type = PEP_ct_no_encryption;
cryptotech[PEP_crypt_none].confirmed_comm_type = PEP_ct_no_encryption;
_status = pgp_init(_session);
assert(_status == PEP_STATUS_OK);
if (_status != PEP_STATUS_OK) {
free(_session);
return _status;
}
cryptotech[PEP_crypt_OpenPGP].id = PEP_crypt_OpenPGP;
cryptotech[PEP_crypt_OpenPGP].unconfirmed_comm_type = PEP_ct_OpenPGP_unconfirmed;
cryptotech[PEP_crypt_OpenPGP].confirmed_comm_type = PEP_ct_OpenPGP;
cryptotech[PEP_crypt_OpenPGP].decrypt_and_verify = pgp_decrypt_and_verify;
cryptotech[PEP_crypt_OpenPGP].encrypt_and_sign = pgp_encrypt_and_sign;
cryptotech[PEP_crypt_OpenPGP].verify_text = pgp_verify_text;
cryptotech[PEP_crypt_OpenPGP].delete_keypair = pgp_delete_keypair;
cryptotech[PEP_crypt_OpenPGP].export_key = pgp_export_key;
cryptotech[PEP_crypt_OpenPGP].find_keys = pgp_find_keys;
cryptotech[PEP_crypt_OpenPGP].generate_keypair = pgp_generate_keypair;
cryptotech[PEP_crypt_OpenPGP].get_key_rating = pgp_get_key_rating;
cryptotech[PEP_crypt_OpenPGP].import_key = pgp_import_key;
cryptotech[PEP_crypt_OpenPGP].recv_key = pgp_recv_key;
cryptotech[PEP_crypt_OpenPGP].send_key = pgp_send_key;
return PEP_STATUS_OK;
}
void release_cryptotech(PEP_SESSION session)
{
pgp_release(session);
}