From 0dabbf67989cac5cf77daef8ba773c795e3b1a94 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 20 Feb 2019 12:59:27 -0500 Subject: [PATCH] show offline signature expiration time and trasient signature type --- i2pd | 2 +- keyinfo.cpp | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/i2pd b/i2pd index 80ffe13..d40a029 160000 --- a/i2pd +++ b/i2pd @@ -1 +1 @@ -Subproject commit 80ffe13f3e2b00e35ad4acb68e12b0ff891a7967 +Subproject commit d40a029dae39a1c4185117b880b16b7d8e391985 diff --git a/keyinfo.cpp b/keyinfo.cpp index a2e236b..576725a 100644 --- a/keyinfo.cpp +++ b/keyinfo.cpp @@ -1,12 +1,23 @@ #include "Identity.h" +#include "I2PEndian.h" #include #include #include #include #include +#include +#include #include "common/key.hpp" +std::string ConvertTime (time_t t) +{ + struct tm *tm = localtime(&t); + char date[128]; + snprintf(date, sizeof(date), "%02d/%02d/%d %02d:%02d:%02d", tm->tm_mday, tm->tm_mon + 1, tm->tm_year + 1900, tm->tm_hour, tm->tm_min, tm->tm_sec); + return date; +} + int main(int argc, char * argv[]) { if(argc == 1) { @@ -62,7 +73,13 @@ int main(int argc, char * argv[]) std::cout << "B32 Address: " << ident.ToBase32() << ".b32.i2p" << std::endl; std::cout << "Signature Type: " << SigTypeToName(dest->GetSigningKeyType()) << std::endl; std::cout << "Encryption Type: " << (int) dest->GetCryptoKeyType() << std::endl; - if (keys.IsOfflineSignature ()) std::cout << "Offline signature" << std::endl; + if (keys.IsOfflineSignature ()) + { + std::cout << "Offline signature" << std::endl; + const auto& offlineSignature = keys.GetOfflineSignature (); + std::cout << "Expires: " << ConvertTime (bufbe32toh(offlineSignature.data ())) << std::endl; + std::cout << "Transient Signature Type: " << SigTypeToName(bufbe16toh(offlineSignature.data () + 4)) << std::endl; + } } else { if(print_full) { std::cout << dest->ToBase64() << std::endl;