int set_secret(int type, bufferptr& s);
bufferptr& get_secret() { return secret; }
+ void encode_base64(string& s) {
+ bufferlist bl;
+ encode(bl);
+ bufferlist e;
+ bl.encode_base64(e);
+ e.append('\0');
+ s = e.c_str();
+ }
+
// --
int create(int type);
int encrypt(const bufferlist& in, bufferlist& out);
}
}
} else if (print_key) {
- if (keys_map.count(s))
- cout << keys_map[s].key << std::endl;
+ if (keys_map.count(s)) {
+ string a;
+ keys_map[s].key.encode_base64(a);
+ cout << a << std::endl;
+ }
else
cerr << "entity " << s << " not found" << std::endl;
}
#include "config.h"
#include "include/types.h"
+#include "armor.h"
#include <errno.h>
#include <fstream>
atomic_t buffer_total_alloc;
+
+void buffer::list::encode_base64(buffer::list& o)
+{
+ bufferptr bp(length() * 4 / 3 + 1);
+ int l = ceph_armor(bp.c_str(), c_str(), c_str() + length());
+ bp.set_length(l);
+ o.push_back(bp);
+}
+
+
int buffer::list::read_file(const char *fn, bool silent)
{
struct stat st;
}*/
}
+ void encode_base64(list& o);
+
void hexdump(std::ostream &out);
int read_file(const char *fn, bool silent=false);
int write_file(const char *fn);