...
1 // This file is under GNU General Public License 3.0
9 // pgp_init() - initialize PGP backend
12 // session (in) session handle
13 // in_first (in) true if this is the first session
16 // PEP_STATUS_OK if PGP backend was successfully initialized
17 // or any other value on error
19 PEP_STATUS pgp_init(PEP_SESSION session, bool in_first);
22 // pgp_release() - release PGP backend
25 // session (in) session handle
26 // out_last (in) true if this is the last session to release
28 void pgp_release(PEP_SESSION session, bool out_last);
31 // pgp_decrypt_and_verify() - decrypt and verify ciphertext
34 // session (in) session handle
35 // ctext (in) bytes with ciphertext
36 // csize (in) size of ciphertext in bytes
37 // dsigtext (in) pointer to bytes with detached signature
38 // or NULL if no detached signature
39 // dsigsize (in) size of detached signature in bytes
40 // ptext (out) bytes with ciphertext
41 // psize (out) size of ciphertext in bytes
42 // keylist (out) list of keys being used; first is the key being
44 // filename (out) PGP filename, when rendered (Optional, only necessary for some PGP implementations (e.g. Symantec),
45 // *** Mostly internal ***
47 // PEP_DECRYPTED_AND_VERIFIED data could be decryped and verified
48 // PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH
49 // a signature does not match
50 // PEP_DECRYPTED data could be decrypted but not verified
51 // PEP_VERIFIED_AND_TRUSTED data was unencrypted but perfectly signed
52 // PEP_VERIFIED data was unencrypted, signature matches
53 // PEP_DECRYPT_NO_KEY data could not be decrypted because a
55 // PEP_DECRYPT_WRONG_FORMAT data format not readable
56 // PEP_ILLEGAL_VALUE parameters wrong
57 // PEP_OUT_OF_MEMORY out of memory error
58 // PEP_UNKOWN_ERROR internal error
60 PEP_STATUS pgp_decrypt_and_verify(
68 stringlist_t **keylist,
73 // pgp_encrypt_and_sign() - encrypt plaintext and sign
76 // session (in) session handle
77 // keylist (in) first key to sign and encrypt, all other keys to
79 // ptext (in) bytes with plaintext
80 // psize (in) size of plaintext in bytes
81 // ctext (out) bytes with ciphertext, ASCII armored
82 // csize (out) size of ciphertext in bytes
85 // PEP_STATUS_OK successful
86 // PEP_KEY_NOT_FOUND key not in keyring
87 // PEP_KEY_HAS_AMBIG_NAME multiple keys match data in keylist
88 // PEP_GET_KEY_FAILED access to keyring failed
89 // PEP_ILLEGAL_VALUE parameters wrong
90 // PEP_OUT_OF_MEMORY out of memory error
91 // PEP_UNKOWN_ERROR internal error
93 PEP_STATUS pgp_encrypt_and_sign(
95 const stringlist_t *keylist,
102 PEP_STATUS pgp_sign_only(
103 PEP_SESSION session, const char* fpr, const char *ptext,
104 size_t psize, char **stext, size_t *ssize
107 // pgp_encrypt_only() - encrypt plaintext
110 // session (in) session handle
111 // keylist (in) keys to encrypt plaintext
112 // ptext (in) bytes with plaintext
113 // psize (in) size of plaintext in bytes
114 // ctext (out) bytes with ciphertext, ASCII armored
115 // csize (out) size of ciphertext in bytes
118 // PEP_STATUS_OK successful
119 // PEP_KEY_NOT_FOUND key not in keyring
120 // PEP_KEY_HAS_AMBIG_NAME multiple keys match data in keylist
121 // PEP_GET_KEY_FAILED access to keyring failed
122 // PEP_ILLEGAL_VALUE parameters wrong
123 // PEP_OUT_OF_MEMORY out of memory error
124 // PEP_UNKNOWN_ERROR internal error
126 PEP_STATUS pgp_encrypt_only(
128 const stringlist_t *keylist,
136 // pgp_verify_text() - verify signed data
139 // session (in) session handle
140 // keylist (in) keys to encrypt plaintext
141 // text (in) data to verify, may include signature
142 // size (in) size of data to verify in bytes
143 // signature (in) detached signature data or NULL
144 // sig_size (in) size of detached signature in bytes
145 // keylist (out) list of keys being used for signing
148 // PEP_VERIFIED_AND_TRUSTED data was unencrypted but perfectly signed
149 // this is depending on PGP trust concept
150 // PEP_VERIFIED data was unencrypted, signature matches
151 // PEP_DECRYPT_NO_KEY data could not be verified because a
153 // PEP_DECRYPT_WRONG_FORMAT data format not readable
154 // PEP_ILLEGAL_VALUE parameters wrong
155 // PEP_OUT_OF_MEMORY out of memory error
156 // PEP_UNKOWN_ERROR internal error
158 PEP_STATUS pgp_verify_text(
162 const char *signature,
164 stringlist_t **keylist
168 // pgp_delete_keypair() - delete key or keypair
171 // session (in) session handle
172 // fpr (in) fingerprint of key or keypair to delete
174 PEP_STATUS pgp_delete_keypair(PEP_SESSION session, const char *fpr);
177 // pgp_export_keydata() - export public key data ASCII armored
180 // session (in) session handle
181 // fpr (in) fingerprint of public key to export
182 // key_data (out) ascii armored key data
183 // size (out) size of ascii armored key data
184 // secret (in) additionally export private key data
186 PEP_STATUS pgp_export_keydata(
195 // pgp_find_keys() - find keys where fprs are matching a pattern
198 // session (in) session handle
199 // pattern (in) UTF-8 string with pattern
200 // keylist (out) list of fprs matching
202 PEP_STATUS pgp_find_keys(
205 stringlist_t **keylist
209 PEP_STATUS pgp_list_keyinfo(
212 stringpair_list_t** keyinfo_list
215 PEP_STATUS pgp_generate_keypair(
217 pEp_identity *identity
220 PEP_STATUS pgp_get_key_rating(
223 PEP_comm_type *comm_type
226 PEP_STATUS pgp_import_keydata(
228 const char *key_data,
230 identity_list **private_idents
233 PEP_STATUS pgp_import_private_keydata(
235 const char *key_data,
237 identity_list **private_idents
240 PEP_STATUS pgp_recv_key(PEP_SESSION session, const char *pattern);
242 PEP_STATUS pgp_send_key(PEP_SESSION session, const char *pattern);
244 PEP_STATUS pgp_renew_key(
250 PEP_STATUS pgp_revoke_key(
256 PEP_STATUS pgp_key_expired(
263 PEP_STATUS pgp_key_revoked(
269 PEP_STATUS pgp_key_created(
275 PEP_STATUS pgp_contains_priv_key(
281 PEP_STATUS pgp_find_private_keys(
284 stringlist_t **keylist
287 PEP_STATUS pgp_binary(const char **path);
289 // Returns first failure status, if there were any. Keys may have been
290 // imported into DB regardless of status.
292 PEP_STATUS pgp_import_ultimately_trusted_keypairs(PEP_SESSION session);
294 /* Really only internal. */
295 PEP_STATUS pgp_replace_only_uid(
298 const char* realname,
302 PEP_STATUS pgp_config_cipher_suite(PEP_SESSION session,
303 PEP_CIPHER_SUITE suite);
305 #define PGP_BINARY_PATH pgp_binary