Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "paas-api"
version = "0.7.0"
version = "0.8.0"
authors = [
"Job Doesburg <job@jobdoesburg.nl>",
"Julian van der Horst <julian.vanderhorst@ru.nl"
Expand All @@ -18,7 +18,7 @@ name = "paas_api"
path = "src/lib.rs"

[dependencies]
libpep = "^0.8"
libpep = "^0.9"
serde = { version = "1.0", features = ["derive"] }
semver = { version = "1.0", features = ["serde"] }
chrono = { version = "0.4", features = ["serde"] }
Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use libpep::core::keys::GlobalPublicKeys;
use crate::status::SystemId;
use libpep::distributed::server::setup::BlindedGlobalKeys;
use libpep::keys::distribution::BlindedGlobalKeys;
use libpep::keys::GlobalPublicKeys;
use serde::{Deserialize, Serialize};
use url::Url;

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// The current version of the API
pub const CURRENT_PROTOCOL_VERSION: &str = env!("CARGO_PKG_VERSION");
/// The minimal supported compatible version
pub const MIN_SUPPORTED_VERSION: &str = "0.7.0"; // If our protocol changes in a breaking way, we should update this number accordingly
pub const MIN_SUPPORTED_VERSION: &str = "0.8.0";

/// Transcryptor config
pub mod config;
Expand Down
4 changes: 2 additions & 2 deletions src/sessions.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use libpep::core::transcryption::EncryptionContext;
use libpep::distributed::server::keys::SessionKeyShares;
use libpep::factors::EncryptionContext;
use libpep::keys::distribution::SessionKeyShares;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
Expand Down
153 changes: 145 additions & 8 deletions src/transcrypt.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use libpep::core::data::{EncryptedAttribute, EncryptedPseudonym};
use libpep::core::json::data::EncryptedPEPJSONValue;
use libpep::core::transcryption::{EncryptionContext, PseudonymizationDomain};
use libpep::core::transcryption::batch::EncryptedData;
use libpep::data::json::EncryptedPEPJSONValue;
use libpep::data::long::{LongEncryptedAttribute, LongEncryptedPseudonym};
use libpep::data::records::{EncryptedRecord, LongEncryptedRecord};
use libpep::data::simple::{EncryptedAttribute, EncryptedPseudonym};
use libpep::factors::{EncryptionContext, PseudonymizationDomain};
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted pseudonym.
pub struct PseudonymizationRequest {
Expand All @@ -23,6 +25,26 @@ pub struct PseudonymizationResponse {
pub encrypted_pseudonym: EncryptedPseudonym,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted pseudonym.
pub struct LongPseudonymizationRequest {
/// The encrypted pseudonym.
pub encrypted_pseudonym: LongEncryptedPseudonym,
/// The domain of the encrypted pseudonym.
pub domain_from: PseudonymizationDomain,
/// The domain to transcrypt the pseudonym to.
pub domain_to: PseudonymizationDomain,
/// The session the pseudonym was encrypted in associated with this server.
pub session_from: EncryptionContext,
/// The session the pseudonym should be decryptable in associated with this server.
pub session_to: EncryptionContext,
}
#[derive(Serialize, Deserialize)]
pub struct LongPseudonymizationResponse {
/// The transcrypted pseudonym.
pub encrypted_pseudonym: LongEncryptedPseudonym,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt multiple encrypted pseudonyms.
pub struct PseudonymizationBatchRequest {
Expand All @@ -45,6 +67,28 @@ pub struct PseudonymizationBatchResponse {
pub encrypted_pseudonyms: Vec<EncryptedPseudonym>,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt multiple encrypted pseudonyms.
pub struct LongPseudonymizationBatchRequest {
/// The encrypted pseudonyms.
pub encrypted_pseudonyms: Vec<LongEncryptedPseudonym>,
/// The domain of the encrypted pseudonyms.
pub domain_from: PseudonymizationDomain,
/// The domain to transcrypt the pseudonyms to.
pub domain_to: PseudonymizationDomain,
/// The session the pseudonyms were encrypted in associated with this server.
pub session_from: EncryptionContext,
/// The session the pseudonyms should be decryptable in associated with this server.
pub session_to: EncryptionContext,
}

#[derive(Serialize, Deserialize)]
pub struct LongPseudonymizationBatchResponse {
/// The transcrypted pseudonyms.
/// Watch out: the order of the encrypted pseudonyms will be randomly permuted to break linkability.
pub encrypted_pseudonyms: Vec<LongEncryptedPseudonym>,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted attribute.
pub struct RekeyRequest {
Expand All @@ -61,6 +105,22 @@ pub struct RekeyResponse {
pub encrypted_attribute: EncryptedAttribute,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted attribute.
pub struct LongRekeyRequest {
/// The encrypted data.
pub encrypted_attribute: LongEncryptedAttribute,
/// The session the attribute was encrypted in associated with this server.
pub session_from: EncryptionContext,
/// The session the attribute should be decryptable in associated with this server.
pub session_to: EncryptionContext,
}
#[derive(Serialize, Deserialize)]
pub struct LongRekeyResponse {
/// The rekeyed attribute
pub encrypted_attribute: LongEncryptedAttribute,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted attribute.
pub struct RekeyBatchRequest {
Expand All @@ -77,11 +137,27 @@ pub struct RekeyBatchResponse {
pub encrypted_attributes: Vec<EncryptedAttribute>,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted attribute.
pub struct LongRekeyBatchRequest {
/// The encrypted datas.
pub encrypted_attributes: Vec<LongEncryptedAttribute>,
/// The session the attributes were encrypted in associated with this server.
pub session_from: EncryptionContext,
/// The session the attributes should be decryptable in associated with this server.
pub session_to: EncryptionContext,
}
#[derive(Serialize, Deserialize)]
pub struct LongRekeyBatchResponse {
/// The rekeyed attribute
pub encrypted_attributes: Vec<LongEncryptedAttribute>,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted pseudonym.
pub struct TranscryptionRequest {
/// The encrypted data.
pub encrypted: Vec<EncryptedData>,
pub encrypted: EncryptedRecord,
/// The domain of the encrypted pseudonyms.
pub domain_from: PseudonymizationDomain,
/// The domain to transcrypt the pseudonyms to.
Expand All @@ -93,9 +169,70 @@ pub struct TranscryptionRequest {
}
#[derive(Serialize, Deserialize)]
pub struct TranscryptionResponse {
/// The transcrypted data.
pub encrypted: EncryptedRecord,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted pseudonym.
pub struct LongTranscryptionRequest {
/// The encrypted data.
pub encrypted: LongEncryptedRecord,
/// The domain of the encrypted pseudonyms.
pub domain_from: PseudonymizationDomain,
/// The domain to transcrypt the pseudonyms to.
pub domain_to: PseudonymizationDomain,
/// The session the messages were encrypted in associated with this server.
pub session_from: EncryptionContext,
/// The session the messages should be decryptable in associated with this server.
pub session_to: EncryptionContext,
}
#[derive(Serialize, Deserialize)]
pub struct LongTranscryptionResponse {
/// The transcrypted data.
pub encrypted: LongEncryptedRecord,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a batch of encrypted data.
pub struct TranscryptionBatchRequest {
/// The encrypted data.
pub encrypted: Vec<EncryptedRecord>,
/// The domain of the encrypted pseudonyms.
pub domain_from: PseudonymizationDomain,
/// The domain to transcrypt the pseudonyms to.
pub domain_to: PseudonymizationDomain,
/// The session the messages were encrypted in associated with this server.
pub session_from: EncryptionContext,
/// The session the messages should be decryptable in associated with this server.
pub session_to: EncryptionContext,
}
#[derive(Serialize, Deserialize)]
pub struct TranscryptionBatchResponse {
/// The transcrypted data (reordered to break linkability).
pub encrypted: Vec<EncryptedRecord>,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted pseudonym.
pub struct LongTranscryptionBatchRequest {
/// The encrypted data.
pub encrypted: Vec<LongEncryptedRecord>,
/// The domain of the encrypted pseudonyms.
pub domain_from: PseudonymizationDomain,
/// The domain to transcrypt the pseudonyms to.
pub domain_to: PseudonymizationDomain,
/// The session the messages were encrypted in associated with this server.
pub session_from: EncryptionContext,
/// The session the messages should be decryptable in associated with this server.
pub session_to: EncryptionContext,
}
#[derive(Serialize, Deserialize)]
pub struct LongTranscryptionBatchResponse {
/// The transcrypted data (reordered to break linkability).
pub encrypted: Vec<EncryptedData>,
pub encrypted: Vec<LongEncryptedRecord>,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted pseudonym.
pub struct JsonTranscryptionRequest {
Expand All @@ -112,12 +249,12 @@ pub struct JsonTranscryptionRequest {
}
#[derive(Serialize, Deserialize)]
pub struct JsonTranscryptionResponse {
/// The transcrypted data (reordered to break linkability).
/// The transcrypted data.
pub encrypted: EncryptedPEPJSONValue,
}

#[derive(Serialize, Deserialize, Debug)]
/// An API request to transcrypt a single encrypted pseudonym.
/// An API request to transcrypt a batch of encrypted data.
pub struct JsonTranscryptionBatchRequest {
/// The encrypted data.
pub encrypted: Vec<EncryptedPEPJSONValue>,
Expand Down
Loading