New API to switch to S/MIME. There is no code yet behind it.

This commit is contained in:
Werner Koch 2001-10-15 12:19:14 +00:00
parent ab7fa2c460
commit 9e7db481a6
9 changed files with 97 additions and 18 deletions

1
THANKS
View File

@ -4,6 +4,7 @@ Enno Cramer uebergeek@web.de
Jan-Oliver Wagner jan@intevation.de Jan-Oliver Wagner jan@intevation.de
Johannes Poehlmann jhp@caldera.de Johannes Poehlmann jhp@caldera.de
Jose C. García Sogo jose@jaimedelamo.eu.org Jose C. García Sogo jose@jaimedelamo.eu.org
Mark Mutz mutz@kde.org
Stéphane Corthésy stephane@sente.ch Stéphane Corthésy stephane@sente.ch
Timo Schulz twoaday@freakmail.de Timo Schulz twoaday@freakmail.de
Tommy Reynolds reynolds@redhat.com Tommy Reynolds reynolds@redhat.com

38
TODO
View File

@ -1,7 +1,5 @@
* Implement posix-sema.c * Implement posix-sema.c
* Add gpgme_mime_xxx to make handling of MIME/PGP easier
* Allow to use GTK's main loop instead of the select stuff in * Allow to use GTK's main loop instead of the select stuff in
wait.c wait.c
@ -10,3 +8,39 @@
* Should --delete silently delete secret keys or is there a need for * Should --delete silently delete secret keys or is there a need for
another flag or a callback? another flag or a callback?
* GpgmeKey misses GPGME_ATTR_EXPIRE attribute
* Add ATTR to return the number of subkeys or uids.
* Return GPGME_Canceled when appropriate
* Implement decrypt+verify
Bugs reported by Stephane Corthesy:
> - When asking a GpgmeKey for one of its sub-userIDs (index > 0)
> GPGME_ATTR_EMAIL attribute, it returns the name + email, whereas for
> the main (index = 0) userID it returns only the email.
> - When returning a GpgmeKey GPGME_ATTR_COMMENT attribute, characters
> like ":" are not un-escaped, they are returned as \x3a
> - When asking a GpgmeKey its main userID (index = 0), it returns the
> last userID it was asked (can be a sub, or the main).
> BTW, here's another bug: it it not possible to retrieve fingerprints
> for subkeys
> In GpgmeRecipients, would it be possible to provide a function which
> would return the validity assigned to a name contained in the
> GpgmeRecipients instance?
> - There is an inconsistent behaviour: if we pass three times an
> invalid (but non empty) passphrase, return code is GPGME_No_Data, but
> if we pass three times an empty (and invalid) passphrase, we get
> GPGME_No_Passphrase.
> passphrase callback. If I use the same GpgmeContext as the one which
> is currently asking for a passphrase, my app crashes: the r_hd in
> the
> callback has become invalid; if I use a brand new one, the callback
> is called recursively, when I ask to enumerate keys.

View File

@ -24,15 +24,12 @@ AC_REVISION($Revision$)dnl
AC_INIT(gpgme/gpgme.h) AC_INIT(gpgme/gpgme.h)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
#############################################
# Version numbers (Remember to change them just before a release) # Version numbers (Remember to change them just before a release)
# 1. No interfaces changed, only implementations (good): Increment REVISION. # (Interfaces removed: CURRENT++, AGE=0, REVISION=0)
# 2. Interfaces added, none removed (good): Increment CURRENT, increment # (Interfaces added: CURRENT++, AGE++, REVISION=0)
# AGE, set REVISION to 0. # (No interfaces changed: REVISION++)
# 3. Interfaces removed (BAD, breaks upward compatibility): Increment
# CURRENT, set AGE and REVISION to 0.
AM_INIT_AUTOMAKE(gpgme,0.2.3a) AM_INIT_AUTOMAKE(gpgme,0.2.3a)
# # XXXX new functions
LIBGPGME_LT_CURRENT=4 LIBGPGME_LT_CURRENT=4
LIBGPGME_LT_AGE=4 LIBGPGME_LT_AGE=4
LIBGPGME_LT_REVISION=0 LIBGPGME_LT_REVISION=0

View File

@ -1,3 +1,13 @@
2001-10-15 Werner Koch <wk@gnupg.org>
* gpgme.h (GpgmeProtocol): New.
* gpgme.c (gpgme_set_protocol): New.
2001-09-26 Werner Koch <wk@gnupg.org>
* gpgme.c (gpgme_set_passphrase_cb): Ignore a NULL context.
(gpgme_set_progress_cb): Ditto. Suggested by Mark Mutz.
2001-09-17 Werner Koch <wk@gnupg.org> 2001-09-17 Werner Koch <wk@gnupg.org>
* keylist.c (finish_key): Shortcut for no tmp_key. Changed all * keylist.c (finish_key): Shortcut for no tmp_key. Changed all

View File

