[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Make tor-print-ed-signing-cert output RFC1123 and unix timestamps as well
commit ffce19a9ec71a6753673f84535f16003f38eb214
Author: rl1987 <rl1987@xxxxxxxxxxxxxxxx>
Date: Wed Jul 10 11:36:26 2019 +0300
Make tor-print-ed-signing-cert output RFC1123 and unix timestamps as well
---
changes/ticket31012 | 4 ++++
doc/tor-print-ed-signing-cert.1.txt | 6 ++++++
src/tools/tor-print-ed-signing-cert.c | 7 +++++++
3 files changed, 17 insertions(+)
diff --git a/changes/ticket31012 b/changes/ticket31012
new file mode 100644
index 000000000..61ea30d8d
--- /dev/null
+++ b/changes/ticket31012
@@ -0,0 +1,4 @@
+ o Minor bugfixes (operator tools):
+ - Make tor-print-ed-signing-cert(1) print certificate expiration date in
+ RFC 1123 and UNIX timestamp formats, to make output machine readable.
+ Fixes bug 31012; bugfix on 0.3.5.1-alpha.
diff --git a/doc/tor-print-ed-signing-cert.1.txt b/doc/tor-print-ed-signing-cert.1.txt
index 1a3109df9..48a3f095d 100644
--- a/doc/tor-print-ed-signing-cert.1.txt
+++ b/doc/tor-print-ed-signing-cert.1.txt
@@ -21,6 +21,12 @@ DESCRIPTION
**tor-print-ed-signing-cert** is utility program for Tor relay operators to
check expiration date of ed25519 signing certificate.
+Expiration date is printed in three formats:
+
+* Human-readable timestamp, localized to current timezone.
+* RFC 1123 timestamp (at GMT timezone).
+* Unix time value.
+
SEE ALSO
--------
**tor**(1) +
diff --git a/src/tools/tor-print-ed-signing-cert.c b/src/tools/tor-print-ed-signing-cert.c
index 1f1a01ab5..43a1d7bcb 100644
--- a/src/tools/tor-print-ed-signing-cert.c
+++ b/src/tools/tor-print-ed-signing-cert.c
@@ -10,11 +10,13 @@
#include "lib/cc/torint.h" /* TOR_PRIdSZ */
#include "lib/crypt_ops/crypto_format.h"
#include "lib/malloc/malloc.h"
+#include "lib/encoding/time_fmt.h"
int
main(int argc, char **argv)
{
ed25519_cert_t *cert = NULL;
+ char rfc1123_buf[RFC1123_TIME_LEN+1] = "";
if (argc != 2) {
fprintf(stderr, "Usage:\n");
@@ -59,6 +61,11 @@ main(int argc, char **argv)
printf("Expires at: %s", ctime(&expires_at));
+ format_rfc1123_time(rfc1123_buf, expires_at);
+ printf("RFC 1123 timestamp: %s\n", rfc1123_buf);
+
+ printf("UNIX timestamp: %ld\n", (long int)expires_at);
+
ed25519_cert_free(cert);
return 0;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits