Files
k7/Tools.cpp
SET 7f8af95d3a Certify key.
In-place editing with a popup if user is allowed in app config file.
User must of course manage at least a private key. User identities of
target key may be selectively chosen. Optionally, certification may be
exportable and non-revocable.
2020-11-03 11:06:25 +01:00

36 lines
722 B
C++

/*
* File: Tools.cpp
* Author: SET - nmset@yandex.com
* License : GPL v2
* Copyright SET - © 2019
*
* Created on November 1, 2020, 8:31 PM
*/
#include "Tools.h"
#include <sstream>
#include <iostream>
using namespace std;
Tools::Tools() {
}
Tools::~Tools() {
}
bool Tools::ConfigKeyIdMatchesKey(const GpgME::Key& k, const WString& configKeyId)
{
// We want key identifier in config file to be real and complete.
return (configKeyId == WString(k.shortKeyID())
|| configKeyId == WString(k.keyID())
|| configKeyId == WString(k.primaryFingerprint()));
}
int Tools::ToInt(const string& s) {
istringstream buffer(s.c_str());
int num;
buffer >> num;
return num;
}