Browse Source

Merged in ENGINE-420

local_cmocka
Krista Bennett 4 years ago
parent
commit
b5f1563266
30 changed files with 1855 additions and 35 deletions
  1. +1
    -0
      .hgignore
  2. +9
    -6
      src/keymanagement.c
  3. +205
    -9
      src/message_api.c
  4. +10
    -0
      src/message_api.h
  5. +6
    -3
      src/mime.c
  6. +27
    -11
      src/pEpEngine.c
  7. +20
    -2
      src/pEpEngine.h
  8. +1
    -1
      src/pEp_internal.h
  9. +1
    -1
      src/sync_impl.c
  10. +32
    -0
      test/convenience_scripts/DANGER_delete_keys_silently_w_pattern.py
  11. +101
    -0
      test/convenience_scripts/keygen_for_test.py
  12. +146
    -0
      test/decrypt_attach_private_key_trusted_test.cc
  13. +125
    -0
      test/decrypt_attach_private_key_untrusted_test.cc
  14. +292
    -0
      test/encrypt_attach_private_key_test.cc
  15. +63
    -0
      test/test_keys/priv/priv-key-import-test-main_0-0x3276D2E5_priv.asc
  16. +63
    -0
      test/test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc
  17. +63
    -0
      test/test_keys/priv/priv-key-import-test-main_1-0x80C8CD87_priv.asc
  18. +63
    -0
      test/test_keys/priv/priv-key-import-test-main_2-0x0B74809C_priv.asc
  19. +63
    -0
      test/test_keys/priv/priv-key-import-test-other_0-0xD11252C9_priv.asc
  20. +63
    -0
      test/test_keys/priv/priv-key-import-test-other_1-0xC785F20A_priv.asc
  21. +63
    -0
      test/test_keys/priv/priv-key-import-test-other_2-0xF26F5504_priv.asc
  22. +36
    -0
      test/test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc
  23. +36
    -0
      test/test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc
  24. +36
    -0
      test/test_keys/pub/priv-key-import-test-main_1-0x80C8CD87_pub.asc
  25. +36
    -0
      test/test_keys/pub/priv-key-import-test-main_2-0x0B74809C_pub.asc
  26. +36
    -0
      test/test_keys/pub/priv-key-import-test-other_0-0xD11252C9_pub.asc
  27. +36
    -0
      test/test_keys/pub/priv-key-import-test-other_1-0xC785F20A_pub.asc
  28. +36
    -0
      test/test_keys/pub/priv-key-import-test-other_2-0xF26F5504_pub.asc
  29. +184
    -0
      test/test_mails/priv_key_attach.eml
  30. +2
    -2
      test/test_util.cc

+ 1
- 0
.hgignore View File

@ -61,3 +61,4 @@ trustdb.gpg
__pycache__
*.pyc
test/python_tests/test?

+ 9
- 6
src/keymanagement.c View File

