Mercurial > dovecot > core-2.3
changeset 26346:1cabad843182
lib-dcrypt: Add dcrypt_key_get_curve_public
Returns name of the curve of public key
author | Aki Tuomi <aki.tuomi@open-xchange.com> |
---|---|
date | Wed, 21 Aug 2019 13:25:33 +0300 |
parents | f9737783d0f1 |
children | 2b9d42ee2903 |
files | src/lib-dcrypt/dcrypt-private.h src/lib-dcrypt/dcrypt.c src/lib-dcrypt/dcrypt.h |
diffstat | 3 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-dcrypt/dcrypt-private.h Mon Aug 19 22:40:02 2019 +0300 +++ b/src/lib-dcrypt/dcrypt-private.h Wed Aug 21 13:25:33 2019 +0300 @@ -169,6 +169,8 @@ enum dcrypt_key_type key_type, const ARRAY_TYPE(dcrypt_raw_key) *keys, const char **error_r); + bool (*key_get_curve_public)(struct dcrypt_public_key *key, + const char **curve_r, const char **error_r); }; void dcrypt_set_vfs(struct dcrypt_vfs *vfs);
--- a/src/lib-dcrypt/dcrypt.c Mon Aug 19 22:40:02 2019 +0300 +++ b/src/lib-dcrypt/dcrypt.c Wed Aug 21 13:25:33 2019 +0300 @@ -490,3 +490,14 @@ return dcrypt_vfs->key_load_public_raw(key_r, key_type, keys, error_r); } + +bool dcrypt_key_get_curve_public(struct dcrypt_public_key *key, + const char **curve_r, const char **error_r) +{ + i_assert(dcrypt_vfs != NULL); + if (dcrypt_vfs->key_get_curve_public == NULL) { + *error_r = "Not implemented"; + return FALSE; + } + return dcrypt_vfs->key_get_curve_public(key, curve_r, error_r); +}
--- a/src/lib-dcrypt/dcrypt.h Mon Aug 19 22:40:02 2019 +0300 +++ b/src/lib-dcrypt/dcrypt.h Wed Aug 21 13:25:33 2019 +0300 @@ -304,6 +304,10 @@ const ARRAY_TYPE(dcrypt_raw_key) *keys, const char **error_r); +/* for ECC only - return textual name or OID of used curve */ +bool dcrypt_key_get_curve_public(struct dcrypt_public_key *key, + const char **curve_r, const char **error_r); + bool dcrypt_key_string_get_info(const char *key_data, enum dcrypt_key_format *format_r, enum dcrypt_key_version *version_r,