aboutsummaryrefslogtreecommitdiffstats
path: root/src/m_key_server_sync/PKSInterface.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2026-08-03 15:35:05 +0200
committersaturneric <[email protected]>2026-08-03 15:35:05 +0200
commitc48e1b5d36a90eba90bdc69aa2068e594b1a41b9 (patch)
tree9851ec5ae3a86ab7fb6074fe902e5c0057bb91d8 /src/m_key_server_sync/PKSInterface.cpp
parenti18n(m_key_server_sync): add translations (diff)
downloadmodules-c48e1b5d36a90eba90bdc69aa2068e594b1a41b9.tar.gz
modules-c48e1b5d36a90eba90bdc69aa2068e594b1a41b9.zip
feat(key_server_sync): prefer VKS for sync and support v6 keys
- add Route type and SyncRoute() to send publish/refresh to default - prefer VKS where available, fall back to HKP; expose protocol in replies - implement FetchKey(...) to normalize VKS and HKP retrieval paths - add ConfirmHkpPublish() and confirm when publishing over HKP - update Upload/Update flows and event handlers to use SyncRoute/Route - use PKSInterface for HKP uploads and return protocol in events - extend PKS algorithm map with RFC9580 v6 and post-quantum IDs - hide fixed-param algos' size and normalize HKP handle 0x prefix - validate 16/40/64-hex fingerprints and support v6 (64-hex) inputs - shorten handles for display and store full handle in row role - update settings UI text and warn when choosing non-VKS default - bump module version to 1.3.2
Diffstat (limited to 'src/m_key_server_sync/PKSInterface.cpp')
-rw-r--r--src/m_key_server_sync/PKSInterface.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/m_key_server_sync/PKSInterface.cpp b/src/m_key_server_sync/PKSInterface.cpp
index ed0c9c7..066f86b 100644
--- a/src/m_key_server_sync/PKSInterface.cpp
+++ b/src/m_key_server_sync/PKSInterface.cpp
@@ -35,6 +35,9 @@
namespace {
auto GetAlgorithmName(const QString& algo_id) -> QString {
+ // Code points 25-28 arrived with RFC 9580 and are what v6 keys use; 35-41 are
+ // the post-quantum algorithms this application can already generate. Without
+ // them every modern key found on a keyserver reads as "Unknown (27)".
static const QMap<QString, QString> algo_map = {
{"1", "RSA"},
{"2", "RSA (Encrypt-Only)"},
@@ -46,13 +49,31 @@ auto GetAlgorithmName(const QString& algo_id) -> QString {
{"20", "ElGamal"},
{"22", "EdDSA"},
{"23", "AEDH"},
- {"24", "AEDSA"}};
+ {"24", "AEDSA"},
+ {"25", "X25519"},
+ {"26", "X448"},
+ {"27", "Ed25519"},
+ {"28", "Ed448"},
+ {"35", "ML-KEM-768 + X25519"},
+ {"36", "ML-KEM-1024 + X448"},
+ {"37", "ML-DSA-65 + Ed25519"},
+ {"38", "ML-DSA-87 + Ed448"},
+ {"39", "SLH-DSA-SHAKE-128s"},
+ {"40", "SLH-DSA-SHAKE-128f"},
+ {"41", "SLH-DSA-SHAKE-256s"}};
return algo_map.value(algo_id, QString("Unknown (%1)").arg(algo_id));
}
auto GetKeySizeDescription(const QString& algo_id, const QString& key_size)
-> QString {
+ // These algorithms carry their parameters in the algorithm ID itself, so a
+ // keyserver has no meaningful length to report — usually 0. Printing
+ // "0 bits" would be worse than saying nothing.
+ static const QSet<QString> kFixedParamAlgos = {
+ "25", "26", "27", "28", "35", "36", "37", "38", "39", "40", "41"};
+ if (kFixedParamAlgos.contains(algo_id)) return "-";
+
if (key_size.isEmpty()) return "Unknown";
// For ECC algorithms, show curve instead of size
@@ -208,8 +229,13 @@ void PKSInterface::dealing_reply_from_server() {
void PKSInterface::LookupKeyById(const QString& url, const QString& keyid) {
FLOG_DEBUG("looking up keyid %1 from keyserver %2", keyid, url);
+ // The handle may be a key ID or a full v4/v6 fingerprint; either way HKP
+ // wants exactly one 0x prefix.
+ auto handle = keyid.trimmed();
+ if (handle.startsWith("0x", Qt::CaseInsensitive)) handle = handle.mid(2);
+
QUrl url_from_remote =
- url + "/pks/lookup?search=0x" + keyid + "&op=get&options=mr";
+ url + "/pks/lookup?search=0x" + handle + "&op=get&options=mr";
auto request = QNetworkRequest(url_from_remote);
request.setHeader(QNetworkRequest::UserAgentHeader, GFHttpRequestUserAgent());