summaryrefslogtreecommitdiff
path: root/lib/openpgp/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/openpgp/output.c')
-rw-r--r--lib/openpgp/output.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/lib/openpgp/output.c b/lib/openpgp/output.c
index 636f86c6f7..e05c3ff94d 100644
--- a/lib/openpgp/output.c
+++ b/lib/openpgp/output.c
@@ -162,9 +162,9 @@ print_key_revoked (gnutls_string * str, gnutls_openpgp_crt_t cert, int idx)
err = gnutls_openpgp_crt_get_subkey_revoked_status( cert, idx);
if (err != 0)
- addf (str, "\tRevoked: True\n");
+ addf (str, _("\tRevoked: True\n"));
else
- addf (str, "\tRevoked: False\n");
+ addf (str, _("\tRevoked: False\n"));
}
static void
@@ -201,12 +201,19 @@ print_key_times(gnutls_string * str, gnutls_openpgp_crt_t cert, int idx)
size_t max = sizeof (s);
struct tm t;
- if (gmtime_r (&tim, &t) == NULL)
- addf (str, "error: gmtime_r (%d)\n", t);
- else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0)
- addf (str, "error: strftime (%d)\n", t);
+ if (tim == 0)
+ {
+ addf (str, _("\t\tExpiration: Never\n"), s);
+ }
else
- addf (str, _("\t\tExpiration: %s\n"), s);
+ {
+ if (gmtime_r (&tim, &t) == NULL)
+ addf (str, "error: gmtime_r (%d)\n", t);
+ else if (strftime (s, max, "%a %b %e %H:%M:%S UTC %Y", &t) == 0)
+ addf (str, "error: strftime (%d)\n", t);
+ else
+ addf (str, _("\t\tExpiration: %s\n"), s);
+ }
}
}
@@ -227,7 +234,7 @@ print_key_info(gnutls_string * str, gnutls_openpgp_crt_t cert, int idx)
{
const char *name = gnutls_pk_algorithm_get_name (err);
if (name == NULL)
- name = "Unknown";
+ name = _("unknown");
addf (str, _("\tPublic Key Algorithm: %s\n"), name);
switch (err)
@@ -325,15 +332,17 @@ size_t dn_size;
dn_size = sizeof(dn);
err = gnutls_openpgp_crt_get_name (cert, i++, dn, &dn_size);
- if (err < 0 && err != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE && err != GNUTLS_E_OPENPGP_UID_REVOKED) {
- addf (str, "error: get_name: %s %d\n", gnutls_strerror (err), err);
- break;
- }
+ if (err < 0 && err != GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE &&
+ err != GNUTLS_E_OPENPGP_UID_REVOKED)
+ {
+ addf (str, "error: get_name: %s %d\n", gnutls_strerror (err), err);
+ break;
+ }
if (err >= 0)
addf (str, _("\tName[%d]: %s\n"), i-1, dn);
else if (err == GNUTLS_E_OPENPGP_UID_REVOKED) {
- addf (str, _("\tRevoked Name[%d]: %s\n"), i-1, dn);
+ addf (str, _("\tRevoked Name[%d]: %s\n"), i-1, dn);
}
} while( err >= 0);
@@ -346,10 +355,10 @@ size_t dn_size;
subkeys = gnutls_openpgp_crt_get_subkey_count( cert);
if (subkeys < 0)
return;
-
+
for (i=0;i<subkeys;i++) {
addf( str, _("\n\tSubkey[%d]:\n"), i);
-
+
print_key_revoked( str, cert, i);
print_key_id( str, cert, i);
print_key_times( str, cert, i);
@@ -365,14 +374,14 @@ size_t dn_size;
* @format: Indicate the format to use
* @out: Newly allocated datum with zero terminated string.
*
- * This function will pretty print an OpenPGP certificate, suitable for
- * display to a human.
+ * This function will pretty print an OpenPGP certificate, suitable
+ * for display to a human.
*
* The format should be zero for future compatibility.
*
* The output @out needs to be deallocate using gnutls_free().
*
- * Returns 0 on success.
+ * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
**/
int
gnutls_openpgp_crt_print (gnutls_openpgp_crt_t cert,