diff options
| author | Karl-Heinz Zimmer <[email protected]> | 2002-05-08 12:05:17 +0000 | 
|---|---|---|
| committer | Karl-Heinz Zimmer <[email protected]> | 2002-05-08 12:05:17 +0000 | 
| commit | ff28fd3b541eec6a77c35c9af57ac38052dbd1bc (patch) | |
| tree | 1c2eb77b75e16eaae31cfae7b806918e1aba58eb /gpgmeplug | |
| parent | Add some items and comments. (diff) | |
| download | gpgme-ff28fd3b541eec6a77c35c9af57ac38052dbd1bc.tar.gz gpgme-ff28fd3b541eec6a77c35c9af57ac38052dbd1bc.zip | |
Include the protocol parameter of multipart/.. content-type messages into double quotes to fullify requirements of the german government (see BSI document Technische Grundlagen - Tailoring MTTv2, page 60)
Diffstat (limited to 'gpgmeplug')
| -rw-r--r-- | gpgmeplug/gpgme-openpgp.c | 4 | ||||
| -rw-r--r-- | gpgmeplug/gpgme-smime.c | 2 | ||||
| -rw-r--r-- | gpgmeplug/gpgmeplug.c | 30 | 
3 files changed, 28 insertions, 8 deletions
| diff --git a/gpgmeplug/gpgme-openpgp.c b/gpgmeplug/gpgme-openpgp.c index 56908e1b..e0bd1639 100644 --- a/gpgmeplug/gpgme-openpgp.c +++ b/gpgmeplug/gpgme-openpgp.c @@ -3,7 +3,7 @@  #define GPGMEPLUG_SIGN_INCLUDE_CLEARTEXT true  #define GPGMEPLUG_SIGN_MAKE_MIME_OBJECT  true  #define GPGMEPLUG_SIGN_MAKE_MULTI_MIME   true -#define GPGMEPLUG_SIGN_CTYPE_MAIN        "multipart/signed;protocol=application/pgp-signature;micalg=pgp-sha1" +#define GPGMEPLUG_SIGN_CTYPE_MAIN        "multipart/signed;protocol=\"application/pgp-signature\";micalg=pgp-sha1"  #define GPGMEPLUG_SIGN_CDISP_MAIN        ""  #define GPGMEPLUG_SIGN_CTENC_MAIN        ""  #define GPGMEPLUG_SIGN_CTYPE_VERSION     "" @@ -21,7 +21,7 @@  #define GPGMEPLUG_ENC_INCLUDE_CLEARTEXT  false  #define GPGMEPLUG_ENC_MAKE_MIME_OBJECT   true  #define GPGMEPLUG_ENC_MAKE_MULTI_MIME    true -#define GPGMEPLUG_ENC_CTYPE_MAIN         "multipart/encrypted; protocol=application/pgp-encrypted" +#define GPGMEPLUG_ENC_CTYPE_MAIN         "multipart/encrypted; protocol=\"application/pgp-encrypted\""  #define GPGMEPLUG_ENC_CDISP_MAIN         ""  #define GPGMEPLUG_ENC_CTENC_MAIN         ""  #define GPGMEPLUG_ENC_CTYPE_VERSION      "application/pgp-encrypted" diff --git a/gpgmeplug/gpgme-smime.c b/gpgmeplug/gpgme-smime.c index e6c85349..39b53e8e 100644 --- a/gpgmeplug/gpgme-smime.c +++ b/gpgmeplug/gpgme-smime.c @@ -3,7 +3,7 @@  #define GPGMEPLUG_SIGN_INCLUDE_CLEARTEXT true  #define GPGMEPLUG_SIGN_MAKE_MIME_OBJECT  true  #define GPGMEPLUG_SIGN_MAKE_MULTI_MIME   true -#define GPGMEPLUG_SIGN_CTYPE_MAIN        "multipart/signed; protocol=application/pkcs7-signature; micalg=sha1" +#define GPGMEPLUG_SIGN_CTYPE_MAIN        "multipart/signed; protocol=\"application/pkcs7-signature\"; micalg=sha1"  #define GPGMEPLUG_SIGN_CDISP_MAIN        ""  #define GPGMEPLUG_SIGN_CTENC_MAIN        ""  #define GPGMEPLUG_SIGN_CTYPE_VERSION     "" diff --git a/gpgmeplug/gpgmeplug.c b/gpgmeplug/gpgmeplug.c index 12cf2009..0132a67e 100644 --- a/gpgmeplug/gpgmeplug.c +++ b/gpgmeplug/gpgmeplug.c @@ -452,11 +452,31 @@ bool signatureCertificateExpiryNearWarning( void )  int signatureCertificateDaysLeftToExpiry( const char* certificate )  { -    /* PENDING(g10) -       Please return the number of days that are left until the -       certificate specified in the parameter certificate expires. -    */ -  return 10; /* dummy that triggers a warning in the MUA */ +  GpgmeCtx ctx; +  GpgmeError err; +  GpgmeKey rKey; +  time_t daysLeft = 0; + +  gpgme_new( &ctx ); +  gpgme_set_protocol( ctx, GPGMEPLUG_PROTOCOL ); + +  err = gpgme_op_keylist_start( ctx, certificate, 0 ); +  if ( GPGME_No_Error == err ) { +    err = gpgme_op_keylist_next( ctx, &rKey ); +    gpgme_op_keylist_end( ctx ); +    if ( GPGME_No_Error == err ) { +      time_t expire_time = gpgme_key_get_ulong_attr( +                             rKey,GPGME_ATTR_EXPIRE, NULL, 0 ); +      time_t cur_time = time (NULL); +      daysLeft = expire_time - cur_time; +      // convert seconds into days +      daysLeft /= 43200; +      gpgme_key_release( rKey ); +    } +  } +  gpgme_release( ctx ); + +  return daysLeft;  } | 
