summaryrefslogtreecommitdiffstats
path: root/ffi/src
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-11-28 15:27:33 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-11-28 16:26:43 +0100
commitbbbc6da375d6584c7b2bcc74e838fff943f489d4 (patch)
tree0a965698c96dbc0fc8541c6adc2224935b68bc07 /ffi/src
parentf53c77752ff04c3713c175a76a06723042e681ae (diff)
Call TPKs Certificates, update identifiers, documentation.
- Fixes #387.
Diffstat (limited to 'ffi/src')
-rw-r--r--ffi/src/error.rs8
-rw-r--r--ffi/src/lib.rs10
-rw-r--r--ffi/src/net.rs16
-rw-r--r--ffi/src/store.rs80
4 files changed, 57 insertions, 57 deletions
diff --git a/ffi/src/error.rs b/ffi/src/error.rs
index f68f4c3d..884e28d1 100644
--- a/ffi/src/error.rs
+++ b/ffi/src/error.rs
@@ -64,12 +64,12 @@ impl<'a> FromSequoiaError<'a> for Status {
Status::ManipulatedMessage,
&openpgp::Error::MalformedMessage(_) =>
Status::MalformedMessage,
- &openpgp::Error::MalformedTPK(_) =>
- Status::MalformedTPK,
+ &openpgp::Error::MalformedCert(_) =>
+ Status::MalformedCert,
&openpgp::Error::IndexOutOfRange =>
Status::IndexOutOfRange,
- &openpgp::Error::UnsupportedTPK(_) =>
- Status::UnsupportedTPK,
+ &openpgp::Error::UnsupportedCert(_) =>
+ Status::UnsupportedCert,
}
}
diff --git a/ffi/src/lib.rs b/ffi/src/lib.rs
index 92cfab0d..0bf46056 100644
--- a/ffi/src/lib.rs
+++ b/ffi/src/lib.rs
@@ -96,13 +96,13 @@
//! #include <error.h>
//!
//! pgp_error_t err;
-//! pgp_tpk_t tpk;
+//! pgp_cert_t cert;
//!
-//! tpk = pgp_tpk_from_file (&err, "../openpgp/tests/data/keys/testy.pgp");
-//! if (tpk == NULL)
-//! error (1, 0, "pgp_tpk_from_bytes: %s", pgp_error_to_string (err));
+//! cert = pgp_cert_from_file (&err, "../openpgp/tests/data/keys/testy.pgp");
+//! if (cert == NULL)
+//! error (1, 0, "pgp_cert_from_bytes: %s", pgp_error_to_string (err));
//!
-//! pgp_tpk_free (tpk);
+//! pgp_cert_free (cert);
//! ```
#![warn(missing_docs)]
diff --git a/ffi/src/net.rs b/ffi/src/net.rs
index f697dd35..ae297d4b 100644
--- a/ffi/src/net.rs
+++ b/ffi/src/net.rs
@@ -19,14 +19,14 @@
//! sq_context_t ctx;
//! pgp_keyid_t id;
//! sq_keyserver_t ks;
-//! pgp_tpk_t tpk;
+//! pgp_cert_t cert;
//!
//! ctx = sq_context_new (NULL);
//! ks = sq_keyserver_keys_openpgp_org (ctx);
//! id = pgp_keyid_from_bytes ((uint8_t *) "\x24\x7F\x6D\xAB\xC8\x49\x14\xFE");
-//! tpk = sq_keyserver_get (ctx, ks, id);
+//! cert = sq_keyserver_get (ctx, ks, id);
//!
-//! pgp_tpk_free (tpk);
+//! pgp_cert_free (cert);
//! pgp_keyid_free (id);
//! sq_keyserver_free (ks);
//! sq_context_free (ctx);
@@ -45,7 +45,7 @@ use sequoia_net::KeyServer;
use super::error::Status;
use super::core::Context;
use crate::openpgp::keyid::KeyID;
-use crate::openpgp::tpk::TPK;
+use crate::openpgp::cert::Cert;
use crate::RefRaw;
use crate::MoveResultIntoRaw;
use crate::Maybe;
@@ -120,7 +120,7 @@ fn sq_keyserver_free(ks: Option<&mut KeyServer>) {
fn sq_keyserver_get(ctx: *mut Context,
ks: *mut KeyServer,
id: *const KeyID)
- -> Maybe<TPK> {
+ -> Maybe<Cert> {
let ctx = ffi_param_ref_mut!(ctx);
ffi_make_fry_from_ctx!(ctx);
let ks = ffi_param_ref_mut!(ks);
@@ -136,14 +136,14 @@ fn sq_keyserver_get(ctx: *mut Context,
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn sq_keyserver_send(ctx: *mut Context,
ks: *mut KeyServer,
- tpk: *const TPK)
+ cert: *const Cert)
-> Status {
let ctx = ffi_param_ref_mut!(ctx);
ffi_make_fry_from_ctx!(ctx);
let ks = ffi_param_ref_mut!(ks);
- let tpk = tpk.ref_raw();
+ let cert = cert.ref_raw();
ffi_try_status!(tokio_core::reactor::Core::new()
.map_err(|e| e.into())
- .and_then(|mut core| core.run(ks.send(tpk))))
+ .and_then(|mut core| core.run(ks.send(cert))))
}
diff --git a/ffi/src/store.rs b/ffi/src/store.rs
index 8f273258..d0401d01 100644
--- a/ffi/src/store.rs
+++ b/ffi/src/store.rs
@@ -1,6 +1,6 @@
-//! For storing transferable public keys.
+//! For storing OpenPGP certificates.
//!
-//! The key store stores transferable public keys (TPKs) using an
+//! The key store stores OpenPGP Certificates ("Certs") using an
//! arbitrary label. Stored keys are automatically updated from
//! remote sources. This ensures that updates like new subkeys and
//! revocations are discovered in a timely manner.
@@ -37,7 +37,7 @@ use super::core::Context;
use crate::openpgp::fingerprint::Fingerprint;
use crate::openpgp::keyid::KeyID;
-use crate::openpgp::tpk::TPK;
+use crate::openpgp::cert::Cert;
use crate::RefRaw;
use crate::MoveIntoRaw;
use crate::MoveResultIntoRaw;
@@ -186,7 +186,7 @@ fn sq_log_iter_free(iter: Option<&mut LogIter>) {
/// maintained by a background service. The background service
/// associates state with this name.
///
-/// The mapping updates TPKs in compliance with the network policy
+/// The mapping updates Certs in compliance with the network policy
/// of the context that created the mapping in the first place.
/// Opening the mapping with a different network policy is
/// forbidden.
@@ -230,15 +230,15 @@ fn sq_mapping_add(ctx: *mut Context,
fn sq_mapping_import(ctx: *mut Context,
mapping: *const Mapping,
label: *const c_char,
- tpk: *const TPK)
- -> Maybe<TPK> {
+ cert: *const Cert)
+ -> Maybe<Cert> {
let ctx = ffi_param_ref_mut!(ctx);
ffi_make_fry_from_ctx!(ctx);
let mapping = ffi_param_ref!(mapping);
let label = ffi_param_cstr!(label).to_string_lossy();
- let tpk = tpk.ref_raw();
+ let cert = cert.ref_raw();
- mapping.import(&label, tpk).move_into_raw(Some(ctx.errp()))
+ mapping.import(&label, cert).move_into_raw(Some(ctx.errp()))
}
/// Returns the binding for the given label.
@@ -409,23 +409,23 @@ fn sq_binding_key(ctx: *mut Context, binding: *const Binding)
ffi_try_box!(binding.key())
}
-/// Returns the `pgp_tpk_t` of this binding.
+/// Returns the `pgp_cert_t` of this binding.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
-fn sq_binding_tpk(ctx: *mut Context, binding: *const Binding)
- -> Maybe<TPK> {
+fn sq_binding_cert(ctx: *mut Context, binding: *const Binding)
+ -> Maybe<Cert> {
let ctx = ffi_param_ref_mut!(ctx);
ffi_make_fry_from_ctx!(ctx);
let binding = ffi_param_ref!(binding);
- binding.tpk().move_into_raw(Some(ctx.errp()))
+ binding.cert().move_into_raw(Some(ctx.errp()))
}
-/// Updates this binding with the given TPK.
+/// Updates this binding with the given Cert.
///
-/// If the new key `tpk` matches the current key, i.e. they have
+/// If the new key `cert` matches the current key, i.e. they have
/// the same fingerprint, both keys are merged and normalized.
/// The returned key contains all packets known to Sequoia, and
-/// should be used instead of `tpk`.
+/// should be used instead of `cert`.
///
/// If the new key does not match the current key, but carries a
/// valid signature from the current key, it replaces the current
@@ -439,41 +439,41 @@ fn sq_binding_tpk(ctx: *mut Context, binding: *const Binding)
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn sq_binding_import(ctx: *mut Context,
binding: *const Binding,
- tpk: *const TPK)
- -> Maybe<TPK> {
+ cert: *const Cert)
+ -> Maybe<Cert> {
let ctx = ffi_param_ref_mut!(ctx);
ffi_make_fry_from_ctx!(ctx);
let binding = ffi_param_ref!(binding);
- let tpk = tpk.ref_raw();
+ let cert = cert.ref_raw();
- binding.import(&tpk).move_into_raw(Some(ctx.errp()))
+ binding.import(&cert).move_into_raw(Some(ctx.errp()))
}
-/// Forces a keyrotation to the given TPK.
+/// Forces a keyrotation to the given Cert.
///
-/// The current key is replaced with the new key `tpk`, even if
+/// The current key is replaced with the new key `cert`, even if
/// they do not have the same fingerprint. If a key with the same
-/// fingerprint as `tpk` is already in the mapping, is merged with
-/// `tpk` and normalized. The returned key contains all packets
-/// known to Sequoia, and should be used instead of `tpk`.
+/// fingerprint as `cert` is already in the mapping, is merged with
+/// `cert` and normalized. The returned key contains all packets
+/// known to Sequoia, and should be used instead of `cert`.
///
/// Use this function to resolve conflicts returned from
/// `sq_binding_import`. Make sure that you have authenticated
-/// `tpk` properly. How to do that depends on your thread model.
+/// `cert` properly. How to do that depends on your thread model.
/// You could simply ask Alice to call her communication partner
/// Bob and confirm that he rotated his keys.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn sq_binding_rotate(ctx: *mut Context,
binding: *const Binding,
- tpk: *const TPK)
- -> Maybe<TPK> {
+ cert: *const Cert)
+ -> Maybe<Cert> {
let ctx = ffi_param_ref_mut!(ctx);
ffi_make_fry_from_ctx!(ctx);
let binding = ffi_param_ref!(binding);
- let tpk = tpk.ref_raw();
+ let cert = cert.ref_raw();
- binding.rotate(&tpk).move_into_raw(Some(ctx.errp()))
+ binding.rotate(&cert).move_into_raw(Some(ctx.errp()))
}
/// Deletes this binding.
@@ -514,38 +514,38 @@ fn sq_key_stats(ctx: *mut Context,
box_raw!(Stats::new(ffi_try!(key.stats())))
}
-/// Returns the `pgp_tpk_t`.
+/// Returns the `pgp_cert_t`.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
-fn sq_key_tpk(ctx: *mut Context,
+fn sq_key_cert(ctx: *mut Context,
key: *const Key)
- -> Maybe<TPK> {
+ -> Maybe<Cert> {
let ctx = ffi_param_ref_mut!(ctx);
ffi_make_fry_from_ctx!(ctx);
let key = ffi_param_ref!(key);
- key.tpk().move_into_raw(Some(ctx.errp()))
+ key.cert().move_into_raw(Some(ctx.errp()))
}
-/// Updates this stored key with the given TPK.
+/// Updates this stored key with the given Cert.
///
-/// If the new key `tpk` matches the current key, i.e. they have
+/// If the new key `cert` matches the current key, i.e. they have
/// the same fingerprint, both keys are merged and normalized.
/// The returned key contains all packets known to Sequoia, and
-/// should be used instead of `tpk`.
+/// should be used instead of `cert`.
///
/// If the new key does not match the current key,
/// `Error::Conflict` is returned.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn sq_key_import(ctx: *mut Context,
key: *const Key,
- tpk: *const TPK)
- -> Maybe<TPK> {
+ cert: *const Cert)
+ -> Maybe<Cert> {
let ctx = ffi_param_ref_mut!(ctx);
ffi_make_fry_from_ctx!(ctx);
let key = ffi_param_ref!(key);
- let tpk = tpk.ref_raw();
+ let cert = cert.ref_raw();
- key.import(&tpk).move_into_raw(Some(ctx.errp()))
+ key.import(&cert).move_into_raw(Some(ctx.errp()))
}
/// Lists all log entries related to this key.