@ -70,7 +70,7 @@ PEP_STATUS elect_pubkey(
return PEP_OUT_OF_MEMORY;
}
if (_comm_type_key != PEP_ct_compromized &&
if (_comm_type_key != PEP_ct_compromised &&
_comm_type_key != PEP_ct_unknown)
{
if (identity->comm_type == PEP_ct_unknown ||
@ -341,7 +341,7 @@ PEP_STATUS get_valid_pubkey(PEP_SESSION session,
case PEP_ct_key_revoked:
case PEP_ct_key_b0rken:
case PEP_ct_key_expired:
case PEP_ct_compromized:
case PEP_ct_compromised:
case PEP_ct_mistrusted:
// this only happens when it's all there is
status = first_reject_status;
@ -787,7 +787,7 @@ DYNAMIC_API PEP_STATUS update_identity(
// FIXME: This is legacy. I presume it's a notification for the caller...
// Revisit once I can talk to Volker
if (identity->comm_type != PEP_ct_compromized &&
if (identity->comm_type != PEP_ct_compromised &&
identity->comm_type < PEP_ct_strong_but_unconfirmed)
if (session->examine_identity)
session->examine_identity(identity, session->examine_management);
@ -845,7 +845,7 @@ PEP_STATUS elect_ownkey(
return PEP_OUT_OF_MEMORY;
}
if (_comm_type_key != PEP_ct_compromized &&
if (_comm_type_key != PEP_ct_compromised &&
_comm_type_key != PEP_ct_unknown)
{
if (identity->comm_type == PEP_ct_unknown ||
@ -1185,7 +1185,7 @@ DYNAMIC_API PEP_STATUS key_mistrusted(
if (status == PEP_STATUS_OK)
// cascade that mistrust for anyone using this key
status = mark_as_compromized(session, ident->fpr);
status = mark_as_compromised(session, ident->fpr);
if (status == PEP_STATUS_OK)
status = remove_fpr_as_default(session, ident->fpr);
if (status == PEP_STATUS_OK)
@ -1289,7 +1289,10 @@ DYNAMIC_API PEP_STATUS key_reset_trust(
if (!tmp_ident)
return PEP_OUT_OF_MEMORY;
status = update_identity(session, tmp_ident);
if (is_me(session, tmp_ident))
status = myself(session, tmp_ident);
else
status = update_identity(session, tmp_ident);
if (status != PEP_STATUS_OK)
goto pep_free;


+ 205
- 9
src/message_api.c View File

@ -1059,7 +1059,7 @@ static PEP_rating _rating(PEP_comm_type ct, PEP_rating rating)
else if (ct == PEP_ct_key_not_found)
return PEP_rating_have_no_key;
else if (ct == PEP_ct_compromized)
else if (ct == PEP_ct_compromised)
return PEP_rating_under_attack;
else if (ct == PEP_ct_mistrusted)
@ -1259,8 +1259,8 @@ static PEP_comm_type _get_comm_type(
{
PEP_STATUS status = PEP_STATUS_OK;
if (max_comm_type == PEP_ct_compromized)
return PEP_ct_compromized;
if (max_comm_type == PEP_ct_compromised)
return PEP_ct_compromised;
if (max_comm_type == PEP_ct_mistrusted)
return PEP_ct_mistrusted;
@ -1271,8 +1271,8 @@ static PEP_comm_type _get_comm_type(
status = myself(session, ident);
if (status == PEP_STATUS_OK) {
if (ident->comm_type == PEP_ct_compromized)
return PEP_ct_compromized;
if (ident->comm_type == PEP_ct_compromised)
return PEP_ct_compromised;
else if (ident->comm_type == PEP_ct_mistrusted)
return PEP_ct_mistrusted;
else
@ -1812,6 +1812,181 @@ pep_error:
return status;
}
DYNAMIC_API PEP_STATUS encrypt_message_and_add_priv_key(
PEP_SESSION session,
message *src,
message **dst,
const char* to_fpr,
PEP_enc_format enc_format,
PEP_encrypt_flags_t flags
)
{
assert(session);
assert(src);
assert(dst);
assert(to_fpr);
if (!session || !src || !dst || !to_fpr)
return PEP_ILLEGAL_VALUE;
if (enc_format == PEP_enc_none)
return PEP_ILLEGAL_VALUE;
if (src->cc || src->bcc)
return PEP_ILLEGAL_VALUE;
if (!src->to || src->to->next)
return PEP_ILLEGAL_VALUE;
if (!src->from->address || !src->to->ident || !src->to->ident->address)
return PEP_ILLEGAL_VALUE;
if (!strcasecmp(src->from->address, src->to->ident->address) == 0)
return PEP_ILLEGAL_VALUE;
stringlist_t* keys = NULL;
char* own_id = NULL;
char* default_id = NULL;
PEP_STATUS status = get_default_own_userid(session, &own_id);
if (!own_id)
return PEP_UNKNOWN_ERROR; // Probably a DB error at this point
if (src->from->user_id) {
if (strcmp(src->from->user_id, own_id) != 0) {
status = get_userid_alias_default(session, src->from->user_id, &default_id);
if (status != PEP_STATUS_OK || !default_id || strcmp(default_id, own_id) != 0) {
status = PEP_ILLEGAL_VALUE;
goto pep_free;
}
}
}
// Ok, we are at least marginally sure the initial stuff is ok.
// Let's get our own, normal identity
pEp_identity* own_identity = identity_dup(src->from);
status = myself(session, own_identity);
if (status != PEP_STATUS_OK)
goto pep_free;
// Ok, now we know the address is an own address. All good. Then...
char* own_private_fpr = own_identity->fpr;
own_identity->fpr = strdup(to_fpr);
status = get_trust(session, own_identity);
if (status != PEP_STATUS_OK) {
if (status == PEP_CANNOT_FIND_IDENTITY)
status = PEP_ILLEGAL_VALUE;
goto pep_free;
}
if ((own_identity->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed) {
status = PEP_ILLEGAL_VALUE;
goto pep_free;
}
// Ok, so all the things are now allowed.
// So let's get our own private key and roll with it.
char* priv_key_data = NULL;
size_t priv_key_size = 0;
status = export_secret_key(session, own_private_fpr, &priv_key_data,
&priv_key_size);
if (status != PEP_STATUS_OK)
goto pep_free;
if (!priv_key_data) {
status = PEP_CANNOT_EXPORT_KEY;
goto pep_free;
}
// Ok, fine... let's encrypt yon blob
keys = new_stringlist(own_private_fpr);
if (!keys) {
status = PEP_OUT_OF_MEMORY;
goto pep_free;
}
stringlist_add(keys, to_fpr);
char* encrypted_key_text = NULL;
size_t encrypted_key_size = 0;
if (flags & PEP_encrypt_flag_force_unsigned)
status = encrypt_only(session, keys, priv_key_data, priv_key_size,
&encrypted_key_text, &encrypted_key_size);
else
status = encrypt_and_sign(session, keys, priv_key_data, priv_key_size,
&encrypted_key_text, &encrypted_key_size);
if (!encrypted_key_text) {
status = PEP_UNKNOWN_ERROR;
goto pep_free;
}
// We will have to delete this before returning, as we allocated it.
bloblist_t* created_bl = NULL;
bloblist_t* created_predecessor = NULL;
bloblist_t* old_head = NULL;
if (!src->attachments || src->attachments->value == NULL) {
if (src->attachments->value == NULL) {
old_head = src->attachments;
src->attachments = NULL;
}
src->attachments = new_bloblist(encrypted_key_text, encrypted_key_size,
"application/octet-stream",
"file://pEpkey.asc.pgp");
created_bl = src->attachments;
}
else {
bloblist_t* tmp = src->attachments;
while (tmp && tmp->next) {
tmp = tmp->next;
}
created_predecessor = tmp;
created_bl = bloblist_add(tmp,
encrypted_key_text, encrypted_key_size,
"application/octet-stream",
"file://pEpkey.asc.pgp");
}
if (!created_bl) {
status = PEP_OUT_OF_MEMORY;
goto pep_free;
}
// Ok, it's in there. Let's do this.
status = encrypt_message(session, src, keys, dst, enc_format, 0);
// Delete what we added to src
free_bloblist(created_bl);
if (created_predecessor)
created_predecessor->next = NULL;
else {
if (old_head)
src->attachments = old_head;
else
src->attachments = NULL;
}
pep_free:
free(own_id);
free(default_id);
free(own_private_fpr);
free_identity(own_identity);
free_stringlist(keys);
return status;
}
DYNAMIC_API PEP_STATUS encrypt_message_for_self(
PEP_SESSION session,
pEp_identity* target_id,
@ -2515,9 +2690,9 @@ static PEP_STATUS import_priv_keys_from_decrypted_msg(PEP_SESSION session,
// the private identity list should NOT be subject to myself() or
// update_identity() at this point.
// If the receiving app wants them to be in the trust DB, it
// should call myself() on them upon return.
// should call set_own_key() on them upon return.
// We do, however, prepare these so the app can use them
// directly in a myself() call by putting the own_id on it.
// directly in a set_own_key() call by putting the own_id on it.
char* own_id = NULL;
status = get_default_own_userid(session, &own_id);
@ -2562,12 +2737,16 @@ static PEP_STATUS update_sender_to_pep_trust(
PEP_STATUS status =
is_me(session, sender) ? myself(session, sender) : update_identity(session, sender);
if (EMPTYSTR(sender->fpr) || strcmp(sender->fpr, keylist->value) != 0) {
free(sender->fpr);
sender->fpr = strdup(keylist->value);
if (!sender->fpr)
return PEP_OUT_OF_MEMORY;
status = set_pgp_keypair(session, sender->fpr);
if (status != PEP_STATUS_OK)
return status;
status = get_trust(session, sender);
if (status == PEP_CANNOT_FIND_IDENTITY || sender->comm_type == PEP_ct_unknown) {
@ -2918,7 +3097,24 @@ DYNAMIC_API PEP_STATUS _decrypt_message(
free_message(inner_message);
goto pep_error;
}
// check for private key in decrypted message attachment while importing
// N.B. Apparently, we always import private keys into the keyring; however,
// we do NOT always allow those to be used for encryption. THAT is controlled
// by setting it as an own identity associated with the key in the DB.
// If we have a message 2.0 message, we are ONLY going to be ok with keys
// we imported from THIS part of the message.
imported_private_key_address = false;
free(private_il);
private_il = NULL;
status = import_priv_keys_from_decrypted_msg(session, src, inner_message,
&imported_keys,
&imported_private_key_address,
private_il);
if (status != PEP_STATUS_OK)
goto pep_error;
// THIS is our message
// Now, let's make sure we've copied in
// any information sent in by the app if


+ 10
- 0
src/message_api.h View File

@ -75,6 +75,16 @@ DYNAMIC_API PEP_STATUS encrypt_message(
);
DYNAMIC_API PEP_STATUS encrypt_message_and_add_priv_key(
PEP_SESSION session,
message *src,
message **dst,
const char* to_fpr,
PEP_enc_format enc_format,
PEP_encrypt_flags_t flags
);
// encrypt_message_for_self() - encrypt message in memory for user's identity only,
// ignoring recipients and other identities from
// the message


+ 6
- 3
src/mime.c View File

@ -302,9 +302,12 @@ static struct mailimf_mailbox * identity_to_mailbox(const pEp_identity *ident)
char *_username = NULL;
struct mailimf_mailbox *mb;
_username = (ident->username && must_field_value_be_encoded(ident->username))
? mailmime_encode_subject_header("utf-8", ident->username, 0)
: strdup("");
if (!ident->username)
_username = strdup("");
else
_username = must_field_value_be_encoded(ident->username) ?
mailmime_encode_subject_header("utf-8", ident->username, 0) :
strdup(ident->username);
assert(_username);
if (_username == NULL)


+ 27
- 11
src/pEpEngine.c View File

@ -311,7 +311,7 @@ static const char *sql_least_trust =
" and comm_type != 0;"; // ignores PEP_ct_unknown
// returns PEP_ct_unknown only when no known trust is recorded
static const char *sql_mark_as_compromized =
static const char *sql_mark_as_compromised =
"update trust not indexed set comm_type = 15"
" where pgp_keypair_fpr = upper(replace(?1,' ','')) ;";
@ -1195,8 +1195,8 @@ DYNAMIC_API PEP_STATUS init(PEP_SESSION *session)
(int)strlen(sql_least_trust), &_session->least_trust, NULL);
assert(int_result == SQLITE_OK);
int_result = sqlite3_prepare_v2(_session->db, sql_mark_as_compromized,
(int)strlen(sql_mark_as_compromized), &_session->mark_compromized,
int_result = sqlite3_prepare_v2(_session->db, sql_mark_as_compromised,
(int)strlen(sql_mark_as_compromised), &_session->mark_compromised,
NULL);
assert(int_result == SQLITE_OK);
@ -1428,8 +1428,8 @@ DYNAMIC_API void release(PEP_SESSION session)
sqlite3_finalize(session->get_trust);
if (session->least_trust)
sqlite3_finalize(session->least_trust);
if (session->mark_compromized)
sqlite3_finalize(session->mark_compromized);
if (session->mark_compromised)
sqlite3_finalize(session->mark_compromised);
if (session->crashdump)
sqlite3_finalize(session->crashdump);
if (session->languagelist)
@ -2926,11 +2926,19 @@ PEP_STATUS get_main_user_fpr(PEP_SESSION session,
return status;
}
// Deprecated
DYNAMIC_API PEP_STATUS mark_as_compromized(
PEP_SESSION session,
const char *fpr
)
{
return mark_as_compromised(session, fpr);
}
DYNAMIC_API PEP_STATUS mark_as_compromised(
PEP_SESSION session,
const char *fpr
)
{
int result;
@ -2940,11 +2948,11 @@ DYNAMIC_API PEP_STATUS mark_as_compromized(
if (!(session && fpr && fpr[0]))
return PEP_ILLEGAL_VALUE;
sqlite3_reset(session->mark_compromized);
sqlite3_bind_text(session->mark_compromized, 1, fpr, -1,
sqlite3_reset(session->mark_compromised);
sqlite3_bind_text(session->mark_compromised, 1, fpr, -1,
SQLITE_STATIC);
result = sqlite3_step(session->mark_compromized);
sqlite3_reset(session->mark_compromized);
result = sqlite3_step(session->mark_compromised);
sqlite3_reset(session->mark_compromised);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_TRUST;
@ -3142,7 +3150,7 @@ DYNAMIC_API PEP_STATUS export_key(
key_data, size, false);
}
DYNAMIC_API PEP_STATUS export_secrect_key(
DYNAMIC_API PEP_STATUS export_secret_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
)
{
@ -3162,6 +3170,14 @@ DYNAMIC_API PEP_STATUS export_secrect_key(
key_data, size, true);
}
// Deprecated
DYNAMIC_API PEP_STATUS export_secrect_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
)
{
return export_secret_key(session, fpr, key_data, size);
}
DYNAMIC_API PEP_STATUS find_keys(
PEP_SESSION session, const char *pattern, stringlist_t **keylist
)


+ 20
- 2
src/pEpEngine.h View File

@ -431,7 +431,8 @@ typedef enum _PEP_comm_type {
PEP_ct_b0rken_crypto = 0x0b,
PEP_ct_key_too_short = 0x0c,
PEP_ct_compromized = 0x0e, // known compromized connection
PEP_ct_compromised = 0x0e, // known compromised connection
PEP_ct_compromized = 0x0e, // deprecated misspelling
PEP_ct_mistrusted = 0x0f, // known mistrusted key
// range 0x10 to 0x3f: unconfirmed encryption
@ -742,12 +743,21 @@ DYNAMIC_API PEP_STATUS unset_identity_flags(
identity_flags_t flags
);
// mark_as_compromized() - mark key in trust db as compromized
// mark_as_compromised() - mark key in trust db as compromised
//
// parameters:
// session (in) session handle
// fpr (in) fingerprint of key to mark
DYNAMIC_API PEP_STATUS mark_as_compromised(
PEP_SESSION session,
const char *fpr
);
// mark_as_compromized() - deprecated to fix misspelling. Please move to
// mark_as_compromised();
DYNAMIC_API PEP_STATUS mark_as_compromized(
PEP_SESSION session,
const char *fpr
@ -861,6 +871,14 @@ DYNAMIC_API PEP_STATUS export_key(
// the caller is responsible to free() it (on Windoze use pEp_free())
// beware of leaking secret key data - overwrite it in memory after use
DYNAMIC_API PEP_STATUS export_secret_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
);
// export_secrect_key() - deprecated misspelled function. Please replace with
// export_secret_key
DYNAMIC_API PEP_STATUS export_secrect_key(
PEP_SESSION session, const char *fpr, char **key_data, size_t *size
);


+ 1
- 1
src/pEp_internal.h View File

@ -150,7 +150,7 @@ struct _pEpSession {
sqlite3_stmt *update_trust_for_fpr;
sqlite3_stmt *get_trust;
sqlite3_stmt *least_trust;
sqlite3_stmt *mark_compromized;
sqlite3_stmt *mark_compromised;
sqlite3_stmt *reset_trust;
sqlite3_stmt *crashdump;
sqlite3_stmt *languagelist;


+ 1
- 1
src/sync_impl.c View File

@ -894,7 +894,7 @@ PEP_STATUS unicast_msg(
goto enomem;
char *key = NULL;
size_t size = 0;
status = export_secrect_key(session, fpr, &key, &size);
status = export_secret_key(session, fpr, &key, &size);
if (status != PEP_STATUS_OK)
goto error;
bloblist_t *bl = bloblist_add(_message->attachments,


+ 32
- 0
test/convenience_scripts/DANGER_delete_keys_silently_w_pattern.py View File

@ -0,0 +1,32 @@
import argparse
import gnupg
import os
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("pattern")
parser.add_argument("--priv", "-p", help="also delete associated private keys", action='store_true')
args = parser.parse_args()
homedir = os.path.join(os.path.expanduser('~'),".gnupg")
print("GNUPGHOME=" + homedir + "\n")
try:
gpg = gnupg.GPG(gnupghome=homedir)
except TypeError:
gpg = gnupg.GPG(homedir=homedir)
if not args.pattern:
raise Exception("No pattern? How'd you do that?")
public_keys = gpg.list_keys(keys=args.pattern) # same as gpg.list_keys(False)
for key in public_keys:
print("Deleting keys...\n")
for uid in key['uids']:
print(uid + " ")
print(key['fingerprint'] + "\n")
if args.priv:
gpg.delete_keys(key['fingerprint'], True)
gpg.delete_keys(key['fingerprint'])

+ 101
- 0
test/convenience_scripts/keygen_for_test.py View File

@ -0,0 +1,101 @@
import argparse
import gnupg
import os
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("num_keys", type=int)
parser.add_argument("real_name_prefix")
parser.add_argument("email_address_prefix")
parser.add_argument("output_root", help="root of where to stick the keys (keys go into pub/ and priv/ accordingly)")
parser.add_argument("--no_suffix", "-x", help="Use name and email address as is - do not create incremental ones based on the input", action='store_true')
parser.add_argument("--hgadd", "-a", help="hg add the created keyfiles", action='store_true')
args = parser.parse_args()
pub_path = os.path.join(args.output_root, "pub")
priv_path = os.path.join(args.output_root, "priv")
homedir = os.path.join(os.path.expanduser('~'),".gnupg")
print("GNUPGHOME=" + homedir + "\n")
try:
gpg = gnupg.GPG(gnupghome=homedir)
except TypeError:
gpg = gnupg.GPG(homedir=homedir)
name = args.real_name_prefix
email = args.email_address_prefix
suffix = not args.no_suffix
name_prefix = args.real_name_prefix + " "
e_split = args.email_address_prefix.split('@')
e_split_len = len(e_split)
if (e_split_len > 2):
for j in range(e_split_len - 1):
email_0 = email_0 + e_split[j] + "@"
email_0 = email_0 + _ + i_str + e_split[e_split_len - 1]
email_1 = e_split_len[e_split_len - 1]
e_split = [email_0, email_1]
e_split_len = 2
elif (e_split_len == 0):
email_0 = "doge"
email_1 = "dogepile.me"
e_split = [email_0, email_1]
e_split_len = 2
num_keys = args.num_keys
for i in range(num_keys):
i_str = str(i)
if suffix:
name = name_prefix + i_str
if e_split_len == 1:
email = e_split[0] + "_" + i_str
elif e_split_len == 2:
email = e_split[0] + "_" + i_str + "@" + e_split[1]
print("Generating key data for " + name + " " + email + "\n")
input_data = gpg.gen_key_input(key_type="RSA", key_length=2048, subkey_type="RSA", subkey_length=2048, expire_date=0, name_real=name, name_email=email, password="")
if not input_data:
raise Exception('Input data not created in iteration ' + str(i))
print(input_data)
key = None
key = gpg.gen_key(input_data)
if not key:
raise Exception('Key not created in iteration ' + str(i))
pubkey = None
privkey = None
fpr = key.fingerprint
print("Generated " + fpr)
key_filename_prefix = e_split[0] + "_" + i_str + "-0x" + fpr[-8:] + "_"
pubkey = gpg.export_keys(fpr)
privkey = gpg.export_keys(fpr, True)
pubkey_filename = os.path.join(pub_path, key_filename_prefix + "pub.asc")
privkey_filename = os.path.join(priv_path, key_filename_prefix + "priv.asc")
# Write to file
pubkey_file = open(pubkey_filename,'w')
pubkey_file.write(pubkey)
pubkey_file.close()
privkey_file = open(privkey_filename,'w')
privkey_file.write(privkey)
privkey_file.close()
# Delete keys from keyring
gpg.delete_keys(fpr, True) # True => private keys
gpg.delete_keys(fpr)
if (args.hgadd):
subprocess.run(["hg", "add", pubkey_filename])
subprocess.run(["hg", "add", privkey_filename])

+ 146
- 0
test/decrypt_attach_private_key_trusted_test.cc View File

@ -0,0 +1,146 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#include <stdlib.h>
#include <string.h>
#include "platform.h"
#include <iostream>
#include <fstream>
#include <assert.h>
#include "mime.h"
#include "message_api.h"
#include "keymanagement.h"
#include "test_util.h"
using namespace std;
int main() {
cout << "\n*** decrypt_attach_private_key_trusted_test ***\n\n";
PEP_SESSION session;
cout << "calling init()\n";
PEP_STATUS status1 = init(&session);
assert(status1 == PEP_STATUS_OK);
assert(session);
cout << "init() completed.\n";
const char* own_uid = PEP_OWN_USERID;
cout << "Importing keys..." << endl;
string input_key;
const char* main_addr = "priv-key-import-test-main@darthmama.cool";
pEp_identity* main_me = NULL;
const char* fpr_main_me = "13A9F97964A2B52520CAA40E51BCA783C065A213";
pEp_identity* same_addr_same_uid = NULL;
const char* fpr_same_addr_same_uid = "8AB616A3BD51DEF714B5E688EFFB540C3276D2E5";
PEP_STATUS status = PEP_STATUS_OK;
// key for main own user
//
// 13A9F97964A2B52520CAA40E51BCA783C065A213
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
// ensure there's no private key - doesn't work in automated tests, sadly. Uncommon when running script manually.
bool has_priv = false;
// status = contains_priv_key(session, fpr_same_addr_same_uid, &has_priv);
// if (status == PEP_STATUS_OK && has_priv) {
// cout << "SORRY, have to delete keys here to run test correctly..." << endl;
// status = delete_keypair(session, fpr_same_addr_same_uid);
// if (status == PEP_STATUS_OK) {
// has_priv = false;
// status = contains_priv_key(session, fpr_same_addr_same_uid, &has_priv);
// assert(has_priv == false);
// cout << "Successfully deleted keypair for " << fpr_same_addr_same_uid << " - will now import the public key only" << endl;
// }
// else
// cout << "Warning - delete keypair returned status " << tl_status_string(status) << ". This may or may not be an error, depending on what you expect." << endl;
// }
// key with same address and user_id
// 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
cout << "Setting up own identity with default key " << fpr_main_me << endl;
// Own identity with default key etc
main_me = new_identity(main_addr, fpr_main_me, own_uid, "PrivateKey Import Test");
status = set_own_key(session, main_me, fpr_main_me);
assert(status == PEP_STATUS_OK);
assert(strcmp(main_me->fpr, fpr_main_me) == 0);
cout << "Done!" << endl << endl;
cout << "Setting up sender identities and resetting key trust." << endl;
cout << "Same address, same user_id - address: " << main_addr << ", user_id: " << own_uid << ", fpr: " << fpr_same_addr_same_uid << endl;
same_addr_same_uid = new_identity(main_addr, fpr_same_addr_same_uid, own_uid, "PrivateKey Import Test");
assert(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
assert((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed);
status = key_reset_trust(session, same_addr_same_uid);
cout << "Done!" << endl << endl;
cout << "Reading in message..." << endl;
string encoded_text = slurp("test_mails/priv_key_attach.eml");
cout << "Starting test..." << endl;
// Case 1:
// Same address, same user_id, untrusted
cout << "decrypt with attached private key: Same address, same user_id, trusted" << endl;
char* decrypted_text = NULL;
stringlist_t* keylist_used = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags;
cout << "Trusting personal key for " << same_addr_same_uid->user_id << " and " << same_addr_same_uid->fpr << endl;
status = trust_personal_key(session, same_addr_same_uid);
cout << "Status is " << tl_status_string(status) << endl;
assert(status == PEP_STATUS_OK);
free(decrypted_text);
decrypted_text = NULL;
status = get_trust(session, same_addr_same_uid);
cout << tl_ct_string(same_addr_same_uid->comm_type) << endl;
assert(same_addr_same_uid->comm_type == PEP_ct_pEp);
status = MIME_decrypt_message(session, encoded_text.c_str(),
encoded_text.size(), &decrypted_text,
&keylist_used, &rating, &flags);
status = get_trust(session, same_addr_same_uid);
assert(same_addr_same_uid->comm_type == PEP_ct_pEp);
status = MIME_decrypt_message(session, encoded_text.c_str(),
encoded_text.size(), &decrypted_text,
&keylist_used, &rating, &flags);
cout << "Status: " << tl_status_string(status) << endl;
assert(status == PEP_STATUS_OK);
cout << decrypted_text << endl;
has_priv = false;
status = contains_priv_key(session, fpr_same_addr_same_uid, &has_priv);
assert(has_priv == true);
cout << "Private key was also imported." << endl;
cout << "PASS!" << endl;
status = key_reset_trust(session, main_me);
status = key_reset_trust(session, same_addr_same_uid);
release(session);
return 0;
}

+ 125
- 0
test/decrypt_attach_private_key_untrusted_test.cc View File

@ -0,0 +1,125 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#include <stdlib.h>
#include <string.h>
#include "platform.h"
#include <iostream>
#include <fstream>
#include <assert.h>
#include "mime.h"
#include "message_api.h"
#include "keymanagement.h"
#include "test_util.h"
using namespace std;
int main() {
cout << "\n*** decrypt_attach_private_key_untrusted_test ***\n\n";
PEP_SESSION session;
cout << "calling init()\n";
PEP_STATUS status1 = init(&session);
assert(status1 == PEP_STATUS_OK);
assert(session);
cout << "init() completed.\n";
const char* own_uid = PEP_OWN_USERID;
cout << "Importing keys..." << endl;
string input_key;
const char* main_addr = "priv-key-import-test-main@darthmama.cool";
pEp_identity* main_me = NULL;
const char* fpr_main_me = "13A9F97964A2B52520CAA40E51BCA783C065A213";
pEp_identity* same_addr_same_uid = NULL;
const char* fpr_same_addr_same_uid = "8AB616A3BD51DEF714B5E688EFFB540C3276D2E5";
PEP_STATUS status = PEP_STATUS_OK;
// key for main own user
//
// 13A9F97964A2B52520CAA40E51BCA783C065A213
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
// ensure there's no private key - doesn't work in automated tests, sadly. Uncommon when running script manually.
bool has_priv = false;
// status = contains_priv_key(session, fpr_same_addr_same_uid, &has_priv);
// if (status == PEP_STATUS_OK && has_priv) {
// cout << "SORRY, have to delete keys here to run test correctly..." << endl;
// status = delete_keypair(session, fpr_same_addr_same_uid);
// if (status == PEP_STATUS_OK)
// cout << "Successfully deleted keypair for " << fpr_same_addr_same_uid << " - will now import the public key only" << endl;
// }
// key with same address and user_id
// 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
cout << "Setting up own identity with default key " << fpr_main_me << endl;
// Own identity with default key etc
main_me = new_identity(main_addr, fpr_main_me, own_uid, "PrivateKey Import Test");
status = set_own_key(session, main_me, fpr_main_me);
assert(status == PEP_STATUS_OK);
assert(strcmp(main_me->fpr, fpr_main_me) == 0);
cout << "Done!" << endl << endl;
cout << "Setting up sender identities and resetting key trust." << endl;
cout << "Same address, same user_id - address: " << main_addr << ", user_id: " << own_uid << ", fpr: " << fpr_same_addr_same_uid << endl;
same_addr_same_uid = new_identity(main_addr, fpr_same_addr_same_uid, own_uid, "PrivateKey Import Test");
assert(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
assert((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed);
status = key_reset_trust(session, same_addr_same_uid);
cout << "Done!" << endl << endl;
cout << "Reading in message..." << endl;
string encoded_text = slurp("test_mails/priv_key_attach.eml");
cout << "Starting tests..." << endl;
// Case 1:
// Same address, same user_id, untrusted
cout << "Same address, same user_id, untrusted" << endl;
char* decrypted_text = NULL;
stringlist_t* keylist_used = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags;
status = get_trust(session, same_addr_same_uid);
cout << tl_ct_string(same_addr_same_uid->comm_type) << endl;
assert((same_addr_same_uid->comm_type & PEP_ct_confirmed) != PEP_ct_confirmed);
status = MIME_decrypt_message(session, encoded_text.c_str(),
encoded_text.size(), &decrypted_text,
&keylist_used, &rating, &flags);
status = get_trust(session, same_addr_same_uid);
assert(same_addr_same_uid->comm_type == PEP_ct_pEp_unconfirmed);
cout << "Case 1 Status: " << tl_status_string(status) << endl;
cout << "Private key is not trusted for " << same_addr_same_uid->fpr << ", as desired, as the public key was not trusted." << endl;
cout << "PASS!" << endl;
// Case 2:
cout << decrypted_text << endl;
status = key_reset_trust(session, main_me);
status = key_reset_trust(session, same_addr_same_uid);
release(session);
return 0;
}

+ 292
- 0
test/encrypt_attach_private_key_test.cc View File

@ -0,0 +1,292 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#include <stdlib.h>
#include <string.h>
#include "platform.h"
#include <iostream>
#include <fstream>
#include <assert.h>
#include "mime.h"
#include "message_api.h"
#include "keymanagement.h"
#include "test_util.h"
using namespace std;
int main() {
cout << "\n*** encrypt_attach_private_key_test ***\n\n";
PEP_SESSION session;
cout << "calling init()\n";
PEP_STATUS status1 = init(&session);
assert(status1 == PEP_STATUS_OK);
assert(session);
cout << "init() completed.\n";
const char* own_uid = PEP_OWN_USERID;
const char* diff_uid_0 = "TASTY_TEST_UID_0";
const char* diff_uid_1 = "TASTY_TEST_UID_1";
cout << "Importing keys..." << endl;
string input_key;
const char* main_addr = "priv-key-import-test-main@darthmama.cool";
pEp_identity* main_me = NULL;
const char* fpr_main_me = "8AB616A3BD51DEF714B5E688EFFB540C3276D2E5";
pEp_identity* same_addr_same_uid = NULL;
const char* fpr_same_addr_same_uid = "359DD8AC87D1F5E4304D08338D7185F180C8CD87";
pEp_identity* same_addr_diff_uid = NULL;
const char* fpr_same_addr_diff_uid = "B044B83639E292283A3F6E14C2E64B520B74809C";
const char* diff_addr_0 = "priv-key-import-test-other_0@darthmama.cool";
pEp_identity* diff_addr_same_uid = NULL;
const char* fpr_diff_addr_same_uid = "C52911EBA0D34B0F549594A15A7A363BD11252C9";
const char* diff_addr_1 = "priv-key-import-test-other_1@darthmama.cool";
pEp_identity* diff_addr_diff_uid = NULL;
const char* fpr_diff_addr_diff_uid = "567212EFB8A3A76B1D32B9565F45BEA9C785F20A";
PEP_STATUS status = PEP_STATUS_OK;
// key for main own user
// 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0x3276D2E5_priv.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
// key with same address and user_id (initially untrusted, then trusted)
// 359DD8AC87D1F5E4304D08338D7185F180C8CD87
input_key = slurp("test_keys/pub/priv-key-import-test-main_1-0x80C8CD87_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
// key with same address and to have different (non-aliased) user_id (initially untrusted, then trusted)
// B044B83639E292283A3F6E14C2E64B520B74809C
input_key = slurp("test_keys/pub/priv-key-import-test-main_2-0x0B74809C_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
// key with different address to have same user_id (initially untrusted, then trusted)
// C52911EBA0D34B0F549594A15A7A363BD11252C9
input_key = slurp("test_keys/pub/priv-key-import-test-other_0-0xD11252C9_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
// key with different address to have different user_id (initially untrusted, then trusted)
// 567212EFB8A3A76B1D32B9565F45BEA9C785F20A
input_key = slurp("test_keys/pub/priv-key-import-test-other_1-0xC785F20A_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
assert(status == PEP_STATUS_OK);
cout << "Done!" << endl << endl;
cout << "Setting up own identity with default key " << fpr_main_me << endl;
// Own identity with default key etc
main_me = new_identity(main_addr, fpr_main_me, own_uid, "PrivateKey Import Test");
status = set_own_key(session, main_me, fpr_main_me);
assert(status == PEP_STATUS_OK);
assert(strcmp(main_me->fpr, fpr_main_me) == 0);
cout << "Done!" << endl << endl;
cout << "Setting up recipient identities and resetting key trust." << endl;
cout << "#1: same address, same user_id - address: " << main_addr << ", user_id: " << own_uid << ", fpr: " << fpr_same_addr_same_uid << endl;
// Identity with same address and user_id - the fpr here will be ignored in update_identity and friends.
same_addr_same_uid = new_identity(main_addr, fpr_same_addr_same_uid, own_uid, "PrivateKey Import Test");
status = key_reset_trust(session, same_addr_same_uid);
assert(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
assert(strcmp(same_addr_same_uid->fpr, fpr_same_addr_same_uid) == 0);
// Identity with same address and different user_id
cout << "#2: same address, different user_id - address: " << main_addr << ", user_id: " << diff_uid_0 << ", fpr: " << fpr_same_addr_diff_uid << endl;
same_addr_diff_uid = new_identity(main_addr, fpr_same_addr_diff_uid, diff_uid_0, "PrivateKey Import Test");
assert(same_addr_diff_uid);
status = key_reset_trust(session, same_addr_diff_uid);
assert(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
assert(strcmp(same_addr_diff_uid->fpr, fpr_same_addr_diff_uid) == 0);
// Identity with diff address and same user_id
cout << "#3: different address, same user_id - address: " << diff_addr_0 << ", user_id: " << own_uid << ", fpr: " << fpr_diff_addr_same_uid << endl;
diff_addr_same_uid = new_identity(diff_addr_0, fpr_diff_addr_same_uid, own_uid, "PrivateKey Import Test");
assert(diff_addr_same_uid);
status = key_reset_trust(session, diff_addr_same_uid);
assert(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
assert(strcmp(diff_addr_same_uid->fpr, fpr_diff_addr_same_uid) == 0);
// Identity with different address and different user_id
cout << "#4: different address, different user_id - address: " << diff_addr_1 << ", user_id: " << diff_uid_1 << ", fpr: " << fpr_diff_addr_diff_uid << endl;
diff_addr_diff_uid = new_identity(diff_addr_1, fpr_diff_addr_diff_uid, diff_uid_1, "PrivateKey Import Test");
assert(diff_addr_diff_uid);
status = key_reset_trust(session, diff_addr_diff_uid);
assert(status == PEP_STATUS_OK || status == PEP_CANNOT_FIND_IDENTITY);
assert(strcmp(diff_addr_diff_uid->fpr, fpr_diff_addr_diff_uid) == 0);
cout << "Done!" << endl << endl;
message* msg_same_addr_same_uid = new_message(PEP_dir_outgoing);
msg_same_addr_same_uid->from = main_me;
msg_same_addr_same_uid->shortmsg = strdup("Greetings, humans!");
msg_same_addr_same_uid->longmsg = strdup("This is a test of the emergency message system. This is only a test. BEEP.");
msg_same_addr_same_uid->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
message* msg_same_addr_diff_uid = message_dup(msg_same_addr_same_uid);
message* msg_diff_addr_same_uid = message_dup(msg_same_addr_same_uid);
message* msg_diff_addr_diff_uid = message_dup(msg_same_addr_same_uid);
cout << "Starting tests..." << endl;
// Case 1:
// Same address, same user_id, untrusted
cout << "Case 1: Same address, same user_id, untrusted" << endl;
assert(msg_same_addr_same_uid);
identity_list* to_list = new_identity_list(same_addr_same_uid);
msg_same_addr_same_uid->to = to_list;
message* enc_same_addr_same_uid_untrusted = NULL;
status = encrypt_message_and_add_priv_key(session,
msg_same_addr_same_uid,
&enc_same_addr_same_uid_untrusted,
fpr_same_addr_same_uid,
PEP_enc_PGP_MIME,
0);
cout << "Case 1 Status: " << tl_status_string(status) << endl;
assert(status == PEP_ILLEGAL_VALUE);
cout << "PASS!" << endl;
// Case 2:
// Same address, same_user_id, trusted
cout << "Case 2: Same address, same user_id, trusted" << endl;
status = trust_personal_key(session, same_addr_same_uid);
assert(status == PEP_STATUS_OK);
message* enc_same_addr_same_uid_trusted = NULL;
status = encrypt_message_and_add_priv_key(session,
msg_same_addr_same_uid,
&enc_same_addr_same_uid_trusted,
fpr_same_addr_same_uid,
PEP_enc_PGP_MIME,
0);
cout << "Case 2 Status: " << tl_status_string(status) << endl;
assert(status == PEP_STATUS_OK);
cout << "PASS!" << endl;
// Case 3:
// Different address, same user_id, untrusted
cout << "Case 3: Different address, same user_id, untrusted" << endl;
assert(msg_diff_addr_same_uid);
identity_list* to_list_1 = new_identity_list(diff_addr_same_uid);
msg_diff_addr_same_uid->to = to_list_1;
message* enc_diff_addr_same_uid_untrusted = NULL;
status = encrypt_message_and_add_priv_key(session,
msg_diff_addr_same_uid,
&enc_diff_addr_same_uid_untrusted,
fpr_diff_addr_same_uid,
PEP_enc_PGP_MIME,
0);
cout << "Case 3 Status: " << tl_status_string(status) << endl;
assert(status == PEP_ILLEGAL_VALUE);
cout << "PASS!" << endl;
// Case 4:
// Different address, same user_id, trusted
cout << "Case 4: Different address, same user_id, trusted" << endl;
status = trust_personal_key(session, diff_addr_same_uid);
assert(status == PEP_STATUS_OK);
message* enc_diff_addr_same_uid_trusted = NULL;
status = encrypt_message_and_add_priv_key(session,
msg_diff_addr_same_uid,
&enc_diff_addr_same_uid_trusted,
fpr_diff_addr_same_uid,
PEP_enc_PGP_MIME,
0);
cout << "Case 4 Status: " << tl_status_string(status) << endl;
assert(status == PEP_ILLEGAL_VALUE);
cout << "PASS!" << endl;
// Case 5:
// Same address, different user_id, untrusted
cout << "Case 5: Same address, different user_id, untrusted" << endl;
assert(msg_same_addr_diff_uid);
identity_list* to_list_2 = new_identity_list(same_addr_diff_uid);
msg_same_addr_diff_uid->to = to_list_2;
message* enc_same_addr_diff_uid_untrusted = NULL;
status = encrypt_message_and_add_priv_key(session,
msg_same_addr_diff_uid,
&enc_same_addr_diff_uid_untrusted,
fpr_same_addr_diff_uid,
PEP_enc_PGP_MIME,
0);
cout << "Case 5 Status: " << tl_status_string(status) << endl;
assert(status == PEP_ILLEGAL_VALUE);
cout << "PASS!" << endl;
// Case 6:
// Same address, different user_id, trusted
cout << "Case 6: Same address, different user_id, trusted" << endl;
status = trust_personal_key(session, same_addr_diff_uid);
assert(status == PEP_STATUS_OK);
message* enc_same_addr_diff_uid_trusted = NULL;
status = encrypt_message_and_add_priv_key(session,
msg_same_addr_diff_uid,
&enc_same_addr_diff_uid_untrusted,
fpr_same_addr_diff_uid,
PEP_enc_PGP_MIME,
0);
cout << "Case 6 Status: " << tl_status_string(status) << endl;
assert(status == PEP_ILLEGAL_VALUE);
cout << "PASS!" << endl;
// Case 7:
// Different address, different user_id, untrusted
cout << "Case 7: Different address, different user_id, untrusted" << endl;
assert(msg_diff_addr_diff_uid);
identity_list* to_list_3 = new_identity_list(diff_addr_diff_uid);
msg_diff_addr_diff_uid->to = to_list_3;
message* enc_diff_addr_diff_uid_untrusted = NULL;
status = encrypt_message_and_add_priv_key(session,
msg_diff_addr_diff_uid,
&enc_diff_addr_diff_uid_untrusted,
fpr_diff_addr_diff_uid,
PEP_enc_PGP_MIME,
0);
cout << "Case 7 Status: " << tl_status_string(status) << endl;
assert(status == PEP_ILLEGAL_VALUE);
cout << "PASS!" << endl;
// Case 8:
// Different address, different user_id, trusted
cout << "Case 8: Different address, different user_id, trusted" << endl;
status = trust_personal_key(session, diff_addr_diff_uid);
assert(status == PEP_STATUS_OK);
message* enc_diff_addr_diff_uid_trusted = NULL;
status = encrypt_message_and_add_priv_key(session,
msg_diff_addr_diff_uid,
&enc_diff_addr_diff_uid_trusted,
fpr_diff_addr_diff_uid,
PEP_enc_PGP_MIME,
0);
cout << "Case 8 Status: " << tl_status_string(status) << endl;
assert(status == PEP_ILLEGAL_VALUE);
cout << "PASS!" << endl;
cout << "Correctly encrypted message:" << endl << endl;
char* encrypted_msg_text = NULL;
mime_encode_message(enc_same_addr_same_uid_trusted, false, &encrypted_msg_text);
cout << encrypted_msg_text << endl << endl;
// FIXME: Free all the damned things
release(session);
return 0;
}

+ 63
- 0
test/test_keys/priv/priv-key-import-test-main_0-0x3276D2E5_priv.asc View File

@ -0,0 +1,63 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQOYBFrPrZIBCAD7Xnh/WJda9mBwu9lAkJ9ON1KCo9JFvjw89TKA3nOT55NKMUjE
4D5pZm0DhipUBSB6ylVC+FkxdTydeqHeV4/ktBITi/hc5qiMPt0fVS9jlX2rUl2z
vvXmAX5erHx6bXkptbZdOtCOr1hRzU3An/KODdyAcIRClBYkeR1sB4/dLvfqLAMQ
UpoimWQrzS9+AOtU5tMGFjmhjF3T+cRXdL5zgPaIGzt9oV3dHZYgGGSgDxXNFK1D
4jUv2AsyZYL4qLnWvZlbBHvaTbbsP+K5xXI6VpzPWEIHT4v4j0+agGrzLsemQsqT
lsYopII8AtQIc7qWL+DvqUbnBCiamUBYPaKlABEBAAEAB/41kmB1aXzWZMhQdmR6
i2f8PDOgRog/l2fQqQQyrVYuCS5do0vKM61xeqQUmnEmd3JA4SLTM0kVDpKU0Ggz
ke9Hk23/zvanW/xDaXloXlgLbfZ6vwLb1kCjXKGhTTr5P6ARONotG+YLZsjYpDvk
J+KCjmc2U2SIqPVgIBTaa3Eodtg7OMnRrSILlqFvxYRcV3Z/lDXNGwyZ+hcDX/tJ
TXQMwAxPh+Z3fbMfi1GhlDd+Axq9Atb4sF4WJLc3/YY33x032UnkZ8A6LAZcdrUX
e+Qtu2su8906Dbnf+roqEzISfjuyZS4mWnTWgjtKtz0rOzLhMj/YPOeFYRtHZ21x
GVahBAD7qx+9T6JiCljn+CTZBQ9sS3C+t/4odW6wFii2HPSZikPvw9nKluSOetfv
YVuL9uk7IMPBfwYrYlPsY1F9BTs0nrtLjcAWUeFL/YIv6GS3w9c3GsQPgUxRTK8V
Gl2onpNX1nTrg/wb3ZZF+RIomlqvc4kO7HEmMCxWivL5MnZjIQQA/7IHBBiCu4/I
fMfrGz3ZwlIIuCqArHhRcFUJaJCfSYOeSTX9Z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EiTKVJggAhe69Q1ezvnSg0k06HKrL
ApTWFzcQEe8msjLQ5Y2Ucyuo5ssBZ/NZ6Plnfv2E+Ft4nWY+8hkyDCWvmWRcAz2o
nEHwG6lNLTEcXG6rKCtzOyIt2A7OWFNwckLPN71JGFMIwliNKTgSBBWAqDiBcjw3
QKj70slZOOrKa0+YqChH2wThOHtMFoiZYXM3OSq0whAcninita0VOXopNhNxcYvJ
V80JWbLlTXzR5B+fMwQFndQNy04uA0HLi1ubTSipDHIxmiBK0ZyLsnwHvfmOlPG4
zMQAubxrda2GtPr26WQ1AW2x2v5zTbcqBYl/BaMEItYVRO6VcpTRYuHmiriAhGff
qTknB/9jgoPVD/YUiVgrVjNWN1aY0DZig0jrk6BSNXPW5QAMcfr3LBZ20cgQ4ved
9IOh66wnxvPi2LMXB8SWyeSO0LMql75Keh61GLqh8FyZP7yxUAhodyVdic5R/ALA
U5S9Eve1Fw72YPOmAAYrjcDlKy2P1yxAZnyU9yDsmPXMSxCb75mGsAcCqsjZzyBn
mXKU3TES6Yl3JF11oV9romIPZOk4sqHDXozS9BOdxu0IyXmvUJorlpNnP5HIQELf
rhRiYx+QwBpSmNAyUseRizvdXmzdrvDrIEgyV4cyFIRFbRZKxTJ6ecGmC5P5+g7w
k4Ovdx8fotrONgZ5tXgu7cF/HLZw
=l1fW
-----END PGP PRIVATE KEY BLOCK-----

+ 63
- 0
test/test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc View File

@ -0,0 +1,63 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQOYBFrQoQUBCADZri/DgdFOns76UcS+fWryl/wOWTeWOTT5PntcYf+XcU+vNe0R
O7G0xZMP9udyj1amV7cydlxafX1CIL1KNXlQGg5vXNd3Kdw9Jp5EfLjrr36g8+1P
jlXemFRKpqpcOQd/IEj/wrF9kQRAl/UIyLY7uGl9SA9KSgVn3rUhuCH++sLZuPkg
uIaAGstGbe/0Ua1+OEdWFVefTvti9T6aA01KEN3pVmWmqS0xP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ny3ryx29MMBce8U0XAPqRiG5wdindm3UfZBNUrqPF2MwFEG
gWYomVYjDAfeo2kYXdNh3AhP0f8ucGWdXTmYstcuTrd9Gd9zMoez/xmvmkpPO5i3
V3l+jhP95PzPM+QEh+Qe0C/O5RcXaYBXEOO6V2AwiEi1hy8iXoGmaf+WQ2oyyDEC
be6x2N11Qg088v29VbD26c2cLMs+jsPecJZrjN3SgYg23ybAKERW/z/CQL5by3RU
4ahLXsRIFTQXR5Jf1gwX9WnoJDAKDavwaBVuSEK7gJDLj41ITf3Oi0JmOb0sQb6Y
4bhg7xfj/7Tg5HAey2fWmMZIfAqdxW+DJtJJ8g==
=lesn
-----END PGP PRIVATE KEY BLOCK-----

+ 63
- 0
test/test_keys/priv/priv-key-import-test-main_1-0x80C8CD87_priv.asc View File

@ -0,0 +1,63 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQOYBFrPrZMBCADHliMZZczNc2nXrm+SwDpVekZ7Uz/m2nRRmhH7OCnvIIw4zda3
QDvmJbGKRnlOkAGn7+WoZcmPqu5lfJHzC02sfhqCrGaqdb7RDkYGhulTtgwxf/GV
QGEgroQvDKLLRVAcE/rhIbz9stlWPMLwNlkvfXwGi+q5h2AxIA4uDnx9YcrK0NTz
5F/RCXm/yw/DxTlCK66RdWk1ysmvWGeEkwB8/0lVcgNpifSMc6LhChotGnwxLJe1
fhOTcsep8TdaJ2LHzrSO2rzx8rzMkHCpWrw71vWs1XhO7wTgvptOMDNuXsp4Pzyb
VFsEviWhUJoC5Zf1QF+jwyqm+WWaqr5e38hxABEBAAEAB/0cvngum7Urr6ACMnqa
IXolPldxQnOVDUgsSmqlihir+j2Hnsl6GdOmmS4hEnY9BMtgQtIJ9yLYwI7V6eNh
I/MbUQwDXs3oZc3F8O7P2NU4u6K07E7AJoX2fXvHBORbLw/TA2Oh0ciUpxHa9CRF
ESa2CrX2gWccMi191baFFowCSHZWN/7lG9o6txO0hKcgQ1Ix8BA0gbYlZgGHfS5f
1XU4eQSA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 0
test/test_keys/priv/priv-key-import-test-main_2-0x0B74809C_priv.asc View File

@ -0,0 +1,63 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQOYBFrPrZUBCACnMasfpzRhGDKYjQIN1si1wloLnlfyPoM1QUk+On7Erc3naCYH
DgUUc22oqbBBC1pn5yZpkELg51X3kIJQ+91+iZEHFoqkq+EmjLpmqMqOR//TlAI5
vnxTmwoDJL3PwdXqps1u1pP/ssb9VsZTECA8D3yPBoID1Db2ZhpoMM+u0dq9Rxty
geL8vkcucTMTZhIB9lg0S3R0WTqNPxtWoZiCPjwwvgTbJtI33HrePJKrTqgCCb3K
4CmJsItr14kPArX3cc2ohJvI/6TdpD2+t4ns7RZgB07e94K2LmsZd86nArpZRPiT
360VPibE5DFf7oNCLervmaghjCmYSv6VqauXABEBAAEAB/9C87zXHBn5l7sLI8xi
xlPxlTaB2JLXSvk35kDyTnJdSExgEnDH+nFGU0Lie7E9GtLFMOdM9pwRfBIM5S2K
SJHWDjipYfl7H+k1ir1KRuV2PJbRnz+U6BbZVAiaYagw/iovoUQ60mrJxkmxQYKB
2L9PzdPPYofGCMFJwnFor8M6+eCiGsu5kWW9iGkMHfNesYCh+B0Eeqgt6ZdBqoHj
6nasJ/CEitZi6CUZUdguFF12vomhQAqETh4NB+S20gc4UZOLypF1+Wj7MgWEH08a
PGY/Pwpbf8Fg5kXH9kbMxB5x4shXlTPyA8DKBI6+5M6bariTFQUO1vGuqUvy6Zk5
jIghBADJmfV++l4v0a+89Iu2tPw3H0t3x1vhf6aR65ju5lQpAN5qBH3JtQuHgiHV
E0Rb3IeV8DJ5hysM3ZDdba78WxxrLHAiHPBwbBAKEjl6EtCmFaWRdBkzwudrm+hc
8ra+ohwx7HFHnW2yuToQ4UAGoim3M1MhJoCuhyHlvSAqCmEfOwQA1E7ybWjVUY3y
k9vLMUCEUOveWhRKAyrWlVMWeRYWoOCNxzQ3ilba31EcX8tkupTpyxjjDXCwhhvG
i2Vf250420PTdcXELBk1rML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8IawmAiautdlSXslvYpjgvaues0neQxPOcuQk
lkOxtAMCKjQx5wvJwmB4LdDHLa2Obxve7saf+tGW6057Vx2n0Xc6XTefd830yo4u
zgLj85+bJV2MsglR5gMMfXu5mr5vuaaM6ZWEFWRE80Vv0CFhDLGYaz9a4gTpvte9
E+bQpD5ijvv8xR84LQNstlux2un7SRcDo8DwkmFfcnLJRsG4slcOOHOXovHB4KZ+
sEJ6ERW3IMGUAKIlS99vntTIcE6G/xWdNow+YQbxA3Bs+JK8X2EBVI/5R7DBVp8m
jkN1CACP9hLUib68hgEWZ0vUZLaxUScRZaq1cdwMOEZi7h2LTtqtnEsWWYN1E3G3
Pe1zPd9qcEUZrCo1ut/lXIVvKKoOj+rGTK3LMkQzruv2cXxLkSoVvJ97Zj1Vyaks
/wWqkhNsDmrpsrhxw1WG4fCeWrnEzyQZJyYI855TByfSxWrCrWkhQeY09+S5NZj5
cgMaRBbdy9JLuYFKYkVk8az0IlOj14mjAbKUdvkEt1y8H+TQAFiKr462fMLVN393
glNnlMify7kYXcxihs+CPwJreb+4zuO1Bc0ha8yQxB8xbjb+POkRZ/ATj/b9I7B3
lO713HGXHUDAF9TeXttRXbSYjFHr
=mKNV
-----END PGP PRIVATE KEY BLOCK-----

+ 63
- 0
test/test_keys/priv/priv-key-import-test-other_0-0xD11252C9_priv.asc View File

@ -0,0 +1,63 @@
-----BEGIN PGP PRIVATE KEY BLOCK-----
lQOYBFrPz6oBCADE+Zyw50I47+xY/TKJNH9+cpgaUciU/mhMxMdZug+cvAiNBoOF
tWqPfB2MjcnmhSCM0oGYDkRI7au9u1TVG8fAZ7kOoT3vLosKxQtZdCYWSWHCsMIe
iSZoIDPHXL3cM9410HobVB4UBmot5g0J8hXkkTa+nzArc+kjX+pEgtrI2uWoelVF
msAOROBU44gXudwudcUaql8ZzW7nPd9rmAFmOXnhNvW2TiQe/KLTR3L/Gggt1Ytd
nUejzGrioWf4hZX9zdLqMm1a8H+KWYJdjjrIBLRrH1FUXXPQx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