aboutsummaryrefslogtreecommitdiffstats
path: root/g10/misc.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2010-08-31 15:58:39 +0000
committerWerner Koch <[email protected]>2010-08-31 15:58:39 +0000
commit87fac9911241310a4b601e126fa2e26b10bd370f (patch)
tree49e09cc881b44a1dba0e9474040cda1d5f9ce581 /g10/misc.c
parentFix for W32. (diff)
downloadgnupg-87fac9911241310a4b601e126fa2e26b10bd370f.tar.gz
gnupg-87fac9911241310a4b601e126fa2e26b10bd370f.zip
Import OpenPGP keys into the agent.
Diffstat (limited to 'g10/misc.c')
-rw-r--r--g10/misc.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/g10/misc.c b/g10/misc.c
index eb3eceee9..91d1c310a 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -478,6 +478,28 @@ openpgp_pk_algo_usage ( int algo )
return use;
}
+/* Map the OpenPGP pubkey algorithm whose ID is contained in ALGO to a
+ string representation of the algorithm name. For unknown algorithm
+ IDs this function returns "?". */
+const char *
+openpgp_pk_algo_name (int algo)
+{
+ switch (algo)
+ {
+ case PUBKEY_ALGO_RSA:
+ case PUBKEY_ALGO_RSA_E:
+ case PUBKEY_ALGO_RSA_S: return "rsa";
+
+ case PUBKEY_ALGO_ELGAMAL:
+ case PUBKEY_ALGO_ELGAMAL_E: return "elg";
+
+ case PUBKEY_ALGO_DSA: return "dsa";
+
+ default: return "?";
+ }
+}
+
+
int
openpgp_md_test_algo( int algo )
{
@@ -491,6 +513,19 @@ openpgp_md_test_algo( int algo )
return gcry_md_test_algo (algo);
}
+
+/* Map the OpenPGP digest algorithm whose ID is contained in ALGO to a
+ string representation of the algorithm name. For unknown algorithm
+ IDs this function returns "?". */
+const char *
+openpgp_md_algo_name (int algo)
+{
+ if (algo < 0 || algo > 110)
+ return "?";
+ return gcry_md_algo_name (algo);
+}
+
+
#ifdef USE_IDEA
/* Special warning for the IDEA cipher */
void