[gmime] Implements feature request #635663
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Implements feature request #635663
- Date: Tue, 8 Feb 2011 14:53:03 +0000 (UTC)
commit e8ec55db7fb56d0f90c0b9fdd9666ab238559bd9
Author: Jeffrey Stedfast <fejj gnome org>
Date: Tue Feb 8 09:52:21 2011 -0500
Implements feature request #635663
2011-02-08 Jeffrey Stedfast <fejj novell com>
Implements feature request in bug #635663.
* gmime/gmime-crypto-context.c
* (g_mime_signer_[g,s]et_sig_version):
New functions to access new signature version member.
(g_mime_signer_[g,s]et_sig_class): New functions to access new
signature class member.
* gmime/gmime-gpg-context.c (gpg_ctx_parse_signer_info): Extract
the signature class and version tokens.
ChangeLog | 12 +++++++
docs/reference/gmime-sections.txt | 4 ++
gmime/gmime-crypto-context.c | 66 +++++++++++++++++++++++++++++++++++++
gmime/gmime-crypto-context.h | 16 +++++++--
gmime/gmime-gpg-context.c | 16 ++++++++-
mono/gmime-api.raw | 24 ++++++++++++-
6 files changed, 131 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eb83515..2dadc69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2011-02-08 Jeffrey Stedfast <fejj novell com>
+ Implements feature request in bug #635663.
+
+ * gmime/gmime-crypto-context.c (g_mime_signer_[g,s]et_sig_version):
+ New functions to access new signature version member.
+ (g_mime_signer_[g,s]et_sig_class): New functions to access new
+ signature class member.
+
+ * gmime/gmime-gpg-context.c (gpg_ctx_parse_signer_info): Extract
+ the signature class and version tokens.
+
+2011-02-08 Jeffrey Stedfast <fejj novell com>
+
* PORTING: Updated docs.
* mono/GMime.metadata: Fixed up for the new decrypt API.
diff --git a/docs/reference/gmime-sections.txt b/docs/reference/gmime-sections.txt
index b0588ef..4872493 100644
--- a/docs/reference/gmime-sections.txt
+++ b/docs/reference/gmime-sections.txt
@@ -1175,6 +1175,10 @@ g_mime_signer_get_issuer_name
g_mime_signer_set_issuer_name
g_mime_signer_get_fingerprint
g_mime_signer_set_fingerprint
+g_mime_signer_get_sig_class
+g_mime_signer_set_sig_class
+g_mime_signer_get_sig_version
+g_mime_signer_set_sig_version
g_mime_signer_get_sig_created
g_mime_signer_set_sig_created
g_mime_signer_get_sig_expires
diff --git a/gmime/gmime-crypto-context.c b/gmime/gmime-crypto-context.c
index 1f14b68..1c27f1a 100644
--- a/gmime/gmime-crypto-context.c
+++ b/gmime/gmime-crypto-context.c
@@ -617,6 +617,72 @@ g_mime_signer_get_trust (const GMimeSigner *signer)
/**
+ * g_mime_signer_set_sig_class:
+ * @signer: a #GMimeSigner
+ * @sig_class: signature class
+ *
+ * Set the signer's signature class.
+ **/
+void
+g_mime_signer_set_sig_class (GMimeSigner *signer, int sig_class)
+{
+ g_return_if_fail (signer != NULL);
+
+ signer->sig_class = (unsigned int) (sig_class & 0xff);
+}
+
+
+/**
+ * g_mime_signer_get_sig_class:
+ * @signer: a #GMimeSigner
+ *
+ * Get the signer's signature class.
+ *
+ * Returns: the signer's signature class.
+ **/
+int
+g_mime_signer_get_sig_class (const GMimeSigner *signer)
+{
+ g_return_val_if_fail (signer != NULL, 0);
+
+ return signer->sig_class;
+}
+
+
+/**
+ * g_mime_signer_set_sig_version:
+ * @signer: a #GMimeSigner
+ * @sig_class: signature version
+ *
+ * Set the signer's signature version.
+ **/
+void
+g_mime_signer_set_sig_version (GMimeSigner *signer, int version)
+{
+ g_return_if_fail (signer != NULL);
+
+ signer->sig_ver = (unsigned int) (version & 0xff);
+}
+
+
+/**
+ * g_mime_signer_get_sig_version:
+ * @signer: a #GMimeSigner
+ *
+ * Get the signer's signature version.
+ *
+ * Returns: the signer's signature version.
+ **/
+int
+g_mime_signer_get_sig_version (const GMimeSigner *signer)
+{
+ g_return_val_if_fail (signer != NULL, 0);
+
+ return signer->sig_ver;
+}
+
+
+/**
* g_mime_signer_set_pubkey_algo:
* @signer: a #GMimeSigner
* @pubkey_algo: a #GMimeCryptoPubKeyAlgo
diff --git a/gmime/gmime-crypto-context.h b/gmime/gmime-crypto-context.h
index da675e4..3699975 100644
--- a/gmime/gmime-crypto-context.h
+++ b/gmime/gmime-crypto-context.h
@@ -256,7 +256,7 @@ typedef enum {
* Possible errors that a #GMimeSigner could have.
**/
typedef enum {
- GMIME_SIGNER_ERROR_NONE,
+ GMIME_SIGNER_ERROR_NONE = 0,
GMIME_SIGNER_ERROR_EXPSIG = (1 << 0), /* expired signature */
GMIME_SIGNER_ERROR_NO_PUBKEY = (1 << 1), /* no public key */
GMIME_SIGNER_ERROR_EXPKEYSIG = (1 << 2), /* expired key */
@@ -272,6 +272,8 @@ typedef enum {
* @errors: A bitfield of #GMimeSignerError values.
* @trust: A #GMimeSignerTrust.
* @unused: Unused expansion bits for future use; ignore this.
+ * @sig_class: Crypto-specific signature class.
+ * @sig_ver: Crypto-specific signature version.
* @pubkey_algo: The public-key algorithm used by the signer, if known.
* @hash_algo: The hash algorithm used by the signer, if known.
* @issuer_serial: The issuer of the certificate, if known.
@@ -290,9 +292,11 @@ typedef enum {
struct _GMimeSigner {
GMimeSigner *next;
unsigned int status:2; /* GMimeSignerStatus */
- unsigned int errors:5; /* bitfield of GMimeSignerError's */
+ unsigned int errors:6; /* bitfield of GMimeSignerError's */
unsigned int trust:3; /* GMimeSignerTrust */
- unsigned int unused:20; /* unused expansion bits */
+ unsigned int unused:5; /* unused expansion bits */
+ unsigned int sig_class:8; /* crypto-specific signature class */
+ unsigned int sig_ver:8; /* crypto-specific signature version */
GMimeCryptoPubKeyAlgo pubkey_algo;
GMimeCryptoHash hash_algo;
char *issuer_serial;
@@ -322,6 +326,12 @@ GMimeSignerError g_mime_signer_get_errors (const GMimeSigner *signer);
void g_mime_signer_set_trust (GMimeSigner *signer, GMimeSignerTrust trust);
GMimeSignerTrust g_mime_signer_get_trust (const GMimeSigner *signer);
+void g_mime_signer_set_sig_class (GMimeSigner *signer, int sig_class);
+int g_mime_signer_get_sig_class (const GMimeSigner *signer);
+
+void g_mime_signer_set_sig_version (GMimeSigner *signer, int version);
+int g_mime_signer_get_sig_version (const GMimeSigner *signer);
+
void g_mime_signer_set_pubkey_algo (GMimeSigner *signer, GMimeCryptoPubKeyAlgo pubkey_algo);
GMimeCryptoPubKeyAlgo g_mime_signer_get_pubkey_algo (const GMimeSigner *signer);
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 886c5b4..b7257eb 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -924,7 +924,13 @@ gpg_ctx_parse_signer_info (struct _GpgCtx *gpg, char *status)
status = inend + 1;
/* the fifth token is the signature version */
- status = next_token (status, NULL);
+ signer->sig_ver = strtoul (status, &inend, 10);
+ if (inend == status || *inend != ' ') {
+ signer->sig_ver = 0;
+ return;
+ }
+
+ status = inend + 1;
/* the sixth token is a reserved numeric value (ignore for now) */
status = next_token (status, NULL);
@@ -944,7 +950,13 @@ gpg_ctx_parse_signer_info (struct _GpgCtx *gpg, char *status)
status = inend + 1;
/* the nineth token is the signature class */
- status = next_token (status, NULL);
+ signer->sig_class = strtoul (status, &inend, 10);
+ if (inend == status || *inend != ' ') {
+ signer->sig_class = 0;
+ return;
+ }
+
+ status = inend + 1;
/* the rest is the primary key fingerprint */
} else if (!strncmp (status, "TRUST_", 6)) {
diff --git a/mono/gmime-api.raw b/mono/gmime-api.raw
index e082937..9931a16 100644
--- a/mono/gmime-api.raw
+++ b/mono/gmime-api.raw
@@ -2601,9 +2601,11 @@
<struct name="Signer" cname="GMimeSigner" opaque="true">
<field name="Next" cname="next" type="GMimeSigner*" access="public" writeable="true" />
<field name="Status" cname="status" bits="2" type="unsigned int" access="public" writeable="true" />
- <field name="Errors" cname="errors" bits="5" type="unsigned int" access="public" writeable="true" />
+ <field name="Errors" cname="errors" bits="6" type="unsigned int" access="public" writeable="true" />
<field name="Trust" cname="trust" bits="3" type="unsigned int" access="public" writeable="true" />
- <field name="Unused" cname="unused" bits="20" type="unsigned int" access="public" writeable="true" />
+ <field name="Unused" cname="unused" bits="5" type="unsigned int" access="public" writeable="true" />
+ <field name="SigClass" cname="sig_class" bits="8" type="unsigned int" access="public" writeable="true" />
+ <field name="SigVer" cname="sig_ver" bits="8" type="unsigned int" access="public" writeable="true" />
<field name="PubkeyAlgo" cname="pubkey_algo" type="GMimeCryptoPubKeyAlgo" access="public" writeable="true" />
<field name="HashAlgo" cname="hash_algo" type="GMimeCryptoHash" access="public" writeable="true" />
<field name="IssuerSerial" cname="issuer_serial" type="char*" access="public" writeable="true" />
@@ -2652,12 +2654,18 @@
<method name="GetPubkeyAlgo" cname="g_mime_signer_get_pubkey_algo">
<return-type type="GMimeCryptoPubKeyAlgo" />
</method>
+ <method name="GetSigClass" cname="g_mime_signer_get_sig_class">
+ <return-type type="int" />
+ </method>
<method name="GetSigCreated" cname="g_mime_signer_get_sig_created">
<return-type type="time_t" />
</method>
<method name="GetSigExpires" cname="g_mime_signer_get_sig_expires">
<return-type type="time_t" />
</method>
+ <method name="GetSigVersion" cname="g_mime_signer_get_sig_version">
+ <return-type type="int" />
+ </method>
<method name="GetStatus" cname="g_mime_signer_get_status">
<return-type type="GMimeSignerStatus" />
</method>
@@ -2738,6 +2746,12 @@
<parameter type="GMimeCryptoPubKeyAlgo" name="pubkey_algo" />
</parameters>
</method>
+ <method name="SetSigClass" cname="g_mime_signer_set_sig_class">
+ <return-type type="void" />
+ <parameters>
+ <parameter type="int" name="sig_class" />
+ </parameters>
+ </method>
<method name="SetSigCreated" cname="g_mime_signer_set_sig_created">
<return-type type="void" />
<parameters>
@@ -2750,6 +2764,12 @@
<parameter type="time_t" name="expires" />
</parameters>
</method>
+ <method name="SetSigVersion" cname="g_mime_signer_set_sig_version">
+ <return-type type="void" />
+ <parameters>
+ <parameter type="int" name="version" />
+ </parameters>
+ </method>
<method name="SetStatus" cname="g_mime_signer_set_status">
<return-type type="void" />
<parameters>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]