diff options
author | Neal H. Walfield <neal@pep.foundation> | 2018-11-22 10:12:43 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2018-11-22 10:20:48 +0100 |
commit | 6aefa29ec3d83b07a5882c85f47f386b95f91579 (patch) | |
tree | 9cd0b9207e05ddfba5757eca97aa3fabbe5746de /ffi | |
parent | bbcd118f255cf5cb7d49a89e332d20592792605e (diff) |
ffi: Wrap Key::creation_time.
Diffstat (limited to 'ffi')
-rw-r--r-- | ffi/include/sequoia/openpgp.h | 5 | ||||
-rw-r--r-- | ffi/src/openpgp.rs | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ffi/include/sequoia/openpgp.h b/ffi/include/sequoia/openpgp.h index f18bbeb8..af136b53 100644 --- a/ffi/include/sequoia/openpgp.h +++ b/ffi/include/sequoia/openpgp.h @@ -761,6 +761,11 @@ sq_status_t sq_skesk_decrypt (sq_context_t ctx, sq_skesk_t skesk, uint8_t *algo, /* XXX */ uint8_t *key, size_t *key_len); +/*/ +/// Returns the key's creation time. +/*/ +uint32_t sq_p_key_creation_time (sq_p_key_t p); + /* openpgp::parse. */ /*/ diff --git a/ffi/src/openpgp.rs b/ffi/src/openpgp.rs index f7cc1b16..35f734b4 100644 --- a/ffi/src/openpgp.rs +++ b/ffi/src/openpgp.rs @@ -1160,6 +1160,17 @@ pub extern "system" fn sq_p_key_keyid(key: Option<&Packet>) } } +/// Returns the key's creation time. +#[no_mangle] +pub extern "system" fn sq_p_key_creation_time(key: Option<&packet::Key>) + -> u32 +{ + let key = key.expect("Key is NULL"); + let ct = key.creation_time(); + + ct.to_timespec().sec as u32 +} + /// Returns the value of the User ID Packet. /// /// The returned pointer is valid until `uid` is deallocated. If |