rnpgp / rnp

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

Duplicate and inconsistent string maps between FFI and JSON dumping #852

Closed dewyatt closed 4 years ago

dewyatt commented 5 years ago

Description

We have defined multiple mappings from ints to strings for various types and this may present an inconsistent interface to the user.

For example: https://github.com/riboseinc/rnp/blob/d562b479b12d930111025500d8c63ac442c1c4f3/src/librepgp/stream-dump.cpp#L154 https://github.com/riboseinc/rnp/blob/d562b479b12d930111025500d8c63ac442c1c4f3/src/lib/rnp.cpp#L309

There are differences in capitalization and in hyphenation. In the FFI this means that your inputs (say, "AES256") may not match the output from packet parsing to JSON ("AES-256"). This is confusing and seems like duplication we ought to be able to eliminate.

ni4 commented 5 years ago

@dewyatt Agree. Probably, we should also add some defines to the FFI like #define PGP_ALGORITHM_AES_128 "AES128"