diff --git a/libs/netpgp/src/create.c b/libs/netpgp/src/create.c index 2c80856e..22f61dbb 100644 --- a/libs/netpgp/src/create.c +++ b/libs/netpgp/src/create.c @@ -545,9 +545,11 @@ pgp_write_xfer_key(pgp_output_t *output, unsigned subkeysigidx = 0; pgp_subkeysig_t *subkeysigp; + #if 0 ////// -- we don't need armored keys (only armored messages) if (armoured) { pgp_writer_push_armoured(output, PGP_PGP_PUBLIC_KEY_BLOCK); } + #endif ////// /* primary key */ if (key->type == PGP_PTAG_CT_PUBLIC_KEY) { diff --git a/libs/netpgp/src/writer.c b/libs/netpgp/src/writer.c index 83b4c79b..e08d08cf 100644 --- a/libs/netpgp/src/writer.c +++ b/libs/netpgp/src/writer.c @@ -847,23 +847,28 @@ armoured_finaliser(pgp_armor_type_t type, return stacked_write(writer, tail, tailsize, errors); } +#if 0 ////// static unsigned armored_pubkey_fini(pgp_error_t **errors, pgp_writer_t *writer) { return armoured_finaliser(PGP_PGP_PUBLIC_KEY_BLOCK, errors, writer); } +#endif ////// +#if 0 ////// static unsigned armored_privkey_fini(pgp_error_t **errors, pgp_writer_t *writer) { return armoured_finaliser(PGP_PGP_PRIVATE_KEY_BLOCK, errors, writer); } +#endif ////// /* \todo use this for other armoured types */ /** \ingroup Core_WritersNext \brief Push Armoured Writer on stack (generic) */ +#if 0 ////// void pgp_writer_push_armoured(pgp_output_t *output, pgp_armor_type_t type) { @@ -919,6 +924,7 @@ pgp_writer_push_armoured(pgp_output_t *output, pgp_armor_type_t type) pgp_writer_push(output, base64_writer, finaliser, generic_destroyer, base64); } +#endif ////// /**************************************************************************/ diff --git a/src/mre2ee.c b/src/mre2ee.c index b6881688..45651f0b 100644 --- a/src/mre2ee.c +++ b/src/mre2ee.c @@ -66,6 +66,13 @@ static int load_or_generate_public_key__(mrmailbox_t* mailbox, mrkey_t* public_k mrsqlite3_unlock(mailbox->m_sql); /* SIC! unlock database during creation - otherwise the GUI may hang */ + /* The public key must contain the following: + - a signing-capable primary key Kp + - a user id + - a self signature + - an encryption-capable subkey Ke + - a binding signature over Ke by Kp + (see https://autocrypt.readthedocs.io/en/latest/level0.html#type-p-openpgp-based-key-data )*/ key_created = mre2ee_driver_create_keypair(mailbox, self_addr, public_key, private_key); mrsqlite3_lock(mailbox->m_sql); diff --git a/src/mre2ee_driver_openssl.c b/src/mre2ee_driver_openssl.c index 46645f76..8ac1736c 100644 --- a/src/mre2ee_driver_openssl.c +++ b/src/mre2ee_driver_openssl.c @@ -215,7 +215,7 @@ cleanup: if( secout ) { pgp_output_delete(secout); } if( pubmem ) { pgp_memory_free(pubmem); } if( secmem ) { pgp_memory_free(secmem); } - pgp_key_free(&seckey); /* not: pgp_keydata_free() which will also free the pointer itself (we created it on the statck) */ + pgp_key_free(&seckey); /* not: pgp_keydata_free() which will also free the pointer itself (we created it on the stack) */ pgp_key_free(&pubkey); pgp_key_free(&subkey); free(user_id); diff --git a/src/stress.c b/src/stress.c index 3dea7ce4..c6c2253f 100644 --- a/src/stress.c +++ b/src/stress.c @@ -168,10 +168,10 @@ void stress_functions(mrmailbox_t* mailbox) { mrkey_t *public_key = mrkey_new(), *private_key = mrkey_new(); mre2ee_driver_create_keypair(mailbox, "foo@bar.de", public_key, private_key); - /*char* temp = mrkey_render_base64(public_key, 78, " "); - char* tempsec = mrkey_render_base64(private_key, 78, " "); - printf("\nPUBLIC: [%s]\nPRIVATE: [%s]\n", temp, tempsec); - free(temp); free(tempsec);*/ + char* temp = mrkey_render_base64(public_key, 78, "\n"); + char* tempsec = mrkey_render_base64(private_key, 78, "\n"); + printf("\n-----BEGIN PGP PUBLIC KEY BLOCK-----\n\n%s\n-----END PGP PUBLIC KEY BLOCK-----\n\n-----BEGIN PGP PRIVATE KEY BLOCK-----\n\n%s\n-----END PGP PRIVATE KEY BLOCK-----\n", temp, tempsec); + free(temp); free(tempsec); #if 0 mrkey_t *public_key2 = mrkey_new(), *private_key2 = mrkey_new();