* The new gpgme_op_sign_result function provides detailed information
about the result of a signing operation in gpgme_sign_result_t,
- gpgme_invalid_user_id_t and gpgme_new_signature_t objects.
+ gpgme_invalid_key_t and gpgme_new_signature_t objects.
* The new gpgme_op_encrypt_result function provides detailed
information about the result of an encryption operation in
gpgme_import_result_t NEW
gpgme_pubkey_algo_t NEW
gpgme_hash_algo_t NEW
-gpgme_invalid_user_id_t NEW
+gpgme_invalid_key_t NEW
gpgme_new_signature_t NEW
gpgme_sign_result_t NEW
gpgme_op_sign_result NEW
Hey Emacs, this is -*- outline -*- mode!
* Before release:
-** Change gpgme_invalid_user_id_t to gpgme_invalid_key_t.
** gpgme-config must include info about libgpg-error.
* ABI's to break:
+2003-06-06 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgme.texi (Crypto Operations): Rename gpgme_invalid_user_id_t
+ to gpgme_invalid_key_t.
+
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi: Change error codes to GPG_ERR_* variants.
@cindex cryptographic operation
Sometimes, the result of a crypto operation returns a list of invalid
-user IDs encountered in processing the request. The following
-structure is used to hold information about such an user ID.
+keys encountered in processing the request. The following structure
+is used to hold information about such a key.
-@deftp {Data type} {gpgme_invalid_user_id_t}
+@deftp {Data type} {gpgme_invalid_key_t}
This is a pointer to a structure used to store a part of the result of
a crypto operation which takes user IDs as one input parameter. The
structure contains the following members:
@table @code
-@item gpgme_invalid_user_id_t next
-This is a pointer to the next invalid user ID structure in the linked
+@item gpgme_invalid_key_t next
+This is a pointer to the next invalid key structure in the linked
list, or @code{NULL} if this is the last element.
-@item char *id
-The invalid user ID encountered.
+@item char *fpr
+The fingerprint or key ID of the invalid key encountered.
@item gpgme_error_t reason
-An error code describing the reason why the user ID was found invalid.
+An error code describing the reason why the key was found invalid.
@end table
@end deftp
members:
@table @code
-@item gpgme_invalid_user_id_t invalid_signers
-A linked list with information about all invalid user IDs for which a
+@item gpgme_invalid_key_t invalid_signers
+A linked list with information about all invalid keys for which a
signature could not be created.
@item gpgme_new_signature_t signatures
members:
@table @code
-@item gpgme_invalid_user_id_t invalid_recipients
-A linked list with information about all invalid user IDs for which
+@item gpgme_invalid_key_t invalid_recipients
+A linked list with information about all invalid keys for which
the data could not be encrypted.
@end table
@end deftp
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
+ * op-support.c (_gpgme_parse_inv_userid): Rename to
+ _gpgme_parse_inv_recp and change to new datatype.
+ * ops.h (_gpgme_parse_inv_key): Fix prototype.
+ * gpgme.h (struct _gpgme_invalid_user_id): Rename to
+ __gpgme_invalid_key. Rename field ID to KEY.
+ (gpgme_invalid_user_id_t): Rename to gpgme_invalid_key_t.
+ (struct _gpgme_op_encrypt_result): Here, too.
+ (struct _gpgme_op_sign_result): Likewise.
+ * encrypt.c (struct op_data): Likewise.
+ (release_op_data): Likewise.
+ * sign.c (struct op_data): Likewise.
+ (release_op_data): Likewise.
+
* posix-io.c (_gpgme_io_read): Save errno across debug calls.
(_gpgme_io_write): Likewise.
(_gpgme_io_pipe): Likewise.
/* A pointer to the next pointer of the last invalid recipient in
the list. This makes appending new invalid recipients painless
while preserving the order. */
- gpgme_invalid_user_id_t *lastp;
+ gpgme_invalid_key_t *lastp;
} *op_data_t;
release_op_data (void *hook)
{
op_data_t opd = (op_data_t) hook;
- gpgme_invalid_user_id_t invalid_recipient = opd->result.invalid_recipients;
+ gpgme_invalid_key_t invalid_recipient = opd->result.invalid_recipients;
while (invalid_recipient)
{
- gpgme_invalid_user_id_t next = invalid_recipient->next;
- free (invalid_recipient->id);
+ gpgme_invalid_key_t next = invalid_recipient->next;
+ if (invalid_recipient->fpr)
+ free (invalid_recipient->fpr);
invalid_recipient = next;
}
}
break;
case GPGME_STATUS_INV_RECP:
- err = _gpgme_parse_inv_userid (args, opd->lastp);
+ err = _gpgme_parse_inv_recp (args, opd->lastp);
if (err)
return err;
/* Return an error value with the error source SOURCE and the system
error ERR. */
-gpgme_error_t gpgme_err_make_from_errno (gpg_err_source_t source, int err);
+gpgme_error_t gpgme_err_make_from_errno (gpgme_err_source_t source, int err);
/* Return an error value with the system error ERR. */
-gpgme_err_code_t gpg_error_from_errno (int err);
+gpgme_err_code_t gpgme_error_from_errno (int err);
\f
/* The possible encoding mode of gpgme_data_t objects. */
\f
/* Crypto Operations. */
-struct _gpgme_invalid_user_id
+struct _gpgme_invalid_key
{
- struct _gpgme_invalid_user_id *next;
- char *id;
+ struct _gpgme_invalid_key *next;
+ char *fpr;
gpgme_error_t reason;
};
-typedef struct _gpgme_invalid_user_id *gpgme_invalid_user_id_t;
+typedef struct _gpgme_invalid_key *gpgme_invalid_key_t;
\f
/* Encryption. */
struct _gpgme_op_encrypt_result
{
/* The list of invalid recipients. */
- gpgme_invalid_user_id_t invalid_recipients;
+ gpgme_invalid_key_t invalid_recipients;
};
typedef struct _gpgme_op_encrypt_result *gpgme_encrypt_result_t;
struct _gpgme_op_sign_result
{
/* The list of invalid signers. */
- gpgme_invalid_user_id_t invalid_signers;
+ gpgme_invalid_key_t invalid_signers;
gpgme_new_signature_t signatures;
};
typedef struct _gpgme_op_sign_result *gpgme_sign_result_t;
typedef gpgme_data_seek_cb_t GpgmeDataSeekCb _GPGME_DEPRECATED;
typedef gpgme_data_release_cb_t GpgmeDataReleaseCb _GPGME_DEPRECATED;
#define GpgmeDataCbs gpgme_data_cbs
-typedef gpgme_invalid_user_id_t GpgmeInvalidUserID _GPGME_DEPRECATED;
typedef gpgme_encrypt_result_t GpgmeEncryptResult _GPGME_DEPRECATED;
typedef gpgme_sig_notation_t GpgmeSigNotation _GPGME_DEPRECATED;
typedef gpgme_signature_t GpgmeSignature _GPGME_DEPRECATED;
\f
gpgme_error_t
-_gpgme_parse_inv_userid (char *args, gpgme_invalid_user_id_t *userid)
+_gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key)
{
- gpgme_invalid_user_id_t inv_userid;
+ gpgme_invalid_key_t inv_key;
char *tail;
long int reason;
- inv_userid = malloc (sizeof (*inv_userid));
- if (!inv_userid)
+ inv_key = malloc (sizeof (*inv_key));
+ if (!inv_key)
return gpg_error_from_errno (errno);
- inv_userid->next = NULL;
+ inv_key->next = NULL;
errno = 0;
reason = strtol (args, &tail, 0);
if (errno || args == tail || *tail != ' ')
{
/* The crypto backend does not behave. */
- free (inv_userid);
+ free (inv_key);
return gpg_error (GPG_ERR_INV_ENGINE);
}
{
default:
case 0:
- inv_userid->reason = gpg_error (GPG_ERR_GENERAL);
+ inv_key->reason = gpg_error (GPG_ERR_GENERAL);
break;
case 1:
- inv_userid->reason = gpg_error (GPG_ERR_NO_PUBKEY);
+ inv_key->reason = gpg_error (GPG_ERR_NO_PUBKEY);
break;
case 2:
- /* FIXME: Ambiguous specification. */
- inv_userid->reason = gpg_error (GPG_ERR_AMBIGUOUS_NAME);
+ inv_key->reason = gpg_error (GPG_ERR_AMBIGUOUS_NAME);
break;
case 3:
- inv_userid->reason = gpg_error (GPG_ERR_WRONG_KEY_USAGE);
+ inv_key->reason = gpg_error (GPG_ERR_WRONG_KEY_USAGE);
break;
case 4:
- inv_userid->reason = gpg_error (GPG_ERR_CERT_REVOKED);
+ inv_key->reason = gpg_error (GPG_ERR_CERT_REVOKED);
break;
case 5:
- inv_userid->reason = gpg_error (GPG_ERR_CERT_EXPIRED);
+ inv_key->reason = gpg_error (GPG_ERR_CERT_EXPIRED);
break;
case 6:
- inv_userid->reason = gpg_error (GPG_ERR_NO_CRL_KNOWN);
+ inv_key->reason = gpg_error (GPG_ERR_NO_CRL_KNOWN);
break;
case 7:
- inv_userid->reason = gpg_error (GPG_ERR_CRL_TOO_OLD);
+ inv_key->reason = gpg_error (GPG_ERR_CRL_TOO_OLD);
break;
case 8:
- inv_userid->reason = gpg_error (GPG_ERR_NO_POLICY_MATCH);
+ inv_key->reason = gpg_error (GPG_ERR_NO_POLICY_MATCH);
break;
case 9:
- inv_userid->reason = gpg_error (GPG_ERR_NO_SECKEY);
+ inv_key->reason = gpg_error (GPG_ERR_NO_SECKEY);
break;
case 10:
- inv_userid->reason = gpg_error (GPG_ERR_PUBKEY_NOT_TRUSTED);
+ inv_key->reason = gpg_error (GPG_ERR_PUBKEY_NOT_TRUSTED);
break;
}
tail++;
if (*tail)
{
- inv_userid->id = strdup (tail);
- if (!inv_userid->id)
+ inv_key->fpr = strdup (tail);
+ if (!inv_key->fpr)
{
int saved_errno = errno;
- free (inv_userid);
+ free (inv_key);
return gpg_error_from_errno (saved_errno);
}
}
else
- inv_userid->id = NULL;
+ inv_key->fpr = NULL;
- *userid = inv_userid;
+ *key = inv_key;
return 0;
}
/* Prepare a new operation on CTX. */
gpgme_error_t _gpgme_op_reset (gpgme_ctx_t ctx, int synchronous);
-/* Parse the invalid user ID status line in ARGS and return the result
- in USERID. */
-gpgme_error_t _gpgme_parse_inv_userid (char *args,
- gpgme_invalid_user_id_t *userid);
+/* Parse the INV_RECP status line in ARGS and return the result in
+ KEY. */
+gpgme_error_t _gpgme_parse_inv_recp (char *args, gpgme_invalid_key_t *key);
\f
/* From verify.c. */
/* A pointer to the next pointer of the last invalid signer in
the list. This makes appending new invalid signers painless
while preserving the order. */
- gpgme_invalid_user_id_t *last_signer_p;
+ gpgme_invalid_key_t *last_signer_p;
/* Likewise for signature information. */
gpgme_new_signature_t *last_sig_p;
release_op_data (void *hook)
{
op_data_t opd = (op_data_t) hook;
- gpgme_invalid_user_id_t invalid_signer = opd->result.invalid_signers;
+ gpgme_invalid_key_t invalid_signer = opd->result.invalid_signers;
gpgme_new_signature_t sig = opd->result.signatures;
while (invalid_signer)
{
- gpgme_invalid_user_id_t next = invalid_signer->next;
- free (invalid_signer->id);
+ gpgme_invalid_key_t next = invalid_signer->next;
+ if (invalid_signer->fpr)
+ free (invalid_signer->fpr);
free (invalid_signer);
invalid_signer = next;
}
break;
case GPGME_STATUS_INV_RECP:
- err = _gpgme_parse_inv_userid (args, opd->last_signer_p);
+ err = _gpgme_parse_inv_recp (args, opd->last_signer_p);
if (err)
return err;
case GPGME_STATUS_EOF:
if (opd->result.invalid_signers)
- return gpg_error (GPG_ERR_INV_USER_ID);
+ return gpg_error (GPG_ERR_UNUSABLE_SECKEY);
break;
default:
if (result->invalid_signers)
{
fprintf (stderr, "Invalid signer found: %s\n",
- result->invalid_signers->id);
+ result->invalid_signers->fpr);
exit (1);
}
if (!result->signatures || result->signatures->next)
if (result->invalid_recipients)
{
fprintf (stderr, "Invalid recipient encountered: %s\n",
- result->invalid_recipients->id);
+ result->invalid_recipients->fpr);
exit (1);
}
sign_result = gpgme_op_sign_result (ctx);
if (result->invalid_recipients)
{
fprintf (stderr, "Invalid recipient encountered: %s\n",
- result->invalid_recipients->id);
+ result->invalid_recipients->fpr);
exit (1);
}
print_data (out);
if (result->invalid_signers)
{
fprintf (stderr, "Invalid signer found: %s\n",
- result->invalid_signers->id);
+ result->invalid_signers->fpr);
exit (1);
}
if (!result->signatures || result->signatures->next)
if (result->invalid_signers)
{
fprintf (stderr, "Invalid signer found: %s\n",
- result->invalid_signers->id);
+ result->invalid_signers->fpr);
exit (1);
}
if (!result->signatures || !result->signatures->next
ret = gpgme_data_seek (dh, 0, SEEK_SET);
if (ret)
- fail_if_err (gpgme_error_from_errno (errno));
+ fail_if_err (gpgme_err_code_from_errno (errno));
while ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) > 0)
fwrite (buf, ret, 1, stdout);
if (ret < 0)
- fail_if_err (gpgme_error_from_errno (errno));
+ fail_if_err (gpgme_err_code_from_errno (errno));
}
if (result->invalid_recipients)
{
fprintf (stderr, "Invalid recipient encountered: %s\n",
- result->invalid_recipients->id);
+ result->invalid_recipients->fpr);
exit (1);
}
print_data (out);
if (result->invalid_signers)
{
fprintf (stderr, "Invalid signer found: %s\n",
- result->invalid_signers->id);
+ result->invalid_signers->fpr);
exit (1);
}
if (!result->signatures || result->signatures->next)