Remove unused function.

We don't need CheckPassphrase() anymore.
This commit is contained in:
SET
2020-11-25 21:34:18 +01:00
parent fe7d92caef
commit 4d5d426f30
2 changed files with 0 additions and 41 deletions

View File

@@ -347,32 +347,6 @@ const Error GpgMEWorker::CreateSubKey(GpgME::Key& k,
return e; return e;
} }
const Error GpgMEWorker::CheckPassphrase(const char* fpr,
const string& passphrase)
{
Error e;
Context * ctx = Context::createForProtocol(Protocol::OpenPGP);
LoopbackPassphraseProvider * ppp = new LoopbackPassphraseProvider(passphrase);
ctx->setPinentryMode(Context::PinentryMode::PinentryLoopback);
ctx->setPassphraseProvider(ppp);
Key k = FindKey(fpr, e, true);
if (e.code() != 0)
return e;
e = ctx->addSigningKey(k);
if (e.code() != 0)
return e;
Data plain("dummy");
Data signature;
SigningResult result = ctx->sign(plain, signature, SignatureMode::Detached);
e = result.error();
delete ppp;
delete ctx;
return e;
}
const Error GpgMEWorker::ExportPrivateKey(const char * pattern, string& buffer, const Error GpgMEWorker::ExportPrivateKey(const char * pattern, string& buffer,
const string& passphrase) const string& passphrase)
{ {

View File

@@ -181,21 +181,6 @@ public:
const char * algo, const char * algo,
const string& passphrase, const string& passphrase,
ulong expires = 63072000); ulong expires = 63072000);
/**
* Checks that passphrase can unlock secret key with fingerprint fpr.
* \n This is a workaround when exporting secret keys.
* \n To date, with GnuPG 2.2.23 and GpgME 1.1.15, a secret key can be
* exported when the right passphrase is provided. With a bad passphrase,
* application crashes.
* \n See https://dev.gnupg.org/T5151
* \n Application may validate a passphrase before invoking engine.
* \n Until it is hopefully fixed in upstream and available in mainstream.
* @param fpr
* @param passphrase
* @return
*/
const Error CheckPassphrase(const char * fpr,
const string& passphrase);
/** /**
* Export a secret key. * Export a secret key.
* @param pattern : a key fingerprint * @param pattern : a key fingerprint