diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-01-04 13:56:29 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-01-04 13:56:29 +0000 |
commit | 3f5ca5e8b061e34b713b1a2022e46c37529751db (patch) | |
tree | bcb41fb48640e2360290177ade281a9884d5e846 /src/libcryptobox | |
parent | 3099e3427614dd06081a5395b2b3edb632e2ba4a (diff) | |
download | rspamd-3f5ca5e8b061e34b713b1a2022e46c37529751db.tar.gz rspamd-3f5ca5e8b061e34b713b1a2022e46c37529751db.zip |
[Minor] Allow to flatten keypair output
Diffstat (limited to 'src/libcryptobox')
-rw-r--r-- | src/libcryptobox/keypair.c | 13 | ||||
-rw-r--r-- | src/libcryptobox/keypair.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/libcryptobox/keypair.c b/src/libcryptobox/keypair.c index b97cd699e..2ef996527 100644 --- a/src/libcryptobox/keypair.c +++ b/src/libcryptobox/keypair.c @@ -805,9 +805,16 @@ rspamd_keypair_to_ucl (struct rspamd_cryptobox_keypair *kp, encoding = "base32"; } - ucl_out = ucl_object_typed_new (UCL_OBJECT); - elt = ucl_object_typed_new (UCL_OBJECT); - ucl_object_insert_key (ucl_out, elt, "keypair", 0, false); + if (flags & RSPAMD_KEYPAIR_DUMP_FLATTENED) { + ucl_out = ucl_object_typed_new (UCL_OBJECT); + elt = ucl_out; + } + else { + ucl_out = ucl_object_typed_new (UCL_OBJECT); + elt = ucl_object_typed_new (UCL_OBJECT); + ucl_object_insert_key (ucl_out, elt, "keypair", 0, false); + } + /* pubkey part */ keypair_out = rspamd_keypair_print (kp, diff --git a/src/libcryptobox/keypair.h b/src/libcryptobox/keypair.h index ed247e8ca..18a87d7f5 100644 --- a/src/libcryptobox/keypair.h +++ b/src/libcryptobox/keypair.h @@ -249,6 +249,7 @@ enum rspamd_keypair_dump_flags { RSPAMD_KEYPAIR_DUMP_DEFAULT = 0, RSPAMD_KEYPAIR_DUMP_HEX = 1u << 0u, RSPAMD_KEYPAIR_DUMP_NO_SECRET = 1u << 1u, + RSPAMD_KEYPAIR_DUMP_FLATTENED = 1u << 2u, }; /** |