Browse Source

Wrap passphrase support methods

COM-121
Thomas 2 years ago
parent
commit
3fdd749dc2
3 changed files with 42 additions and 0 deletions
  1. +34
    -0
      CpEpEngine.cpp
  2. +2
    -0
      CpEpEngine.h
  3. +6
    -0
      pEpCOMServerAdapter.idl

+ 34
- 0
CpEpEngine.cpp View File

@ -2070,3 +2070,37 @@ STDMETHODIMP CpEpEngine::ShutDownSync()
return S_OK;
}
STDMETHODIMP CpEpEngine::ConfigPassphrase(BSTR passphrase)
{
string _passphrase = "";
if (passphrase)
_passphrase = utf8_string(passphrase);
PEP_STATUS status = ::config_passphrase(session(), _passphrase.c_str());
if (status == PEP_STATUS_OK)
return S_OK;
else if (status == PEP_OUT_OF_MEMORY)
return E_OUTOFMEMORY;
else
return FAIL(L"ConfigPassphrase", status);
}
STDMETHODIMP CpEpEngine::ConfigPassphraseForNewKeys(VARIANT_BOOL enable, BSTR passphrase)
{
string _passphrase = "";
if (passphrase)
_passphrase = utf8_string(passphrase);
PEP_STATUS status = ::config_passphrase_for_new_keys(session(), enable != 0, _passphrase.c_str());
if (status == PEP_STATUS_OK)
return S_OK;
else if (status == PEP_OUT_OF_MEMORY)
return E_OUTOFMEMORY;
else
return FAIL(L"ConfigPassphraseForNewKeys", status);
}

+ 2
- 0
CpEpEngine.h View File

@ -274,6 +274,8 @@ public:
STDMETHOD(OpenPGPListKeyinfo)(BSTR search_pattern, LPSAFEARRAY* keyinfo_list);
STDMETHOD(SetOwnKey)(pEpIdentity * ident, BSTR fpr, struct pEpIdentity *result);
STDMETHOD(TrustOwnKey)(pEpIdentity * ident);
STDMETHOD(ConfigPassphrase)(BSTR passphrase);
STDMETHOD(ConfigPassphraseForNewKeys)(VARIANT_BOOL enable, BSTR passphrase);
// Trigger an immediate update
STDMETHOD(UpdateNow)(BSTR productCode, VARIANT_BOOL *didUpdate);


+ 6
- 0
pEpCOMServerAdapter.idl View File

@ -528,6 +528,12 @@ interface IpEpEngine : IUnknown {
// Encodes a MIME message
[id(63)] HRESULT MIMEEncodeMessage([in] struct TextMessage *msg, [in] VARIANT_BOOL omitFields, [out, retval] BSTR *mimeText);
// Configures a key passphrase for the current session
[id(64)] HRESULT ConfigPassphrase([in] BSTR passphrase);
// Passphrase enablement for newly-generated secret keys
[id(65)] HRESULT ConfigPassphraseForNewKeys([in] VARIANT_BOOL enable, [in] BSTR passphrase);
};
[


Loading…
Cancel
Save