2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 2016-2023 The Claws Mail team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef PASSWORD_CRYPTO_OLD
25 /* Returns a pointer to primary passphrase, asking the user
26 * if necessary. Do not free the return value. */
27 const gchar
*primary_passphrase();
29 /* Returns TRUE if there is a primary passphrase set in preferences. */
30 gboolean
primary_passphrase_is_set();
31 /* Returns TRUE if input contains correct primary passphrase, as set
33 gboolean
primary_passphrase_is_correct(const gchar
*input
);
34 /* Returns TRUE if primary passphrase is entered (unlocked). */
35 gboolean
primary_passphrase_is_entered();
36 /* Removes (locks) primary passphrase, if it was entered previously
37 * in current session. */
38 void primary_passphrase_forget();
40 /* Changes primary passphrase. Also triggers reencryption of all stored
41 * passwords using the new primary passphrase.
42 * oldp - old primary passphrase; if NULL, it will be retrieved using
43 * primary_passphrase()
44 * newp - new primary passphrase */
45 void primary_passphrase_change(const gchar
*oldp
, const gchar
*newp
);
48 /* Wrapper around the old, DES-CBC-broken implementation which
49 * returns a newly allocated string for the encrypt/decrypt result.
50 * This is for compatibility with with the rest of password-related
52 #ifdef PASSWORD_CRYPTO_OLD
53 gchar
*password_encrypt_old(const gchar
*password
);
55 /* Decryption is still needed for supporting migration of old
56 * configurations to newer encryption mechanisms. */
57 gchar
*password_decrypt_old(const gchar
*password
);
59 #ifdef PASSWORD_CRYPTO_GNUTLS
60 /* GNUTLS implementation */
61 gchar
*password_encrypt_gnutls(const gchar
*password
,
62 const gchar
*encryption_passphrase
);
63 gchar
*password_decrypt_gnutls(const gchar
*password
,
64 const gchar
*decryption_passphrase
);
65 #define password_encrypt_real(n, m) password_encrypt_gnutls(n, m)
66 #define password_decrypt_real(n, m) password_decrypt_gnutls(n, m)
69 /* Wrapper function that will apply best encryption available,
70 * and return a string ready to be saved as-is in preferences. */
71 gchar
*password_encrypt(const gchar
*password
,
72 const gchar
*encryption_passphrase
);
74 /* This is a wrapper function that looks at the whole string from
75 * prefs (e.g. including the leading '!' for old implementation),
76 * and tries to do the smart thing. */
77 gchar
*password_decrypt(const gchar
*password
,
78 const gchar
*decryption_passphrase
);
80 #endif /* __PASSWORD_H */