rnpgp / rnp

RNP: high performance C++ OpenPGP library used by Mozilla Thunderbird
https://www.rnpgp.org
Other
199 stars 55 forks source link

CLI: display list of supported algorithms and backend in --version #1594

Closed ni4 closed 2 years ago

ni4 commented 3 years ago

Description

Currently it just displays version, while it would be also usable to have more detailed information on enabled algorithms and used backend.

antonsviridenko commented 3 years ago

Just a side note, I see that version information is printed to stderr, isn't stdout more suitable for this info?

ni4 commented 3 years ago

@antonsviridenko yeah, stdout is more suitable for this, thanks.

antonsviridenko commented 3 years ago

Also version printing code is duplicated in rnp and rnpkeys, function print_praise() is identical in both programs but exists in two instances. Could be unified.

ni4 commented 3 years ago

Also version printing code is duplicated in rnp and rnpkeys, function print_praise() is identical in both programs but exists in two instances. Could be unified.

Definitely, it may be moved to fficli.h/cpp.

antonsviridenko commented 3 years ago

@ni4 which algorithms exactly should be listed in output?

ni4 commented 3 years ago

@ni4 which algorithms exactly should be listed in output?

Please see gpg --version for reference. We have public key, symmetric, hash and AEAD algorithms at the moment. Also additionally we may list supported curves.

antonsviridenko commented 3 years ago

@ni4 I thought about iterating alogithm arays in https://github.com/rnpgp/rnp/blob/master/src/lib/rnp.cpp#L156 like pubkey_alg_map[] and printing out each item name, but looks like they are not enclosed in macros like #if defined(CRYPTO_BACKEND_XXX) so it may print algorithms that actually are not supported by current backend.

ni4 commented 3 years ago

@antonsviridenko Those are internals, and should not be used in the CLI. You should use FFI function rnp_supported_features() which takes care of ifdefs and so on. If it doesn't fit please feel free to let me know.

antonsviridenko commented 3 years ago

yes, right, I forgot about rnp_supported_features()