@ -51,6 +51,8 @@ struct gpgme_context_s {
int initialized; int initialized;
int pending; /* a gpg request is still pending */ int pending; /* a gpg request is still pending */
int use_cms;
/* at some points we need to allocate memory but we are not /* at some points we need to allocate memory but we are not
* able to handle a malloc problem at that point, so we set this * able to handle a malloc problem at that point, so we set this
* flag to indicate this condition */ * flag to indicate this condition */

View File

@ -170,7 +170,7 @@ gpgme_data_new_with_read_cb ( GpgmeData *r_dh,
* *
* Create a new data object and initialize it with the content of * Create a new data object and initialize it with the content of
* the file @file. If @copy is %True the file is immediately read in * the file @file. If @copy is %True the file is immediately read in
* adn closed. @copy of %False is not yet supportted. * and closed. @copy of %False is not yet supportted.
* *
* Return value: An error code or 0 on success. If the error code is * Return value: An error code or 0 on success. If the error code is
* %GPGME_File_Error, the OS error code is held in %errno. * %GPGME_File_Error, the OS error code is held in %errno.

View File

@ -195,6 +195,28 @@ _gpgme_set_op_info (GpgmeCtx c, GpgmeData info)
c->op_info = info; c->op_info = info;
} }
GpgmeError
gpgme_set_protocol (GpgmeCtx c, GpgmeProtocol prot)
{
if (!c)
return mk_error (Invalid_Value);
switch (prot)
{
case GPGME_PROTOCOL_OPENPGP:
c->use_cms = 0;
break;
case GPGME_PROTOCOL_CMS:
c->use_cms = 1;
break;
case GPGME_PROTOCOL_AUTO:
return mk_error (Not_Implemented);
default:
return mk_error (Invalid_Value);
}
return 0;
}
/** /**
* gpgme_set_armor: * gpgme_set_armor:
@ -234,7 +256,8 @@ gpgme_get_armor (GpgmeCtx c)
* @yes: boolean flag whether textmode should be enabled * @yes: boolean flag whether textmode should be enabled
* *
* Enable or disable the use of the special textmode. Textmode is for example * Enable or disable the use of the special textmode. Textmode is for example
* used for MIME (RFC2015) signatures * used for the RFC2015 signatures; note that the updated RFC 3156 mandates
* that the MUA does some preparations so that textmode is not anymore needed.
**/ **/
void void
gpgme_set_textmode ( GpgmeCtx c, int yes ) gpgme_set_textmode ( GpgmeCtx c, int yes )
@ -308,13 +331,16 @@ gpgme_set_keylist_mode ( GpgmeCtx c, int mode )
**/ **/
void void
gpgme_set_passphrase_cb ( GpgmeCtx c, GpgmePassphraseCb cb, void *cb_value ) gpgme_set_passphrase_cb ( GpgmeCtx c, GpgmePassphraseCb cb, void *cb_value )
{
if (c)
{ {
c->passphrase_cb = cb; c->passphrase_cb = cb;
c->passphrase_cb_value = cb_value; c->passphrase_cb_value = cb_value;
} }
}
/** /**
* gpgme_set_pprogress_cb: * gpgme_set_progress_cb:
* @c: the context * @c: the context
* @cb: A callback function * @cb: A callback function
* @cb_value: The value passed to the callback function * @cb_value: The value passed to the callback function
@ -332,10 +358,13 @@ gpgme_set_passphrase_cb ( GpgmeCtx c, GpgmePassphraseCb cb, void *cb_value )
**/ **/
void void
gpgme_set_progress_cb ( GpgmeCtx c, GpgmeProgressCb cb, void *cb_value ) gpgme_set_progress_cb ( GpgmeCtx c, GpgmeProgressCb cb, void *cb_value )
{
if (c)
{ {
c->progress_cb = cb; c->progress_cb = cb;
c->progress_cb_value = cb_value; c->progress_cb_value = cb_value;
} }
}

View File

@ -44,7 +44,7 @@ extern "C" {
* let autoconf (using the AM_PATH_GPGME macro) check that this * let autoconf (using the AM_PATH_GPGME macro) check that this
* header matches the installed library. * header matches the installed library.
* Warning: Do not edit the next line. configure will do that for you! */ * Warning: Do not edit the next line. configure will do that for you! */
#define GPGME_VERSION "0.2.3" #define GPGME_VERSION "0.2.3a"
@ -153,6 +153,12 @@ typedef enum {
} GpgmeValidity; } GpgmeValidity;
typedef enum {
GPGME_PROTOCOL_OpenPGP = 0, /* default */
GPGME_PROTOCOL_CMS = 1,
GPGME_PROTOCOL_AUTO = 2
} GpgmeProtocol;
typedef const char *(*GpgmePassphraseCb)(void*, typedef const char *(*GpgmePassphraseCb)(void*,
const char *desc, void *r_hd); const char *desc, void *r_hd);
typedef void (*GpgmeProgressCb)(void *opaque, typedef void (*GpgmeProgressCb)(void *opaque,

View File

@ -9,7 +9,7 @@ NAMES='Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India
if [ "$1" = "--clean" ]; then if [ "$1" = "--clean" ]; then
(for i in $NAMES; do (for i in $NAMES; do
[ -d $i ] && rm -r $i [ -d $i ] && rm -r $i || true
done) || true done) || true
exit 0 exit 0
fi fi