From 87fac9911241310a4b601e126fa2e26b10bd370f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 31 Aug 2010 15:58:39 +0000 Subject: Import OpenPGP keys into the agent. --- g10/misc.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'g10/misc.c') 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 -- cgit v1.2.3