diff --git a/src/basic_api.cc b/src/basic_api.cc index 8baebe2..e6c9146 100644 --- a/src/basic_api.cc +++ b/src/basic_api.cc @@ -119,6 +119,17 @@ namespace pEp { return result; } + string export_key(Identity ident) + { + PEP_STATUS status = PEP_STATUS_OK; + char* key_data = NULL; + size_t size; + status = ::export_key(adapter.session(), ident.fpr().c_str(), &key_data, &size); + + _throw_status(status); + return key_data; + } + void set_own_key(Identity& ident, string fpr) { if (ident.address() == "") diff --git a/src/basic_api.hh b/src/basic_api.hh index 4be530a..8daf888 100644 --- a/src/basic_api.hh +++ b/src/basic_api.hh @@ -18,6 +18,7 @@ namespace pEp { void key_reset_trust(Identity ident); boost::python::list import_key(string key_data); + string export_key(Identity ident); void set_own_key(Identity& ident, string fpr); } } diff --git a/src/pEpmodule.cc b/src/pEpmodule.cc index d79a7ff..4312f05 100644 --- a/src/pEpmodule.cc +++ b/src/pEpmodule.cc @@ -445,6 +445,12 @@ BOOST_PYTHON_MODULE(pEp) "import key(s) from key_data\n" ); + def("export_key", &pEp::PythonAdapter::export_key, + "key_data = export_key(identity)\n" + "\n" + "export key(s) of identity\n" + ); + def("set_own_key", &pEp::PythonAdapter::set_own_key, "set_own_key(me, fpr)\n" "\n"