diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-03-25 15:22:56 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-03-25 16:54:11 +0100 |
commit | f572bc851d520a56eebb0a6cea38144051168a8a (patch) | |
tree | fd592f520343bed4a572fe97ee3cf5d1620ea006 /openpgp-ffi/include/sequoia/openpgp | |
parent | 9e9d3f773d85049daece18cb5488451b76c94d2e (diff) |
openpgp-ffi: Wrap crypto::SessionKey and crypto::Password.
Diffstat (limited to 'openpgp-ffi/include/sequoia/openpgp')
-rw-r--r-- | openpgp-ffi/include/sequoia/openpgp/crypto.h | 58 | ||||
-rw-r--r-- | openpgp-ffi/include/sequoia/openpgp/types.h | 14 |
2 files changed, 72 insertions, 0 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp/crypto.h b/openpgp-ffi/include/sequoia/openpgp/crypto.h index 6db828ef..44e035dc 100644 --- a/openpgp-ffi/include/sequoia/openpgp/crypto.h +++ b/openpgp-ffi/include/sequoia/openpgp/crypto.h @@ -3,6 +3,64 @@ #include <sequoia/openpgp/types.h> +/*/ +/// Creates a new session key. +/*/ +pgp_session_key_t pgp_session_key_new (size_t size); + +/*/ +/// Creates a new session key from a buffer. +/*/ +pgp_session_key_t pgp_session_key_from_bytes (uint8_t *buf, size_t size); + +/*/ +/// Frees a session key. +/*/ +void pgp_session_key_free (pgp_session_key_t); + +/*/ +/// Returns a human readable description of this object suitable for +/// debugging. +/*/ +char *pgp_session_key_debug (const pgp_session_key_t fp); + +/*/ +/// Clones the session key. +/*/ +pgp_session_key_t pgp_session_key_clone (pgp_session_key_t session_key); + +/*/ +/// Compares session keys. +/*/ +int pgp_session_key_equal (const pgp_session_key_t a, + const pgp_session_key_t b); + +/*/ +/// Creates a new password from a buffer. +/*/ +pgp_password_t pgp_password_from_bytes (uint8_t *buf, size_t size); + +/*/ +/// Frees a password. +/*/ +void pgp_password_free (pgp_password_t); + +/*/ +/// Returns a human readable description of this object suitable for +/// debugging. +/*/ +char *pgp_password_debug (const pgp_password_t fp); + +/*/ +/// Clones the password. +/*/ +pgp_password_t pgp_password_clone (pgp_password_t password); + +/*/ +/// Compares passwords. +/*/ +int pgp_password_equal (const pgp_password_t a, const pgp_password_t b); + typedef struct pgp_mpis_secret_key *pgp_mpis_secret_key_t; /*/ diff --git a/openpgp-ffi/include/sequoia/openpgp/types.h b/openpgp-ffi/include/sequoia/openpgp/types.h index 375832f9..2ba7fcdc 100644 --- a/openpgp-ffi/include/sequoia/openpgp/types.h +++ b/openpgp-ffi/include/sequoia/openpgp/types.h @@ -2,6 +2,20 @@ #define SEQUOIA_OPENPGP_TYPES_H /*/ +/// Holds a session key. +/// +/// The session key is cleared when dropped. +/*/ +typedef struct pgp_session_key *pgp_session_key_t; + +/*/ +/// Holds a password. +/// +/// The password is cleared when dropped. +/*/ +typedef struct pgp_password *pgp_password_t; + +/*/ /// Holds a fingerprint. /*/ typedef struct pgp_fingerprint *pgp_fingerprint_t; |