text
stringlengths
0
357
if (store_att_flags) {
mailimap_store_att_flags_free(store_att_flags);
}
FREE_SET(set);
}
```
Filename: dc_imex.c
```c
#include <assert.h>
#include <dirent.h>
#include <unistd.h> /* for sleep() */
#include <openssl/rand.h>
#include <libetpan/mmapstring.h>
#include "dc_context.h"
#include "dc_mimeparser.h"
#include "dc_loginparam.h"
#include "dc_aheader.h"
#include "dc_apeerstate.h"
#include "dc_pgp.h"
#include "dc_mimefactory.h"
#include "dc_job.h"
/**
* @name Import/Export
* @{
*/
/*******************************************************************************
* Autocrypt Key Transfer
******************************************************************************/
/**
* Create an Autocrypt Setup Message. A complete Autocrypt Setup Message looks
* like the following:
*
* To: me@mydomain.com
* From: me@mydomain.com
* Autocrypt-Setup-Message: v1
* Content-type: multipart/mixed; boundary="==break1=="
*
* --==break1==
* Content-Type: text/plain
*
* This is the Autocrypt setup message.
*
* --==break1==
* Content-Type: application/autocrypt-setup
* Content-Disposition: attachment; filename="autocrypt-setup-message.html"
*
* <html>
* <body>
* <p>
* This is the Autocrypt Setup File used to transfer keys between clients.
* </p>
* <pre>
* -----BEGIN PGP MESSAGE-----
* Version: BCPG v1.53
* Passphrase-Format: numeric9x4
* Passphrase-Begin: 12
*
* hQIMAxC7JraDy7DVAQ//SK1NltM+r6uRf2BJEg+rnpmiwfAEIiopU0LeOQ6ysmZ0
* CLlfUKAcryaxndj4sBsxLllXWzlNiFDHWw4OOUEZAZd8YRbOPfVq2I8+W4jO3Moe
* -----END PGP MESSAGE-----
* </pre>
* </body>
* </html>
* --==break1==--
*
* The encrypted message part contains:
*
* -----BEGIN PGP PRIVATE KEY BLOCK-----
* Autocrypt-Prefer-Encrypt: mutual
*
* xcLYBFke7/8BCAD0TTmX9WJm9elc7/xrT4/lyzUDMLbuAuUqRINtCoUQPT2P3Snfx/jou1YcmjDgwT
* Ny9ddjyLcdSKL/aR6qQ1UBvlC5xtriU/7hZV6OZEmW2ckF7UgGd6ajE+UEjUwJg2+eKxGWFGuZ1P7a
* 4Av1NXLayZDsYa91RC5hCsj+umLN2s+68ps5pzLP3NoK2zIFGoCRncgGI/pTAVmYDirhVoKh14hCh5
* .....
* -----END PGP PRIVATE KEY BLOCK-----
*
* dc_render_setup_file() renders the body after the second
* `-==break1==` in this example.
*
* @private @memberof dc_context_t
* @param context The context object
* @param passphrase The setup code that shall be used to encrypt the message.
* Typically created by dc_create_setup_code().
* @return String with the HTML-code of the message on success, NULL on errors.
* The returned value must be free()'d
*/
char* dc_render_setup_file(dc_context_t* context, const char* passphrase)
{
sqlite3_stmt* stmt = NULL;
char* self_addr = NULL;
dc_key_t* curr_private_key = dc_key_new();