summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Noonan <steven@uplinklabs.net>2016-09-17 10:54:17 (GMT)
committerAndrius Štikonas <andrius@stikonas.eu>2016-10-01 11:15:31 (GMT)
commit2c59f95f1d1ed64d61ad7c8572444d04ea875944 (patch)
tree6c7ba787fb6c6eb7e9e5c8a5b95fb58926cef837
parent3b49d20f3ce3a82131044618ca9b7ccd8ce1cbf2 (diff)
implement recognition of new ECC key types
-rw-r--r--core/convert.cpp32
-rw-r--r--core/kgpgkey.h4
2 files changed, 35 insertions, 1 deletions
diff --git a/core/convert.cpp b/core/convert.cpp
index ebf2f46..8a1e545 100644
--- a/core/convert.cpp
+++ b/core/convert.cpp
@@ -27,6 +27,19 @@
#include "kgpgsettings.h"
+/* Conversion from OpenPGP algorithm number to GPGME algorithm numbers. */
+static int _gpgme_map_pk_algo (int algo)
+{
+ switch (algo)
+ {
+ case 18: algo = GPGME_PK_ECDH; break;
+ case 19: algo = GPGME_PK_ECDSA; break;
+ case 22: algo = GPGME_PK_EDDSA; break;
+ default: break;
+ }
+ return algo;
+}
+
namespace KgpgCore
{
@@ -46,6 +59,14 @@ QString toString(const KgpgKeyAlgo algorithm)
return i18nc("Encryption algorithm", "DSA & ElGamal");
case ALGO_RSA_RSA:
return i18nc("Encryption algorithm RSA, Signing algorithm RSA", "RSA & RSA");
+ case ALGO_ECC:
+ return i18nc("Encryption algorithm", "ECC");
+ case ALGO_ECDSA:
+ return i18nc("Signing algorithm", "ECDSA");
+ case ALGO_ECDH:
+ return i18nc("Encryption algorithm", "ECDH");
+ case ALGO_EDDSA:
+ return i18nc("Signing algorithm", "EdDSA");
case ALGO_UNKNOWN:
default:
return i18nc("Unknown algorithm", "Unknown");
@@ -116,7 +137,8 @@ QString toString(const KgpgCore::KgpgSubKeyType type)
KgpgKeyAlgo toAlgo(const uint v)
{
- switch (v) {
+ uint gpgme_algo = _gpgme_map_pk_algo(v);
+ switch (gpgme_algo) {
case GPGME_PK_RSA:
return ALGO_RSA;
case GPGME_PK_ELG_E:
@@ -124,6 +146,14 @@ KgpgKeyAlgo toAlgo(const uint v)
return ALGO_ELGAMAL;
case GPGME_PK_DSA:
return ALGO_DSA;
+ case GPGME_PK_ECC:
+ return ALGO_ECC;
+ case GPGME_PK_ECDSA:
+ return ALGO_ECDSA;
+ case GPGME_PK_ECDH:
+ return ALGO_ECDH;
+ case GPGME_PK_EDDSA:
+ return ALGO_EDDSA;
default:
return ALGO_UNKNOWN;
}
diff --git a/core/kgpgkey.h b/core/kgpgkey.h
index 0ad0488..7a4f165 100644
--- a/core/kgpgkey.h
+++ b/core/kgpgkey.h
@@ -39,6 +39,10 @@ enum KgpgKeyAlgoFlag
ALGO_DSA = 2,
ALGO_ELGAMAL = 4,
ALGO_DSA_ELGAMAL = ALGO_DSA | ALGO_ELGAMAL,
+ ALGO_ECC = 8,
+ ALGO_ECDSA = 16,
+ ALGO_ECDH = 32,
+ ALGO_EDDSA = 64,
ALGO_RSA_RSA = 0x10001
};
Q_DECLARE_FLAGS(KgpgKeyAlgo, KgpgKeyAlgoFlag)