mail-crypt-key.h revision 4c78d9e646c4a1158d7167806937c02d86cdfc25
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi For mailboxes:
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi shared/<mailbox GUID>/.../crypt/active = digest for the active public key
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi that is used for encrypting new emails
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi shared/<mailbox GUID>/.../crypt/pubkeys/<digest> = <key>
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi private/<mailbox GUID>/.../crypt/privkeys/<digest> = <key>
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi Similarly for users:
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi shared/<INBOX GUID>/.../crypt/active = digest for the active public key that
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi is used for encrypting new folder keys
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi shared/<INBOX GUID>/.../crypt/pubkeys/<digest> = <key>
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi private/<INBOX GUID>/.../crypt/privkeys/<digest> = <key>
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi * key cache management functions
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomivoid mail_crypt_key_cache_destroy(struct mail_crypt_key_cache_entry **cache);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomivoid mail_crypt_key_register_mailbox_internal_attributes(void);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi/* returns -1 on error, 0 not found, 1 = found */
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_get_private_key(struct mailbox *box, const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_user_get_private_key(struct mail_user *user, const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_get_private_key(struct mailbox *box,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_get_private_keys(struct mailbox *box,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_user_get_public_key(struct mail_user *user,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_get_public_key(struct mailbox *box,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_get_shared_key(struct mailbox *box,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi/* returns -1 on error, 0 no match , 1 = match */
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_private_key_id_match(struct dcrypt_private_key *key,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_public_key_id_match(struct dcrypt_public_key *key,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi/* returns -1 on error, 0 = ok */
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_user_set_private_key(struct mail_user *user, const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_set_private_key(struct mailbox *box, const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_user_set_public_key(struct mail_user *user, const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_set_public_key(struct mailbox *box, const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_user_generate_keypair(struct mail_user *user,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **pubid_r,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_generate_keypair(struct mailbox *box,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **pubid_r,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi/* returns -1 on error, 0 = ok */
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_set_shared_key(struct mailbox_transaction_context *t,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_unset_shared_key(struct mailbox_transaction_context *t,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char *pubid,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_share_private_keys(struct mailbox_transaction_context *t,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi/* returns -1 on error, 0 = ok
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi these will also attempt to generate a keypair
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_user_get_or_gen_public_key(struct mail_user *user,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_get_or_gen_public_key(struct mailbox *box,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi/* Lookup all private keys' digests. Returns 0 if ok, -1 on error. */
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomiint mail_crypt_box_get_pvt_digests(struct mailbox *box, pool_t pool,
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi const char **error_r);
4c78d9e646c4a1158d7167806937c02d86cdfc25Aki Tuomi/* is secure sharing enabled */