Browse Source

Wrap ExportSecretKey method

COM-121
Thomas 1 year ago
parent
commit
ef757aeb7f
3 changed files with 31 additions and 0 deletions
  1. +27
    -0
      CpEpEngine.cpp
  2. +1
    -0
      CpEpEngine.h
  3. +3
    -0
      pEpCOMServerAdapter.idl

+ 27
- 0
CpEpEngine.cpp View File

@ -137,6 +137,33 @@ STDMETHODIMP CpEpEngine::ExportKey(BSTR fpr, BSTR * keyData)
return S_OK;
}
STDMETHODIMP CpEpEngine::ExportSecretKey(BSTR fpr, BSTR* keyData)
{
assert(fpr);
assert(keyData);
if (!(fpr && keyData))
return E_INVALIDARG;
string _fpr = utf8_string(fpr);
char* _key_data = NULL;
size_t _size = 0;
PEP_STATUS status = passphrase_cache.api(::export_secret_key, session(), _fpr.c_str(), &_key_data, &_size);
assert(status != ::PEP_OUT_OF_MEMORY);
if (status == ::PEP_OUT_OF_MEMORY)
return E_OUTOFMEMORY;
if (status != PEP_STATUS_OK)
return FAIL(L"export_secret_key", status);
_bstr_t b_key_data(utf16_string(_key_data).c_str());
pEp_free(_key_data);
*keyData = b_key_data.Detach();
return S_OK;
}
STDMETHODIMP CpEpEngine::LeaveDeviceGroup()
{
PEP_STATUS status = passphrase_cache.api(::leave_device_group, session());


+ 1
- 0
CpEpEngine.h View File

@ -176,6 +176,7 @@ public:
// basic API
STDMETHOD(ExportKey)(BSTR fpr, BSTR * keyData);
STDMETHOD(ExportSecretKey)(BSTR fpr, BSTR * keyData);
STDMETHOD(Log)(BSTR title, BSTR entity, BSTR description, BSTR comment);
STDMETHOD(Trustwords)(BSTR fpr, BSTR lang, LONG max_words, BSTR * words);
STDMETHOD(GetTrustwords)(struct pEpIdentity *id1, struct pEpIdentity *id2, BSTR lang, VARIANT_BOOL full, BSTR *words);


+ 3
- 0
pEpCOMServerAdapter.idl View File

@ -544,6 +544,9 @@ interface IpEpEngine : IUnknown {
// Shows a notification in the notification tray
[id(66)] HRESULT ShowNotification([in] BSTR title, [in] BSTR message);
// Exports a private key
[id(67)] HRESULT ExportSecretKey([in] BSTR fpr, [out, retval] BSTR* keyData);
};
[


Loading…
Cancel
Save