Allow to change key expiry date.
Select new date in a popup. Controlled by a specific configuration flag.
This commit is contained in:
@@ -19,7 +19,7 @@ GpgMEWorker::GpgMEWorker()
|
||||
m_ctx = Context::createForProtocol(Protocol::OpenPGP);
|
||||
// Allow to list key certifications
|
||||
m_ctx->setKeyListMode(GpgME::KeyListMode::Signatures
|
||||
| GpgME::KeyListMode::Validate);
|
||||
| GpgME::KeyListMode::Validate);
|
||||
m_ppp = NULL;
|
||||
}
|
||||
|
||||
@@ -110,14 +110,14 @@ const Error GpgMEWorker::CertifyKey(const char* fprSigningKey,
|
||||
Key keyToSign = FindKey(fprKeyToSign, e, false);
|
||||
if (e.code() != 0)
|
||||
return e;
|
||||
|
||||
|
||||
// GPG engine will fetch for passphrase in the custom provider.
|
||||
m_ctx->setPinentryMode(Context::PinentryMode::PinentryLoopback);
|
||||
if (m_ppp == NULL)
|
||||
m_ppp = new LoopbackPassphraseProvider();
|
||||
m_ppp->SetPassphrase(passphrase);
|
||||
m_ctx->setPassphraseProvider(m_ppp);
|
||||
|
||||
|
||||
SetSignKeyEditInteractor * interactor = new SetSignKeyEditInteractor();
|
||||
interactor->setKey(keyToSign);
|
||||
interactor->setUserIDsToSign(userIDsToSign);
|
||||
@@ -133,3 +133,30 @@ const Error GpgMEWorker::CertifyKey(const char* fprSigningKey,
|
||||
*/
|
||||
return e;
|
||||
}
|
||||
|
||||
const Error GpgMEWorker::SetExpiryTime(const char * keyFpr,
|
||||
const string& passphrase,
|
||||
const string& timeString)
|
||||
{
|
||||
Error e;
|
||||
Key k = FindKey(keyFpr, e, true);
|
||||
if (e.code() != 0)
|
||||
return e;
|
||||
e = m_ctx->addSigningKey(k); // +++
|
||||
if (e.code() != 0)
|
||||
return e;
|
||||
|
||||
m_ctx->setPinentryMode(Context::PinentryMode::PinentryLoopback);
|
||||
if (m_ppp == NULL)
|
||||
m_ppp = new LoopbackPassphraseProvider();
|
||||
m_ppp->SetPassphrase(passphrase);
|
||||
m_ctx->setPassphraseProvider(m_ppp);
|
||||
|
||||
SetExpiryTimeEditInteractor * interactor
|
||||
= new SetExpiryTimeEditInteractor(timeString);
|
||||
GpgME::Data d;
|
||||
e = m_ctx->edit(k, std::unique_ptr<SetExpiryTimeEditInteractor> (interactor), d);
|
||||
m_ctx->clearSigningKeys();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user