Remove long deprecated functions.
* src/gpgme.h.in (GPGME_EXPORT_MODE_NOUID): Remove. This was a left-over from an experiment. (gpgme_attr_t,_gpgme_attr_t) Remove. Deprecated sinze 2003. (gpgme_get_sig_ulong_attr): Ditto. (gpgme_get_sig_string_attr): Ditto. (gpgme_key_get_string_attr): Ditto. (gpgme_key_get_ulong_attr): Ditto. (gpgme_key_sig_get_string_attr): Ditto. (gpgme_key_sig_get_ulong_attr): Ditto. (gpgme_trust_item_get_string_attr): Ditto. (gpgme_trust_item_get_int_attr): Ditto. * src/gpgme.def: Remove them here too. * src/libgpgme.vers: Ditto. * src/trust-item.c: Remove corresponding implementations. * src/verify.c: Ditto. * src/key.c: Ditto.
This commit is contained in:
parent
baa174e5d6
commit
d54d6eaa64
18
NEWS
18
NEWS
@ -1,6 +1,24 @@
|
|||||||
Noteworthy changes in version 2.0.0 (unreleased)
|
Noteworthy changes in version 2.0.0 (unreleased)
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
|
* Removed types and functions deprecated since 2003 or which had only
|
||||||
|
experimental use.
|
||||||
|
|
||||||
|
|
||||||
|
* Interface changes relative to the 1.24 branch:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
gpgme_attr_t REMOVED.
|
||||||
|
gpgme_get_sig_ulong_attr REMOVED.
|
||||||
|
gpgme_get_sig_string_attr REMOVED.
|
||||||
|
gpgme_key_get_string_attr REMOVED.
|
||||||
|
gpgme_key_get_ulong_attr REMOVED.
|
||||||
|
gpgme_key_sig_get_string_attr REMOVED.
|
||||||
|
gpgme_key_sig_get_ulong_attr REMOVED.
|
||||||
|
gpgme_trust_item_get_string_attr REMOVED.
|
||||||
|
gpgme_trust_item_get_int_attr REMOVED.
|
||||||
|
GPGME_EXPORT_MODE_NOUID REMOVED.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Noteworthy changes in version 1.24.1 (2024-12-04)
|
Noteworthy changes in version 1.24.1 (2024-12-04)
|
||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
338
doc/gpgme.texi
338
doc/gpgme.texi
@ -8335,154 +8335,6 @@ The function @code{gpgme_data_rewind} is equivalent to:
|
|||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
|
|
||||||
@deftp {Data type} gpgme_attr_t
|
|
||||||
The @code{gpgme_attr_t} type is used to specify a key or trust item
|
|
||||||
attribute. The following attributes are defined:
|
|
||||||
|
|
||||||
@table @code
|
|
||||||
@item GPGME_ATTR_KEYID
|
|
||||||
This is the key ID of a sub key. It is representable as a string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_FPR
|
|
||||||
This is the fingerprint of a sub key. It is representable as a
|
|
||||||
string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_ALGO
|
|
||||||
This is the crypto algorithm for which the sub key can be used. It
|
|
||||||
is representable as a string and as a number. The numbers correspond
|
|
||||||
to the @code{enum gcry_pk_algos} values in the gcrypt library.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_LEN
|
|
||||||
This is the key length of a sub key. It is representable as a
|
|
||||||
number.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_CREATED
|
|
||||||
This is the timestamp at creation time of a sub key. It is
|
|
||||||
representable as a number.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_EXPIRE
|
|
||||||
This is the expiration time of a sub key. It is representable as a
|
|
||||||
number.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_USERID
|
|
||||||
This is a user ID. There can be more than one user IDs in a
|
|
||||||
@var{gpgme_key_t} object. The first one (with index 0) is the primary
|
|
||||||
user ID. The user ID is representable as a number.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_NAME
|
|
||||||
This is the name belonging to a user ID. It is representable as a string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_EMAIL
|
|
||||||
This is the email address belonging to a user ID. It is representable
|
|
||||||
as a string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_COMMENT
|
|
||||||
This is the comment belonging to a user ID. It is representable as a
|
|
||||||
string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_VALIDITY
|
|
||||||
This is the validity belonging to a user ID. It is representable as a
|
|
||||||
string and as a number. See below for a list of available validities.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_UID_REVOKED
|
|
||||||
This specifies if a user ID is revoked. It is representable as a
|
|
||||||
number, and is @code{1} if the user ID is revoked, and @code{0}
|
|
||||||
otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_UID_INVALID
|
|
||||||
This specifies if a user ID is invalid. It is representable as a
|
|
||||||
number, and is @code{1} if the user ID is invalid, and @code{0}
|
|
||||||
otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_TYPE
|
|
||||||
This returns information about the type of key. For the string function
|
|
||||||
this will eother be "PGP" or "X.509". The integer function returns 0
|
|
||||||
for PGP and 1 for X.509.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_IS_SECRET
|
|
||||||
This specifies if the key is a secret key. It is representable as a
|
|
||||||
number, and is @code{1} if the key is revoked, and @code{0} otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_KEY_REVOKED
|
|
||||||
This specifies if a sub key is revoked. It is representable as a
|
|
||||||
number, and is @code{1} if the key is revoked, and @code{0} otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_KEY_INVALID
|
|
||||||
This specifies if a sub key is invalid. It is representable as a
|
|
||||||
number, and is @code{1} if the key is invalid, and @code{0} otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_KEY_EXPIRED
|
|
||||||
This specifies if a sub key is expired. It is representable as a
|
|
||||||
number, and is @code{1} if the key is expired, and @code{0} otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_KEY_DISABLED
|
|
||||||
This specifies if a sub key is disabled. It is representable as a
|
|
||||||
number, and is @code{1} if the key is disabled, and @code{0} otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_KEY_CAPS
|
|
||||||
This is a description of the capabilities of a sub key. It is
|
|
||||||
representable as a string. The string contains the letter ``e'' if
|
|
||||||
the key can be used for encryption, ``s'' if the key can be used for
|
|
||||||
signatures, and ``c'' if the key can be used for certifications.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_CAN_ENCRYPT
|
|
||||||
This specifies if a sub key can be used for encryption. It is
|
|
||||||
representable as a number, and is @code{1} if the sub key can be used
|
|
||||||
for encryption, and @code{0} otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_CAN_SIGN
|
|
||||||
This specifies if a sub key can be used to create data signatures. It
|
|
||||||
is representable as a number, and is @code{1} if the sub key can be
|
|
||||||
used for signatures, and @code{0} otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_CAN_CERTIFY
|
|
||||||
This specifies if a sub key can be used to create key certificates.
|
|
||||||
It is representable as a number, and is @code{1} if the sub key can be
|
|
||||||
used for certifications, and @code{0} otherwise.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_SERIAL
|
|
||||||
The X.509 issuer serial attribute of the key. It is representable as
|
|
||||||
a string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_ISSUE
|
|
||||||
The X.509 issuer name attribute of the key. It is representable as a
|
|
||||||
string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_CHAINID
|
|
||||||
The X.509 chain ID can be used to build the certification chain. It
|
|
||||||
is representable as a string.
|
|
||||||
@end table
|
|
||||||
@end deftp
|
|
||||||
|
|
||||||
@deftypefun {const char *} gpgme_key_get_string_attr (@w{gpgme_key_t @var{key}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
||||||
The function @code{gpgme_key_get_string_attr} returns the value of the
|
|
||||||
string-representable attribute @var{what} of key @var{key}. If the
|
|
||||||
attribute is an attribute of a sub key or an user ID, @var{idx}
|
|
||||||
specifies the sub key or user ID of which the attribute value is
|
|
||||||
returned. The argument @var{reserved} is reserved for later use and
|
|
||||||
should be @code{NULL}.
|
|
||||||
|
|
||||||
The string returned is only valid as long as the key is valid.
|
|
||||||
|
|
||||||
The function returns @code{0} if an attribute can't be returned as a
|
|
||||||
string, @var{key} is not a valid pointer, @var{idx} out of range,
|
|
||||||
or @var{reserved} not @code{NULL}.
|
|
||||||
@end deftypefun
|
|
||||||
|
|
||||||
@deftypefun {unsigned long} gpgme_key_get_ulong_attr (@w{gpgme_key_t @var{key}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
||||||
The function @code{gpgme_key_get_ulong_attr} returns the value of the
|
|
||||||
number-representable attribute @var{what} of key @var{key}. If the
|
|
||||||
attribute is an attribute of a sub key or an user ID, @var{idx}
|
|
||||||
specifies the sub key or user ID of which the attribute value is
|
|
||||||
returned. The argument @var{reserved} is reserved for later use and
|
|
||||||
should be @code{NULL}.
|
|
||||||
|
|
||||||
The function returns @code{0} if the attribute can't be returned as a
|
|
||||||
number, @var{key} is not a valid pointer, @var{idx} out of range, or
|
|
||||||
@var{reserved} not @code{NULL}.
|
|
||||||
@end deftypefun
|
|
||||||
|
|
||||||
|
|
||||||
@c
|
@c
|
||||||
@c Key Signatures
|
@c Key Signatures
|
||||||
@c
|
@c
|
||||||
@ -8495,94 +8347,6 @@ key, you have to make sure that the key was listed with signatures
|
|||||||
enabled. One convenient, but blocking, way to do this is to use the
|
enabled. One convenient, but blocking, way to do this is to use the
|
||||||
function @code{gpgme_get_key}.
|
function @code{gpgme_get_key}.
|
||||||
|
|
||||||
@deftp {Data type} gpgme_attr_t
|
|
||||||
The @code{gpgme_attr_t} type is used to specify a key signature
|
|
||||||
attribute. The following attributes are defined:
|
|
||||||
|
|
||||||
@table @code
|
|
||||||
@item GPGME_ATTR_KEYID
|
|
||||||
This is the key ID of the key which was used for the signature. It is
|
|
||||||
representable as a string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_ALGO
|
|
||||||
This is the crypto algorithm used to create the signature. It is
|
|
||||||
representable as a string and as a number. The numbers correspond to
|
|
||||||
the @code{enum gcry_pk_algos} values in the gcrypt library.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_CREATED
|
|
||||||
This is the timestamp at creation time of the signature. It is
|
|
||||||
representable as a number.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_EXPIRE
|
|
||||||
This is the expiration time of the signature. It is representable as
|
|
||||||
a number.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_USERID
|
|
||||||
This is the user ID associated with the signing key. The user ID is
|
|
||||||
representable as a number.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_NAME
|
|
||||||
This is the name belonging to a user ID. It is representable as a string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_EMAIL
|
|
||||||
This is the email address belonging to a user ID. It is representable
|
|
||||||
as a string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_COMMENT
|
|
||||||
This is the comment belonging to a user ID. It is representable as a
|
|
||||||
string.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_KEY_REVOKED
|
|
||||||
This specifies if a key signature is a revocation signature. It is
|
|
||||||
representable as a number, and is @code{1} if the key is revoked, and
|
|
||||||
@code{0} otherwise.
|
|
||||||
|
|
||||||
@c @item GPGME_ATTR_KEY_EXPIRED
|
|
||||||
@c This specifies if a key signature is expired. It is representable as
|
|
||||||
@c a number, and is @code{1} if the key is revoked, and @code{0}
|
|
||||||
@c otherwise.
|
|
||||||
@c
|
|
||||||
@item GPGME_ATTR_SIG_CLASS
|
|
||||||
This specifies the signature class of a key signature. It is
|
|
||||||
representable as a number. The meaning is specific to the crypto
|
|
||||||
engine.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_SIG_CLASS
|
|
||||||
This specifies the signature class of a key signature. It is
|
|
||||||
representable as a number. The meaning is specific to the crypto
|
|
||||||
engine.
|
|
||||||
|
|
||||||
@item GPGME_ATTR_SIG_STATUS
|
|
||||||
This is the same value as returned by @code{gpgme_get_sig_status}.
|
|
||||||
@end table
|
|
||||||
@end deftp
|
|
||||||
|
|
||||||
@deftypefun {const char *} gpgme_key_sig_get_string_attr (@w{gpgme_key_t @var{key}}, @w{int @var{uid_idx}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
||||||
The function @code{gpgme_key_sig_get_string_attr} returns the value of
|
|
||||||
the string-representable attribute @var{what} of the signature
|
|
||||||
@var{idx} on the user ID @var{uid_idx} in the key @var{key}. The
|
|
||||||
argument @var{reserved} is reserved for later use and should be
|
|
||||||
@code{NULL}.
|
|
||||||
|
|
||||||
The string returned is only valid as long as the key is valid.
|
|
||||||
|
|
||||||
The function returns @code{0} if an attribute can't be returned as a
|
|
||||||
string, @var{key} is not a valid pointer, @var{uid_idx} or @var{idx}
|
|
||||||
out of range, or @var{reserved} not @code{NULL}.
|
|
||||||
@end deftypefun
|
|
||||||
|
|
||||||
@deftypefun {unsigned long} gpgme_key_sig_get_ulong_attr (@w{gpgme_key_t @var{key}}, @w{int @var{uid_idx}}, @w{gpgme_attr_t @var{what}}, @w{const void *@var{reserved}}, @w{int @var{idx}})
|
|
||||||
The function @code{gpgme_key_sig_get_ulong_attr} returns the value of
|
|
||||||
the number-representable attribute @var{what} of the signature
|
|
||||||
@var{idx} on the user ID @var{uid_idx} in the key @var{key}. The
|
|
||||||
argument @var{reserved} is reserved for later use and should be
|
|
||||||
@code{NULL}.
|
|
||||||
|
|
||||||
The function returns @code{0} if an attribute can't be returned as a
|
|
||||||
string, @var{key} is not a valid pointer, @var{uid_idx} or @var{idx}
|
|
||||||
out of range, or @var{reserved} not @code{NULL}.
|
|
||||||
@end deftypefun
|
|
||||||
|
|
||||||
|
|
||||||
@deftp {Data type} {enum gpgme_sig_stat_t}
|
@deftp {Data type} {enum gpgme_sig_stat_t}
|
||||||
@tindex gpgme_sig_stat_t
|
@tindex gpgme_sig_stat_t
|
||||||
@ -8689,105 +8453,6 @@ The function @code{gpgme_get_sig_status} is equivalent to:
|
|||||||
@end example
|
@end example
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@deftypefun {const char *} gpgme_get_sig_string_attr (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_attr_t @var{what}}, @w{int @var{whatidx}})
|
|
||||||
The function @code{gpgme_get_sig_string_attr} is equivalent to:
|
|
||||||
|
|
||||||
@example
|
|
||||||
gpgme_verify_result_t result;
|
|
||||||
gpgme_signature_t sig;
|
|
||||||
|
|
||||||
result = gpgme_op_verify_result (ctx);
|
|
||||||
sig = result->signatures;
|
|
||||||
|
|
||||||
while (sig && idx)
|
|
||||||
@{
|
|
||||||
sig = sig->next;
|
|
||||||
idx--;
|
|
||||||
@}
|
|
||||||
if (!sig || idx)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
@{
|
|
||||||
case GPGME_ATTR_FPR:
|
|
||||||
return sig->fpr;
|
|
||||||
|
|
||||||
case GPGME_ATTR_ERRTOK:
|
|
||||||
if (whatidx == 1)
|
|
||||||
return sig->wrong_key_usage ? "Wrong_Key_Usage" : "";
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
@}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
@end example
|
|
||||||
@end deftypefun
|
|
||||||
|
|
||||||
@deftypefun {const char *} gpgme_get_sig_ulong_attr (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_attr_t @var{what}}, @w{int @var{whatidx}})
|
|
||||||
The function @code{gpgme_get_sig_ulong_attr} is equivalent to:
|
|
||||||
|
|
||||||
@example
|
|
||||||
gpgme_verify_result_t result;
|
|
||||||
gpgme_signature_t sig;
|
|
||||||
|
|
||||||
result = gpgme_op_verify_result (ctx);
|
|
||||||
sig = result->signatures;
|
|
||||||
|
|
||||||
while (sig && idx)
|
|
||||||
@{
|
|
||||||
sig = sig->next;
|
|
||||||
idx--;
|
|
||||||
@}
|
|
||||||
if (!sig || idx)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
@{
|
|
||||||
case GPGME_ATTR_CREATED:
|
|
||||||
return sig->timestamp;
|
|
||||||
|
|
||||||
case GPGME_ATTR_EXPIRE:
|
|
||||||
return sig->exp_timestamp;
|
|
||||||
|
|
||||||
case GPGME_ATTR_VALIDITY:
|
|
||||||
return (unsigned long) sig->validity;
|
|
||||||
|
|
||||||
case GPGME_ATTR_SIG_STATUS:
|
|
||||||
switch (sig->status)
|
|
||||||
@{
|
|
||||||
case GPG_ERR_NO_ERROR:
|
|
||||||
return GPGME_SIG_STAT_GOOD;
|
|
||||||
|
|
||||||
case GPG_ERR_BAD_SIGNATURE:
|
|
||||||
return GPGME_SIG_STAT_BAD;
|
|
||||||
|
|
||||||
case GPG_ERR_NO_PUBKEY:
|
|
||||||
return GPGME_SIG_STAT_NOKEY;
|
|
||||||
|
|
||||||
case GPG_ERR_NO_DATA:
|
|
||||||
return GPGME_SIG_STAT_NOSIG;
|
|
||||||
|
|
||||||
case GPG_ERR_SIG_EXPIRED:
|
|
||||||
return GPGME_SIG_STAT_GOOD_EXP;
|
|
||||||
|
|
||||||
case GPG_ERR_KEY_EXPIRED:
|
|
||||||
return GPGME_SIG_STAT_GOOD_EXPKEY;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return GPGME_SIG_STAT_ERROR;
|
|
||||||
@}
|
|
||||||
|
|
||||||
case GPGME_ATTR_SIG_SUMMARY:
|
|
||||||
return sig->summary;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
@}
|
|
||||||
return 0;
|
|
||||||
@end example
|
|
||||||
@end deftypefun
|
|
||||||
|
|
||||||
@deftypefun {const char *} gpgme_get_sig_key (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_key_t *@var{r_key}})
|
@deftypefun {const char *} gpgme_get_sig_key (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{idx}}, @w{gpgme_key_t *@var{r_key}})
|
||||||
The function @code{gpgme_get_sig_key} is equivalent to:
|
The function @code{gpgme_get_sig_key} is equivalent to:
|
||||||
@ -8812,9 +8477,6 @@ The function @code{gpgme_get_sig_key} is equivalent to:
|
|||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@include lesser.texi
|
@include lesser.texi
|
||||||
|
|
||||||
@include gpl.texi
|
@include gpl.texi
|
||||||
|
@ -127,16 +127,8 @@ EXPORTS
|
|||||||
gpgme_data_new_with_read_cb @98
|
gpgme_data_new_with_read_cb @98
|
||||||
gpgme_data_rewind @99
|
gpgme_data_rewind @99
|
||||||
gpgme_get_sig_status @100
|
gpgme_get_sig_status @100
|
||||||
gpgme_get_sig_string_attr @101
|
|
||||||
gpgme_get_sig_ulong_attr @102
|
|
||||||
gpgme_get_sig_key @103
|
gpgme_get_sig_key @103
|
||||||
gpgme_key_get_string_attr @104
|
|
||||||
gpgme_key_get_ulong_attr @105
|
|
||||||
gpgme_key_sig_get_string_attr @106
|
|
||||||
gpgme_key_sig_get_ulong_attr @107
|
|
||||||
gpgme_op_import_ext @108
|
gpgme_op_import_ext @108
|
||||||
gpgme_trust_item_get_int_attr @109
|
|
||||||
gpgme_trust_item_get_string_attr @110
|
|
||||||
gpgme_trust_item_release @111
|
gpgme_trust_item_release @111
|
||||||
|
|
||||||
gpgme_set_engine_info @112
|
gpgme_set_engine_info @112
|
||||||
@ -289,4 +281,3 @@ EXPORTS
|
|||||||
gpgme_op_setownertrust @213
|
gpgme_op_setownertrust @213
|
||||||
gpgme_op_setownertrust_start @214
|
gpgme_op_setownertrust_start @214
|
||||||
; END
|
; END
|
||||||
|
|
||||||
|
@ -2576,10 +2576,6 @@ char *gpgme_addrspec_from_uid (const char *uid);
|
|||||||
* Deprecated types, constants and functions.
|
* Deprecated types, constants and functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This is a former experimental only features. The constant is
|
|
||||||
* provided to not break existing code in the compiler phase. */
|
|
||||||
#define GPGME_EXPORT_MODE_NOUID 128 /* Do not use! */
|
|
||||||
|
|
||||||
|
|
||||||
/* The possible stati for gpgme_op_edit. The use of that function and
|
/* The possible stati for gpgme_op_edit. The use of that function and
|
||||||
* these status codes are deprecated in favor of gpgme_op_interact. */
|
* these status codes are deprecated in favor of gpgme_op_interact. */
|
||||||
@ -2737,45 +2733,6 @@ typedef enum
|
|||||||
_gpgme_sig_stat_t;
|
_gpgme_sig_stat_t;
|
||||||
typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED(0,4);
|
typedef _gpgme_sig_stat_t gpgme_sig_stat_t _GPGME_DEPRECATED(0,4);
|
||||||
|
|
||||||
/* The available key and signature attributes. Deprecated, use the
|
|
||||||
* individual result structures instead. */
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
GPGME_ATTR_KEYID = 1,
|
|
||||||
GPGME_ATTR_FPR = 2,
|
|
||||||
GPGME_ATTR_ALGO = 3,
|
|
||||||
GPGME_ATTR_LEN = 4,
|
|
||||||
GPGME_ATTR_CREATED = 5,
|
|
||||||
GPGME_ATTR_EXPIRE = 6,
|
|
||||||
GPGME_ATTR_OTRUST = 7,
|
|
||||||
GPGME_ATTR_USERID = 8,
|
|
||||||
GPGME_ATTR_NAME = 9,
|
|
||||||
GPGME_ATTR_EMAIL = 10,
|
|
||||||
GPGME_ATTR_COMMENT = 11,
|
|
||||||
GPGME_ATTR_VALIDITY = 12,
|
|
||||||
GPGME_ATTR_LEVEL = 13,
|
|
||||||
GPGME_ATTR_TYPE = 14,
|
|
||||||
GPGME_ATTR_IS_SECRET = 15,
|
|
||||||
GPGME_ATTR_KEY_REVOKED = 16,
|
|
||||||
GPGME_ATTR_KEY_INVALID = 17,
|
|
||||||
GPGME_ATTR_UID_REVOKED = 18,
|
|
||||||
GPGME_ATTR_UID_INVALID = 19,
|
|
||||||
GPGME_ATTR_KEY_CAPS = 20,
|
|
||||||
GPGME_ATTR_CAN_ENCRYPT = 21,
|
|
||||||
GPGME_ATTR_CAN_SIGN = 22,
|
|
||||||
GPGME_ATTR_CAN_CERTIFY = 23,
|
|
||||||
GPGME_ATTR_KEY_EXPIRED = 24,
|
|
||||||
GPGME_ATTR_KEY_DISABLED = 25,
|
|
||||||
GPGME_ATTR_SERIAL = 26,
|
|
||||||
GPGME_ATTR_ISSUER = 27,
|
|
||||||
GPGME_ATTR_CHAINID = 28,
|
|
||||||
GPGME_ATTR_SIG_STATUS = 29,
|
|
||||||
GPGME_ATTR_ERRTOK = 30,
|
|
||||||
GPGME_ATTR_SIG_SUMMARY = 31,
|
|
||||||
GPGME_ATTR_SIG_CLASS = 32
|
|
||||||
}
|
|
||||||
_gpgme_attr_t;
|
|
||||||
typedef _gpgme_attr_t gpgme_attr_t _GPGME_DEPRECATED(0,4);
|
|
||||||
|
|
||||||
/* Retrieve the signature status of signature IDX in CTX after a
|
/* Retrieve the signature status of signature IDX in CTX after a
|
||||||
* successful verify operation in R_STAT (if non-null). The creation
|
* successful verify operation in R_STAT (if non-null). The creation
|
||||||
@ -2786,17 +2743,6 @@ const char *gpgme_get_sig_status (gpgme_ctx_t ctx, int idx,
|
|||||||
_gpgme_sig_stat_t *r_stat,
|
_gpgme_sig_stat_t *r_stat,
|
||||||
time_t *r_created) _GPGME_DEPRECATED(0,4);
|
time_t *r_created) _GPGME_DEPRECATED(0,4);
|
||||||
|
|
||||||
/* Retrieve certain attributes of a signature. IDX is the index
|
|
||||||
* number of the signature after a successful verify operation. WHAT
|
|
||||||
* is an attribute where GPGME_ATTR_EXPIRE is probably the most useful
|
|
||||||
* one. WHATIDX is to be passed as 0 for most attributes . */
|
|
||||||
unsigned long gpgme_get_sig_ulong_attr (gpgme_ctx_t c, int idx,
|
|
||||||
_gpgme_attr_t what, int whatidx)
|
|
||||||
_GPGME_DEPRECATED(0,4);
|
|
||||||
const char *gpgme_get_sig_string_attr (gpgme_ctx_t c, int idx,
|
|
||||||
_gpgme_attr_t what, int whatidx)
|
|
||||||
_GPGME_DEPRECATED(0,4);
|
|
||||||
|
|
||||||
|
|
||||||
/* Get the key used to create signature IDX in CTX and return it in
|
/* Get the key used to create signature IDX in CTX and return it in
|
||||||
* R_KEY. */
|
* R_KEY. */
|
||||||
@ -2812,40 +2758,6 @@ gpgme_error_t gpgme_data_new_with_read_cb (gpgme_data_t *r_dh,
|
|||||||
void *read_cb_value)
|
void *read_cb_value)
|
||||||
_GPGME_DEPRECATED(0,4);
|
_GPGME_DEPRECATED(0,4);
|
||||||
|
|
||||||
/* Return the value of the attribute WHAT of KEY, which has to be
|
|
||||||
* representable by a string. IDX specifies the sub key or user ID
|
|
||||||
* for attributes related to sub keys or user IDs. Deprecated, use
|
|
||||||
* key structure directly instead. */
|
|
||||||
const char *gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
_GPGME_DEPRECATED(0,4);
|
|
||||||
|
|
||||||
/* Return the value of the attribute WHAT of KEY, which has to be
|
|
||||||
* representable by an unsigned integer. IDX specifies the sub key or
|
|
||||||
* user ID for attributes related to sub keys or user IDs.
|
|
||||||
* Deprecated, use key structure directly instead. */
|
|
||||||
unsigned long gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
_GPGME_DEPRECATED(0,4);
|
|
||||||
|
|
||||||
/* Return the value of the attribute WHAT of a signature on user ID
|
|
||||||
* UID_IDX in KEY, which has to be representable by a string. IDX
|
|
||||||
* specifies the signature. Deprecated, use key structure directly
|
|
||||||
* instead. */
|
|
||||||
const char *gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx,
|
|
||||||
_gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
_GPGME_DEPRECATED(0,4);
|
|
||||||
|
|
||||||
/* Return the value of the attribute WHAT of a signature on user ID
|
|
||||||
* UID_IDX in KEY, which has to be representable by an unsigned
|
|
||||||
* integer string. IDX specifies the signature. Deprecated, use key
|
|
||||||
* structure directly instead. */
|
|
||||||
unsigned long gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx,
|
|
||||||
_gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
_GPGME_DEPRECATED(0,4);
|
|
||||||
|
|
||||||
|
|
||||||
gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata,
|
gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata,
|
||||||
int *nr) _GPGME_DEPRECATED(0,4);
|
int *nr) _GPGME_DEPRECATED(0,4);
|
||||||
@ -2853,16 +2765,6 @@ gpgme_error_t gpgme_op_import_ext (gpgme_ctx_t ctx, gpgme_data_t keydata,
|
|||||||
/* DO NOT USE. */
|
/* DO NOT USE. */
|
||||||
void gpgme_trust_item_release (gpgme_trust_item_t item) _GPGME_DEPRECATED(0,4);
|
void gpgme_trust_item_release (gpgme_trust_item_t item) _GPGME_DEPRECATED(0,4);
|
||||||
|
|
||||||
/* DO NOT USE. */
|
|
||||||
const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item,
|
|
||||||
_gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
_GPGME_DEPRECATED(0,4);
|
|
||||||
|
|
||||||
/* DO NOT USE. */
|
|
||||||
int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
_GPGME_DEPRECATED(0,4);
|
|
||||||
|
|
||||||
/* Compat.
|
/* Compat.
|
||||||
* This structure shall be considered read-only and an application
|
* This structure shall be considered read-only and an application
|
||||||
@ -2900,7 +2802,6 @@ typedef gpgme_pubkey_algo_t GpgmePubKeyAlgo _GPGME_DEPRECATED(0,4);
|
|||||||
typedef gpgme_hash_algo_t GpgmeHashAlgo _GPGME_DEPRECATED(0,4);
|
typedef gpgme_hash_algo_t GpgmeHashAlgo _GPGME_DEPRECATED(0,4);
|
||||||
typedef gpgme_sig_stat_t GpgmeSigStat _GPGME_DEPRECATED(0,4);
|
typedef gpgme_sig_stat_t GpgmeSigStat _GPGME_DEPRECATED(0,4);
|
||||||
typedef gpgme_sig_mode_t GpgmeSigMode _GPGME_DEPRECATED(0,4);
|
typedef gpgme_sig_mode_t GpgmeSigMode _GPGME_DEPRECATED(0,4);
|
||||||
typedef gpgme_attr_t GpgmeAttr _GPGME_DEPRECATED(0,4);
|
|
||||||
typedef gpgme_validity_t GpgmeValidity _GPGME_DEPRECATED(0,4);
|
typedef gpgme_validity_t GpgmeValidity _GPGME_DEPRECATED(0,4);
|
||||||
typedef gpgme_protocol_t GpgmeProtocol _GPGME_DEPRECATED(0,4);
|
typedef gpgme_protocol_t GpgmeProtocol _GPGME_DEPRECATED(0,4);
|
||||||
typedef gpgme_engine_info_t GpgmeEngineInfo _GPGME_DEPRECATED(0,4);
|
typedef gpgme_engine_info_t GpgmeEngineInfo _GPGME_DEPRECATED(0,4);
|
||||||
|
248
src/key.c
248
src/key.c
@ -557,177 +557,6 @@ capabilities_to_string (gpgme_subkey_t subkey)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Return the value of the attribute WHAT of ITEM, which has to be
|
|
||||||
representable by a string. */
|
|
||||||
const char *
|
|
||||||
gpgme_key_get_string_attr (gpgme_key_t key, _gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
{
|
|
||||||
gpgme_subkey_t subkey;
|
|
||||||
gpgme_user_id_t uid;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!key || reserved || idx < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Select IDXth subkey. */
|
|
||||||
subkey = key->subkeys;
|
|
||||||
for (i = 0; i < idx; i++)
|
|
||||||
{
|
|
||||||
subkey = subkey->next;
|
|
||||||
if (!subkey)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Select the IDXth user ID. */
|
|
||||||
uid = key->uids;
|
|
||||||
for (i = 0; i < idx; i++)
|
|
||||||
{
|
|
||||||
uid = uid->next;
|
|
||||||
if (!uid)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case GPGME_ATTR_KEYID:
|
|
||||||
return subkey ? subkey->keyid : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_FPR:
|
|
||||||
return subkey ? subkey->fpr : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_ALGO:
|
|
||||||
return subkey ? gpgme_pubkey_algo_name (subkey->pubkey_algo) : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_TYPE:
|
|
||||||
return key->protocol == GPGME_PROTOCOL_CMS ? "X.509" : "PGP";
|
|
||||||
|
|
||||||
case GPGME_ATTR_OTRUST:
|
|
||||||
return otrust_to_string (key->owner_trust);
|
|
||||||
|
|
||||||
case GPGME_ATTR_USERID:
|
|
||||||
return uid ? uid->uid : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_NAME:
|
|
||||||
return uid ? uid->name : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_EMAIL:
|
|
||||||
return uid ? uid->email : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_COMMENT:
|
|
||||||
return uid ? uid->comment : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_VALIDITY:
|
|
||||||
return uid ? validity_to_string (uid->validity) : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_KEY_CAPS:
|
|
||||||
return subkey ? capabilities_to_string (subkey) : NULL;
|
|
||||||
|
|
||||||
case GPGME_ATTR_SERIAL:
|
|
||||||
return key->issuer_serial;
|
|
||||||
|
|
||||||
case GPGME_ATTR_ISSUER:
|
|
||||||
return idx ? NULL : key->issuer_name;
|
|
||||||
|
|
||||||
case GPGME_ATTR_CHAINID:
|
|
||||||
return key->chain_id;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned long
|
|
||||||
gpgme_key_get_ulong_attr (gpgme_key_t key, _gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
{
|
|
||||||
gpgme_subkey_t subkey;
|
|
||||||
gpgme_user_id_t uid;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!key || reserved || idx < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Select IDXth subkey. */
|
|
||||||
subkey = key->subkeys;
|
|
||||||
for (i = 0; i < idx; i++)
|
|
||||||
{
|
|
||||||
subkey = subkey->next;
|
|
||||||
if (!subkey)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Select the IDXth user ID. */
|
|
||||||
uid = key->uids;
|
|
||||||
for (i = 0; i < idx; i++)
|
|
||||||
{
|
|
||||||
uid = uid->next;
|
|
||||||
if (!uid)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case GPGME_ATTR_ALGO:
|
|
||||||
return subkey ? (unsigned long) subkey->pubkey_algo : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_LEN:
|
|
||||||
return subkey ? (unsigned long) subkey->length : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_TYPE:
|
|
||||||
return key->protocol == GPGME_PROTOCOL_CMS ? 1 : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_CREATED:
|
|
||||||
return (subkey && subkey->timestamp >= 0)
|
|
||||||
? (unsigned long) subkey->timestamp : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_EXPIRE:
|
|
||||||
return (subkey && subkey->expires >= 0)
|
|
||||||
? (unsigned long) subkey->expires : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_VALIDITY:
|
|
||||||
return uid ? uid->validity : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_OTRUST:
|
|
||||||
return key->owner_trust;
|
|
||||||
|
|
||||||
case GPGME_ATTR_IS_SECRET:
|
|
||||||
return !!key->secret;
|
|
||||||
|
|
||||||
case GPGME_ATTR_KEY_REVOKED:
|
|
||||||
return subkey ? subkey->revoked : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_KEY_INVALID:
|
|
||||||
return subkey ? subkey->invalid : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_KEY_EXPIRED:
|
|
||||||
return subkey ? subkey->expired : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_KEY_DISABLED:
|
|
||||||
return subkey ? subkey->disabled : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_UID_REVOKED:
|
|
||||||
return uid ? uid->revoked : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_UID_INVALID:
|
|
||||||
return uid ? uid->invalid : 0;
|
|
||||||
|
|
||||||
case GPGME_ATTR_CAN_ENCRYPT:
|
|
||||||
return key->can_encrypt;
|
|
||||||
|
|
||||||
case GPGME_ATTR_CAN_SIGN:
|
|
||||||
return key->can_sign;
|
|
||||||
|
|
||||||
case GPGME_ATTR_CAN_CERTIFY:
|
|
||||||
return key->can_certify;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gpgme_key_sig_t
|
static gpgme_key_sig_t
|
||||||
get_keysig (gpgme_key_t key, int uid_idx, int idx)
|
get_keysig (gpgme_key_t key, int uid_idx, int idx)
|
||||||
{
|
{
|
||||||
@ -754,80 +583,3 @@ get_keysig (gpgme_key_t key, int uid_idx, int idx)
|
|||||||
}
|
}
|
||||||
return sig;
|
return sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
|
||||||
gpgme_key_sig_get_string_attr (gpgme_key_t key, int uid_idx,
|
|
||||||
_gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
{
|
|
||||||
gpgme_key_sig_t certsig = get_keysig (key, uid_idx, idx);
|
|
||||||
|
|
||||||
if (!certsig || reserved)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case GPGME_ATTR_KEYID:
|
|
||||||
return certsig->keyid;
|
|
||||||
|
|
||||||
case GPGME_ATTR_ALGO:
|
|
||||||
return gpgme_pubkey_algo_name (certsig->pubkey_algo);
|
|
||||||
|
|
||||||
case GPGME_ATTR_USERID:
|
|
||||||
return certsig->uid;
|
|
||||||
|
|
||||||
case GPGME_ATTR_NAME:
|
|
||||||
return certsig->name;
|
|
||||||
|
|
||||||
case GPGME_ATTR_EMAIL:
|
|
||||||
return certsig->email;
|
|
||||||
|
|
||||||
case GPGME_ATTR_COMMENT:
|
|
||||||
return certsig->comment;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned long
|
|
||||||
gpgme_key_sig_get_ulong_attr (gpgme_key_t key, int uid_idx, _gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
{
|
|
||||||
gpgme_key_sig_t certsig = get_keysig (key, uid_idx, idx);
|
|
||||||
|
|
||||||
if (!certsig || reserved)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case GPGME_ATTR_ALGO:
|
|
||||||
return (unsigned long) certsig->pubkey_algo;
|
|
||||||
|
|
||||||
case GPGME_ATTR_CREATED:
|
|
||||||
return certsig->timestamp < 0 ? 0L : (unsigned long) certsig->timestamp;
|
|
||||||
|
|
||||||
case GPGME_ATTR_EXPIRE:
|
|
||||||
return certsig->expires < 0 ? 0L : (unsigned long) certsig->expires;
|
|
||||||
|
|
||||||
case GPGME_ATTR_KEY_REVOKED:
|
|
||||||
return certsig->revoked;
|
|
||||||
|
|
||||||
case GPGME_ATTR_KEY_INVALID:
|
|
||||||
return certsig->invalid;
|
|
||||||
|
|
||||||
case GPGME_ATTR_KEY_EXPIRED:
|
|
||||||
return certsig->expired;
|
|
||||||
|
|
||||||
case GPGME_ATTR_SIG_CLASS:
|
|
||||||
return certsig->sig_class;
|
|
||||||
|
|
||||||
case GPGME_ATTR_SIG_STATUS:
|
|
||||||
return certsig->status;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -258,16 +258,8 @@ GPGME_1.0 {
|
|||||||
gpgme_data_new_with_read_cb;
|
gpgme_data_new_with_read_cb;
|
||||||
gpgme_data_rewind;
|
gpgme_data_rewind;
|
||||||
gpgme_get_sig_status;
|
gpgme_get_sig_status;
|
||||||
gpgme_get_sig_string_attr;
|
|
||||||
gpgme_get_sig_ulong_attr;
|
|
||||||
gpgme_get_sig_key;
|
gpgme_get_sig_key;
|
||||||
gpgme_key_get_string_attr;
|
|
||||||
gpgme_key_get_ulong_attr;
|
|
||||||
gpgme_key_sig_get_string_attr;
|
|
||||||
gpgme_key_sig_get_ulong_attr;
|
|
||||||
gpgme_op_import_ext;
|
gpgme_op_import_ext;
|
||||||
gpgme_trust_item_get_int_attr;
|
|
||||||
gpgme_trust_item_get_string_attr;
|
|
||||||
gpgme_trust_item_release;
|
gpgme_trust_item_release;
|
||||||
|
|
||||||
gpgme_err_code_from_syserror;
|
gpgme_err_code_from_syserror;
|
||||||
|
@ -99,74 +99,3 @@ gpgme_trust_item_release (gpgme_trust_item_t item)
|
|||||||
{
|
{
|
||||||
gpgme_trust_item_unref (item);
|
gpgme_trust_item_unref (item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the value of the attribute WHAT of ITEM, which has to be
|
|
||||||
representable by a string. */
|
|
||||||
const char *gpgme_trust_item_get_string_attr (gpgme_trust_item_t item,
|
|
||||||
_gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
{
|
|
||||||
const char *val = NULL;
|
|
||||||
|
|
||||||
if (!item)
|
|
||||||
return NULL;
|
|
||||||
if (reserved)
|
|
||||||
return NULL;
|
|
||||||
if (idx)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case GPGME_ATTR_KEYID:
|
|
||||||
val = item->keyid;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPGME_ATTR_OTRUST:
|
|
||||||
val = item->owner_trust;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPGME_ATTR_VALIDITY:
|
|
||||||
val = item->validity;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPGME_ATTR_USERID:
|
|
||||||
val = item->name;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Return the value of the attribute WHAT of KEY, which has to be
|
|
||||||
representable by an integer. IDX specifies a running index if the
|
|
||||||
attribute appears more than once in the key. */
|
|
||||||
int gpgme_trust_item_get_int_attr (gpgme_trust_item_t item, _gpgme_attr_t what,
|
|
||||||
const void *reserved, int idx)
|
|
||||||
{
|
|
||||||
int val = 0;
|
|
||||||
|
|
||||||
if (!item)
|
|
||||||
return 0;
|
|
||||||
if (reserved)
|
|
||||||
return 0;
|
|
||||||
if (idx)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case GPGME_ATTR_LEVEL:
|
|
||||||
val = item->level;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GPGME_ATTR_TYPE:
|
|
||||||
val = item->type;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
106
src/verify.c
106
src/verify.c
@ -1309,109 +1309,3 @@ gpgme_get_sig_status (gpgme_ctx_t ctx, int idx,
|
|||||||
*r_created = sig->timestamp;
|
*r_created = sig->timestamp;
|
||||||
return sig->fpr;
|
return sig->fpr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Retrieve certain attributes of a signature. IDX is the index
|
|
||||||
number of the signature after a successful verify operation. WHAT
|
|
||||||
is an attribute where GPGME_ATTR_EXPIRE is probably the most useful
|
|
||||||
one. WHATIDX is to be passed as 0 for most attributes . */
|
|
||||||
unsigned long
|
|
||||||
gpgme_get_sig_ulong_attr (gpgme_ctx_t ctx, int idx,
|
|
||||||
_gpgme_attr_t what, int whatidx)
|
|
||||||
{
|
|
||||||
gpgme_verify_result_t result;
|
|
||||||
gpgme_signature_t sig;
|
|
||||||
|
|
||||||
(void)whatidx;
|
|
||||||
|
|
||||||
result = gpgme_op_verify_result (ctx);
|
|
||||||
sig = result->signatures;
|
|
||||||
|
|
||||||
while (sig && idx)
|
|
||||||
{
|
|
||||||
sig = sig->next;
|
|
||||||
idx--;
|
|
||||||
}
|
|
||||||
if (!sig || idx)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case GPGME_ATTR_CREATED:
|
|
||||||
return sig->timestamp;
|
|
||||||
|
|
||||||
case GPGME_ATTR_EXPIRE:
|
|
||||||
return sig->exp_timestamp;
|
|
||||||
|
|
||||||
case GPGME_ATTR_VALIDITY:
|
|
||||||
return (unsigned long) sig->validity;
|
|
||||||
|
|
||||||
case GPGME_ATTR_SIG_STATUS:
|
|
||||||
switch (gpg_err_code (sig->status))
|
|
||||||
{
|
|
||||||
case GPG_ERR_NO_ERROR:
|
|
||||||
return GPGME_SIG_STAT_GOOD;
|
|
||||||
|
|
||||||
case GPG_ERR_BAD_SIGNATURE:
|
|
||||||
return GPGME_SIG_STAT_BAD;
|
|
||||||
|
|
||||||
case GPG_ERR_NO_PUBKEY:
|
|
||||||
return GPGME_SIG_STAT_NOKEY;
|
|
||||||
|
|
||||||
case GPG_ERR_NO_DATA:
|
|
||||||
return GPGME_SIG_STAT_NOSIG;
|
|
||||||
|
|
||||||
case GPG_ERR_SIG_EXPIRED:
|
|
||||||
return GPGME_SIG_STAT_GOOD_EXP;
|
|
||||||
|
|
||||||
case GPG_ERR_KEY_EXPIRED:
|
|
||||||
return GPGME_SIG_STAT_GOOD_EXPKEY;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return GPGME_SIG_STAT_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
case GPGME_ATTR_SIG_SUMMARY:
|
|
||||||
return sig->summary;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char *
|
|
||||||
gpgme_get_sig_string_attr (gpgme_ctx_t ctx, int idx,
|
|
||||||
_gpgme_attr_t what, int whatidx)
|
|
||||||
{
|
|
||||||
gpgme_verify_result_t result;
|
|
||||||
gpgme_signature_t sig;
|
|
||||||
|
|
||||||
result = gpgme_op_verify_result (ctx);
|
|
||||||
sig = result->signatures;
|
|
||||||
|
|
||||||
while (sig && idx)
|
|
||||||
{
|
|
||||||
sig = sig->next;
|
|
||||||
idx--;
|
|
||||||
}
|
|
||||||
if (!sig || idx)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
switch (what)
|
|
||||||
{
|
|
||||||
case GPGME_ATTR_FPR:
|
|
||||||
return sig->fpr;
|
|
||||||
|
|
||||||
case GPGME_ATTR_ERRTOK:
|
|
||||||
if (whatidx == 1)
|
|
||||||
return sig->wrong_key_usage ? "Wrong_Key_Usage" : "";
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user