diff options
author | Maximilian Krambach <[email protected]> | 2018-04-20 13:23:57 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-04-20 13:23:57 +0000 |
commit | 94f21d9f6bc1cf94e068e26eae53e593189dcec6 (patch) | |
tree | b176a836c504cbd71a5ca17ca025b23285d1505a /src/conversion.c | |
parent | js: Initial commit for JavaScript Native Messaging API (diff) | |
parent | core: Do not modify args for ignored failures (diff) | |
download | gpgme-94f21d9f6bc1cf94e068e26eae53e593189dcec6.tar.gz gpgme-94f21d9f6bc1cf94e068e26eae53e593189dcec6.zip |
Merge branch 'master' into javascript-binding
Diffstat (limited to 'src/conversion.c')
-rw-r--r-- | src/conversion.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/conversion.c b/src/conversion.c index 5b84f672..4bfd3d3e 100644 --- a/src/conversion.c +++ b/src/conversion.c @@ -575,3 +575,49 @@ _gpgme_map_pk_algo (int algo, gpgme_protocol_t protocol) return algo; } + + +/* Return a string with a cipher algorithm. */ +const char * +_gpgme_cipher_algo_name (int algo, gpgme_protocol_t protocol) +{ + if (protocol == GPGME_PROTOCOL_OPENPGP) + { + /* The algo is given according to OpenPGP specs. */ + switch (algo) + { + case 1: return "IDEA"; + case 2: return "3DES"; + case 3: return "CAST5"; + case 4: return "BLOWFISH"; + case 7: return "AES"; + case 8: return "AES192"; + case 9: return "AES256"; + case 10: return "TWOFISH"; + case 11: return "CAMELLIA128"; + case 12: return "CAMELLIA192"; + case 13: return "CAMELLIA256"; + } + } + + return "Unknown"; +} + + +/* Return a string with the cipher mode. */ +const char * +_gpgme_cipher_mode_name (int algo, gpgme_protocol_t protocol) +{ + if (protocol == GPGME_PROTOCOL_OPENPGP) + { + /* The algo is given according to OpenPGP specs. */ + switch (algo) + { + case 0: return "CFB"; + case 1: return "EAX"; + case 2: return "OCB"; + } + } + + return "Unknown"; +} |