From 6850433e8a86f20c061c4f925540965a555349fb Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 22 Oct 2009 11:52:07 -0700 Subject: [PATCH] auth: authtool dumps the key either --- src/auth/Crypto.cc | 8 ++++++++ src/auth/Crypto.h | 2 ++ src/authtool.cc | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/auth/Crypto.cc b/src/auth/Crypto.cc index 92e8ac46e965e..07b04938b6a52 100644 --- a/src/auth/Crypto.cc +++ b/src/auth/Crypto.cc @@ -293,3 +293,11 @@ void CryptoKey::print(ostream &out) const foo[r] = 0; out << foo; } + +void CryptoKey::to_str(string& s) +{ + int len = secret.length() * 4; + char buf[len]; + hex2str(secret.c_str(), secret.length(), buf, len); + s = buf; +} diff --git a/src/auth/Crypto.h b/src/auth/Crypto.h index 4991461de5b26..7aff492747ec7 100644 --- a/src/auth/Crypto.h +++ b/src/auth/Crypto.h @@ -55,6 +55,8 @@ public: int create(int type); int encrypt(const bufferlist& in, bufferlist& out); int decrypt(const bufferlist& in, bufferlist& out); + + void to_str(string& s); }; WRITE_CLASS_ENCODER(CryptoKey); diff --git a/src/authtool.cc b/src/authtool.cc index f6c3e68dc0dda..6a08167560556 100644 --- a/src/authtool.cc +++ b/src/authtool.cc @@ -106,7 +106,7 @@ int main(int argc, const char **argv) } else { cout << n << std::endl; } - cout << "\tkey " << iter->second.key << std::endl; + cout << "\tkey: " << iter->second.key << std::endl; map::iterator capsiter = iter->second.caps.begin(); for (; capsiter != iter->second.caps.end(); ++capsiter) { bufferlist::iterator dataiter = capsiter->second.begin(); -- 2.39.5