Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add ed25519 key signing to Rust core (#2469)
Leendert de Borst03ad22540f35
diff --git a/core/rust/Cargo.lock b/core/rust/Cargo.lockindex 96ddeff23..5fc66afba 100644--- a/core/rust/Cargo.lock+++ b/core/rust/Cargo.lock@@ -53,6 +53,7 @@ dependencies = ["chrono","console_error_panic_hook","digest",+ "ed25519-dalek","flate2","getrandom 0.2.17","getrandom 0.3.4",@@ -428,6 +429,33 @@ dependencies = ["cipher",]+[[package]]+name = "curve25519-dalek"+version = "4.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"+dependencies = [+ "cfg-if",+ "cpufeatures",+ "curve25519-dalek-derive",+ "digest",+ "fiat-crypto",+ "rustc_version",+ "subtle",+ "zeroize",+]++[[package]]+name = "curve25519-dalek-derive"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.111",+]+[[package]]name = "der"version = "0.7.10"@@ -451,6 +479,30 @@ dependencies = ["subtle",]+[[package]]+name = "ed25519"+version = "2.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"+dependencies = [+ "pkcs8",+ "signature",+]++[[package]]+name = "ed25519-dalek"+version = "2.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9"+dependencies = [+ "curve25519-dalek",+ "ed25519",+ "serde",+ "sha2",+ "subtle",+ "zeroize",+]+[[package]]name = "encoding_rs"version = "0.8.35"@@ -478,6 +530,12 @@ version = "0.1.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"+[[package]]+name = "fiat-crypto"+version = "0.2.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"+[[package]]name = "find-msvc-tools"version = "0.1.12"@@ -1053,6 +1111,15 @@ dependencies = ["sqlite-wasm-rs",]+[[package]]+name = "rustc_version"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"+dependencies = [+ "semver",+]+[[package]]name = "rustversion"version = "1.0.22"diff --git a/core/rust/Cargo.toml b/core/rust/Cargo.tomlindex 5ade77007..ea3945c6e 100644--- a/core/rust/Cargo.toml+++ b/core/rust/Cargo.toml@@ -84,6 +84,7 @@ mail-parser = { version = "0.11.6", features = ["full_encoding"] }# SQLite client which can be used by all host apps for uniform accessrusqlite = { version = "0.40", features = ["bundled", "serialize"] }+ed25519-dalek = { version = "2", default-features = false, features = ["std", "zeroize"] }# rsa 0.9 pulls rand 0.8 / getrandom 0.2, which only builds for wasm32-unknown-unknown with its "js" feature.[target.'cfg(target_arch = "wasm32")'.dependencies]diff --git a/core/rust/src/crypto/aad.rs b/core/rust/src/crypto/aad.rsindex 5dec5f01d..06fef44ec 100644--- a/core/rust/src/crypto/aad.rs+++ b/core/rust/src/crypto/aad.rs@@ -12,6 +12,9 @@ pub const PERSONAL_VEK: &[u8] = b"aliasvault/v1/vek";/// The account RSA private key under the Account Key.pub const ACCOUNT_PRIVATE_KEY: &[u8] = b"aliasvault/v1/account-private-key";+/// The account Ed25519 signing private key under the Account Key.+pub const ACCOUNT_SIGNING_PRIVATE_KEY: &[u8] = b"aliasvault/v1/account-signing-private-key";+/// A manifest payload under its manifest's VEK.pub fn manifest(manifest_id: &str) -> Vec<u8> {format!("{}/manifest/{}", PREFIX, normalize(manifest_id)).into_bytes()diff --git a/core/rust/src/crypto/key_chain.rs b/core/rust/src/crypto/key_chain.rsindex e56b525a7..c977152c6 100644--- a/core/rust/src/crypto/key_chain.rs+++ b/core/rust/src/crypto/key_chain.rs@@ -1,4 +1,5 @@-//! The account key hierarchy: the KEK encrypts the Account Key, which encrypts the Vault Encryption Key and account private key.+//! The account key hierarchy: the KEK encrypts the Account Key, which encrypts the Vault Encryption Key, the account+//! private key and the account signing private key.//! The KEK and SRP password hash are each HKDF-derived from the unlock key using separate labels.use hkdf::Hkdf;@@ -11,6 +12,7 @@ use zeroize::{Zeroize, ZeroizeOnDrop, Zeroizing};use super::aad;use super::aes_gcm::{generate_key_base64, symmetric_decrypt_bytes_with_aad, symmetric_decrypt_with_aad, symmetric_encrypt_bytes_with_aad, symmetric_encrypt_with_aad};use super::rsa_oaep::{generate_rsa_key_pair, validate_rsa_key_pair, RsaKeyPair};+use super::signing::{self, generate_signing_key_pair};use crate::common::encoding::{base64_decode, base64_encode, hex_encode_upper};use crate::common::error::VaultResult;@@ -22,6 +24,11 @@ pub struct AccountKeyBlobs {pub encrypted_vek: String,pub account_public_key: String,pub encrypted_account_private_key: String,+ pub signing_public_key: String,+ pub encrypted_signing_private_key: String,++ /// The signing key's signature over `account_public_key` (see [`signing::ACCOUNT_PUBLIC_KEY_LABEL`]).+ pub account_public_key_signature: String,}/// A newly created account key hierarchy: the wrapped blobs plus the plaintext halves the client keeps.@@ -30,6 +37,7 @@ pub struct AccountKeyBlobs {pub struct AccountKeyHierarchy {pub vault_encryption_key: String,pub account_private_key: String,+ pub signing_private_key: String,#[zeroize(skip)]pub account_keys: AccountKeyBlobs,@@ -40,6 +48,7 @@ impl fmt::Debug for AccountKeyHierarchy {f.debug_struct("AccountKeyHierarchy").field("vault_encryption_key", &"<redacted>").field("account_private_key", &"<redacted>")+ .field("signing_private_key", &"<redacted>").field("account_keys", &self.account_keys).finish()}@@ -121,6 +130,12 @@ pub fn open_account_private_key(encrypted_account_private_key: &str, account_keysymmetric_decrypt_with_aad(encrypted_account_private_key, account_key_base64, aad::ACCOUNT_PRIVATE_KEY)}+/// Decrypt the account signing private key (base64 seed) with the Account Key.+pub fn open_account_signing_private_key(encrypted_signing_private_key: &str, account_key_base64: &str) -> VaultResult<Zeroizing<String>> {+ let seed = Zeroizing::new(symmetric_decrypt_bytes_with_aad(&base64_decode(encrypted_signing_private_key)?, account_key_base64, aad::ACCOUNT_SIGNING_PRIVATE_KEY)?);+ Ok(Zeroizing::new(base64_encode(&seed[..])))+}+/// Why a key chain did not open.#[derive(Error, Debug, Clone, PartialEq, Eq)]#[cfg_attr(feature = "uniffi", derive(uniffi::Error))]@@ -170,15 +185,20 @@ pub fn create_account_key_hierarchy_with_key_pair(unlock_key_base64: &str, key_pvalidate_rsa_key_pair(key_pair)?;let vault_encryption_key = generate_key_base64();let account_key = Zeroizing::new(generate_key_base64());+ let signing_key_pair = generate_signing_key_pair();+ let account_public_key_message = signing::account_public_key_message(&key_pair.public_key);let account_keys = AccountKeyBlobs {encrypted_account_key: wrap_account_key(&account_key, unlock_key_base64)?,encrypted_vek: wrap_key(&vault_encryption_key, &account_key, aad::PERSONAL_VEK)?,account_public_key: key_pair.public_key.clone(),encrypted_account_private_key: symmetric_encrypt_with_aad(&key_pair.private_key, &account_key, aad::ACCOUNT_PRIVATE_KEY)?,+ signing_public_key: signing_key_pair.public_key.clone(),+ encrypted_signing_private_key: wrap_key(&signing_key_pair.private_key, &account_key, aad::ACCOUNT_SIGNING_PRIVATE_KEY)?,+ account_public_key_signature: signing::sign(&signing_key_pair.private_key, &account_public_key_message)?,};- Ok(AccountKeyHierarchy { vault_encryption_key, account_private_key: key_pair.private_key.clone(), account_keys })+ Ok(AccountKeyHierarchy { vault_encryption_key, account_private_key: key_pair.private_key.clone(), signing_private_key: signing_key_pair.private_key.clone(), account_keys })}/// The Account Key re-encrypted for a new password.@@ -291,6 +311,22 @@ mod tests {assert!(create_account_key_hierarchy_with_key_pair(&unlock_key, &mismatched).is_err());}+ #[test]+ fn hierarchy_carries_a_signing_key_that_signed_the_account_public_key() {+ let unlock_key = generate_key_base64();+ let hierarchy = create_account_key_hierarchy(&unlock_key).unwrap();+ let blobs = &hierarchy.account_keys;+ let account_key = unwrap_account_key(&blobs.encrypted_account_key, &unlock_key).unwrap();++ let signing_private_key = open_account_signing_private_key(&blobs.encrypted_signing_private_key, &account_key).unwrap();+ assert_eq!(*signing_private_key, hierarchy.signing_private_key);+ assert_eq!(signing::signing_public_key_of(&signing_private_key).unwrap(), blobs.signing_public_key);++ let message = signing::account_public_key_message(&blobs.account_public_key);+ assert!(signing::verify(&blobs.signing_public_key, &message, &blobs.account_public_key_signature));+ assert!(open_account_private_key(&blobs.encrypted_signing_private_key, &account_key).is_err(), "the signing key does not open in the account private key slot");+ }+#[test]fn reencrypted_account_key_opens_with_the_new_unlock_key_only() {let old_unlock_key = generate_key_base64();diff --git a/core/rust/src/crypto/mod.rs b/core/rust/src/crypto/mod.rsindex 5e2f62853..b88f9aba3 100644--- a/core/rust/src/crypto/mod.rs+++ b/core/rust/src/crypto/mod.rs@@ -5,6 +5,7 @@ pub mod aes_gcm;pub mod argon2;pub mod key_chain;pub mod rsa_oaep;+pub mod signing;pub mod srp;pub use aes_gcm::{@@ -12,13 +13,15 @@ pub use aes_gcm::{symmetric_encrypt_with_aad,};pub use key_chain::{- create_account_key_hierarchy, create_account_key_hierarchy_with_key_pair, derive_kek, derive_kek_base64, derive_srp_password_hash, open_account_key_chain, open_account_private_key, reencrypt_account_key, unwrap_account_key, unwrap_key, wrap_account_key, wrap_key, AccountKeyBlobs,+ create_account_key_hierarchy, create_account_key_hierarchy_with_key_pair, derive_kek, derive_kek_base64, derive_srp_password_hash, open_account_key_chain, open_account_private_key, open_account_signing_private_key, reencrypt_account_key, unwrap_account_key, unwrap_key, wrap_account_key, wrap_key, AccountKeyBlobs,AccountKeyHierarchy, KeyChainError, OpenedKeyChain, ReencryptedAccountKey, SrpInputError, ENCRYPTION_TYPE_ARGON2ID, ENCRYPTION_TYPE_ARGON2ID_HKDF,};pub use rsa_oaep::{decrypt_with_private_key, decrypt_with_private_key_and_label, encrypt_with_public_key, encrypt_with_public_key_and_label, generate_rsa_key_pair, validate_rsa_key_pair, RsaKeyPair,};+pub use signing::{generate_signing_key_pair, SigningKeyPair};+pub use self::argon2::{argon2_derive_key, argon2_derive_key_bytes_from_settings, argon2_derive_key_from_settings, Argon2Error, Argon2Params};pub use self::srp::{srp_derive_private_key, srp_derive_session, srp_derive_session_server, srp_derive_verifier,diff --git a/core/rust/src/crypto/signing.rs b/core/rust/src/crypto/signing.rsnew file mode 100644index 000000000..09d02c5c7--- /dev/null+++ b/core/rust/src/crypto/signing.rs@@ -0,0 +1,164 @@+//! Ed25519 account signing keys, which let a client check what another client published.+//!+//! A signature always covers a [`signed_message`]: a fixed label plus length-prefixed fields, so a signature made for+//! one purpose never verifies for another. The server builds the same bytes to check signatures.++use ed25519_dalek::{Signature, Signer, SigningKey, VerifyingKey, PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH, SIGNATURE_LENGTH};+use serde::{Deserialize, Serialize};+use std::fmt;+use zeroize::{Zeroize, ZeroizeOnDrop, Zeroizing};++use crate::common::encoding::{base64_decode, base64_encode};+use crate::common::error::{VaultError, VaultResult};+use crate::common::rng::fill_random;++/// The label of a user's signature over their own account encryption public key (the RSA JWK).+pub const ACCOUNT_PUBLIC_KEY_LABEL: &str = "aliasvault/v1/sig/account-public-key";++/// The label of a grant: a manifest's VEK encrypted for one recipient key, signed by whoever handed it out.+pub const GRANT_LABEL: &str = "aliasvault/v1/sig/grant";++/// The label of a manifest's mail delivery public key, signed by whoever published it.+pub const DELIVERY_KEY_LABEL: &str = "aliasvault/v1/sig/delivery-key";++/// A new signing keypair, both halves base64: the 32-byte public key and the 32-byte private seed.+#[derive(Clone, Serialize, Deserialize, Zeroize, ZeroizeOnDrop)]+#[serde(rename_all = "camelCase")]+pub struct SigningKeyPair {+ pub public_key: String,+ pub private_key: String,+}++impl fmt::Debug for SigningKeyPair {+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {+ f.debug_struct("SigningKeyPair").field("public_key", &self.public_key).field("private_key", &"<redacted>").finish()+ }+}++/// Generate a new Ed25519 signing keypair.+pub fn generate_signing_key_pair() -> SigningKeyPair {+ let mut seed = Zeroizing::new([0u8; SECRET_KEY_LENGTH]);+ fill_random(&mut seed[..]);+ let signing_key = SigningKey::from_bytes(&seed);+ SigningKeyPair { public_key: base64_encode(signing_key.verifying_key().as_bytes()), private_key: base64_encode(&seed[..]) }+}++/// The bytes a signature covers: the label and each field, each prefixed with its length as a big-endian u32.+pub fn signed_message(label: &str, fields: &[&[u8]]) -> Vec<u8> {+ let mut out = Vec::with_capacity(4 + label.len() + fields.iter().map(|f| 4 + f.len()).sum::<usize>());+ for part in std::iter::once(label.as_bytes()).chain(fields.iter().copied()) {+ out.extend_from_slice(&(part.len() as u32).to_be_bytes());+ out.extend_from_slice(part);+ }+ out+}++/// The signed message of an account's own encryption public key (JWK).+pub fn account_public_key_message(account_public_key: &str) -> Vec<u8> {+ signed_message(ACCOUNT_PUBLIC_KEY_LABEL, &[account_public_key.as_bytes()])+}++/// The signed message of a grant: version `key_version` of the manifest's VEK, encrypted for `recipient_public_key` (JWK,+/// as the server stores it) and handed out by `signer_user_id`.+pub fn grant_message(manifest_id: &str, key_version: i64, signer_user_id: &str, recipient_public_key: &str, algorithm: &str, encrypted_vek: &str) -> Vec<u8> {+ let manifest_id = manifest_id.to_ascii_lowercase();+ let key_version = key_version.to_string();+ signed_message(GRANT_LABEL, &[manifest_id.as_bytes(), key_version.as_bytes(), signer_user_id.as_bytes(), recipient_public_key.as_bytes(), algorithm.as_bytes(), encrypted_vek.as_bytes()])+}++/// The signed message of a delivery key publish, bound to the revision the write is based on so it cannot be replayed.+pub fn delivery_key_message(manifest_id: &str, public_key: &str, current_revision: i64) -> Vec<u8> {+ signed_message(DELIVERY_KEY_LABEL, &[manifest_id.to_ascii_lowercase().as_bytes(), public_key.as_bytes(), current_revision.to_string().as_bytes()])+}++/// Sign a message with a base64 private seed. Returns the base64 signature.+pub fn sign(private_key_base64: &str, message: &[u8]) -> VaultResult<String> {+ Ok(base64_encode(&signing_key(private_key_base64)?.sign(message).to_bytes()))+}++/// Whether a base64 signature over a message verifies under a base64 public key. Uses strict verification, which+/// refuses weak public keys and non-canonical signatures.+pub fn verify(public_key_base64: &str, message: &[u8], signature_base64: &str) -> bool {+ let (Ok(public_key), Ok(signature)) = (verifying_key(public_key_base64), base64_decode(signature_base64)) else { return false };+ let Ok(signature) = <[u8; SIGNATURE_LENGTH]>::try_from(signature.as_slice()) else { return false };+ public_key.verify_strict(message, &Signature::from_bytes(&signature)).is_ok()+}++/// The base64 public key of a base64 private seed.+pub fn signing_public_key_of(private_key_base64: &str) -> VaultResult<String> {+ Ok(base64_encode(signing_key(private_key_base64)?.verifying_key().as_bytes()))+}++fn signing_key(private_key_base64: &str) -> VaultResult<SigningKey> {+ let seed = Zeroizing::new(base64_decode(private_key_base64)?);+ let seed: &[u8; SECRET_KEY_LENGTH] = seed.as_slice().try_into().map_err(|_| VaultError::General(format!("Signing private key must be {} bytes", SECRET_KEY_LENGTH)))?;+ Ok(SigningKey::from_bytes(seed))+}++fn verifying_key(public_key_base64: &str) -> VaultResult<VerifyingKey> {+ let bytes = base64_decode(public_key_base64)?;+ let bytes: [u8; PUBLIC_KEY_LENGTH] = bytes.as_slice().try_into().map_err(|_| VaultError::General(format!("Signing public key must be {} bytes", PUBLIC_KEY_LENGTH)))?;+ VerifyingKey::from_bytes(&bytes).map_err(|e| VaultError::General(format!("Invalid signing public key: {}", e)))+}++#[cfg(test)]+mod tests {+ use super::*;++ /// The private seed 0x00..0x1f, shared with the server's known-answer test.+ fn vector_seed() -> String {+ base64_encode(&(0u8..32).collect::<Vec<u8>>())+ }++ /// Known-answer vector for the message encoding. The server builds the same bytes and checks this exact+ /// signature (`SigningTests` in the server unit tests); a changed output means stored signatures no longer verify. Never regenerate it.+ #[test]+ fn signed_message_known_answer() {+ let message = signed_message(ACCOUNT_PUBLIC_KEY_LABEL, &[b"{\"kty\":\"RSA\"}"]);+ assert_eq!(crate::common::encoding::hex_encode_lower(&message), MESSAGE_VECTOR);+ assert_eq!(signing_public_key_of(&vector_seed()).unwrap(), PUBLIC_KEY_VECTOR);+ assert_eq!(sign(&vector_seed(), &message).unwrap(), SIGNATURE_VECTOR);+ }++ const MESSAGE_VECTOR: &str = "00000024616c6961737661756c742f76312f7369672f6163636f756e742d7075626c69632d6b65790000000d7b226b7479223a22525341227d";+ const PUBLIC_KEY_VECTOR: &str = "A6EHv/POEL4dcN0Y50vAmWfk1jCbpQ1fHdyGZBJVMbg=";+ const SIGNATURE_VECTOR: &str = "twY5wx2bX5kesFEjJa+ZUYOpw4Hs3hqFUpbWC4KbVRVgragIilho+vCl9Haik3F/a2vLcAoCtJssesL4wAaxDg==";++ /// Known-answer vectors for the grant and delivery key messages, which the server builds too (`SigningTests`). The+ /// manifest id is lowercased, as the server prints a GUID. Never regenerate them.+ #[test]+ fn grant_and_delivery_key_messages_known_answer() {+ let manifest_id = "0A1B2C3D-0000-0000-0000-000000000001";+ assert_eq!(crate::common::encoding::hex_encode_lower(&grant_message(manifest_id, 3, "user-1", "{\"kty\":\"RSA\"}", "rsa-oaep-sha256", "dmVr")), GRANT_MESSAGE_VECTOR);+ assert_eq!(crate::common::encoding::hex_encode_lower(&delivery_key_message(manifest_id, "{\"kty\":\"RSA\"}", 42)), DELIVERY_KEY_MESSAGE_VECTOR);+ }++ const GRANT_MESSAGE_VECTOR: &str = "00000017616c6961737661756c742f76312f7369672f6772616e740000002430613162326333642d303030302d303030302d303030302d303030303030303030303031000000013300000006757365722d310000000d7b226b7479223a22525341227d0000000f7273612d6f6165702d73686132353600000004646d5672";+ const DELIVERY_KEY_MESSAGE_VECTOR: &str = "0000001e616c6961737661756c742f76312f7369672f64656c69766572792d6b65790000002430613162326333642d303030302d303030302d303030302d3030303030303030303030310000000d7b226b7479223a22525341227d000000023432";++ #[test]+ fn signature_round_trip() {+ let pair = generate_signing_key_pair();+ assert_eq!(signing_public_key_of(&pair.private_key).unwrap(), pair.public_key);+ let signature = sign(&pair.private_key, b"message").unwrap();+ assert!(verify(&pair.public_key, b"message", &signature));+ assert!(!verify(&pair.public_key, b"other message", &signature));+ assert!(!verify(&generate_signing_key_pair().public_key, b"message", &signature));+ }++ #[test]+ fn malformed_input_does_not_verify() {+ let pair = generate_signing_key_pair();+ let signature = sign(&pair.private_key, b"message").unwrap();+ assert!(!verify("not base64!", b"message", &signature));+ assert!(!verify(&base64_encode(&[1u8; 16]), b"message", &signature));+ assert!(!verify(&pair.public_key, b"message", &base64_encode(&[0u8; 63])));+ assert!(sign(&base64_encode(&[0u8; 31]), b"message").is_err());+ }++ #[test]+ fn fields_are_length_prefixed() {+ assert_ne!(signed_message("l", &[b"ab", b"c"]), signed_message("l", &[b"a", b"bc"]));+ assert_ne!(signed_message("la", &[b"b"]), signed_message("l", &[b"ab"]));+ }+}diff --git a/core/rust/src/vault_sync/keys.rs b/core/rust/src/vault_sync/keys.rsindex 2d40ba36b..7d4b70173 100644--- a/core/rust/src/vault_sync/keys.rs+++ b/core/rust/src/vault_sync/keys.rs@@ -5,7 +5,7 @@ use std::collections::HashMap;use super::errors::{SyncError, SyncResult};use super::session::Host;use super::state::{self, Ctx};-use super::types::{SharedManifestDto, VaultKeyGetResponse, VaultKeyResponse, ALGORITHM_RSA_OAEP_SHA256};+use super::types::{ManifestDto, SharedManifestDto, VaultKeyGetResponse, VaultKeyResponse, ALGORITHM_RSA_OAEP_SHA256};use super::http;use crate::crypto;@@ -37,6 +37,16 @@ pub(crate) async fn cache_vault_key_blobs(host: &Host, vault_key: &VaultKeyRespostate::remove(host, state::ENCRYPTED_ACCOUNT_PRIVATE_KEY).await?;}}+ match (&vault_key.signing_public_key, &vault_key.encrypted_signing_private_key) {+ (Some(public), Some(private)) => {+ state::set(host, state::SIGNING_PUBLIC_KEY, public).await?;+ state::set(host, state::ENCRYPTED_SIGNING_PRIVATE_KEY, private).await?;+ }+ _ => {+ state::remove(host, state::SIGNING_PUBLIC_KEY).await?;+ state::remove(host, state::ENCRYPTED_SIGNING_PRIVATE_KEY).await?;+ }+ }Ok(())}@@ -132,7 +142,7 @@ fn is_server_unreachable(error: &SyncError) -> bool {/// Clear the cached key chain: the account has none (legacy), so the unlock key is the vault key.async fn clear_cached_chain(host: &Host) -> SyncResult<()> {- for key in [state::ENCRYPTED_ACCOUNT_KEY, state::ENCRYPTED_VEK, state::ACCOUNT_PUBLIC_KEY, state::ENCRYPTED_ACCOUNT_PRIVATE_KEY] {+ for key in [state::ENCRYPTED_ACCOUNT_KEY, state::ENCRYPTED_VEK, state::ACCOUNT_PUBLIC_KEY, state::ENCRYPTED_ACCOUNT_PRIVATE_KEY, state::SIGNING_PUBLIC_KEY, state::ENCRYPTED_SIGNING_PRIVATE_KEY] {state::remove(host, key).await?;}Ok(())@@ -143,6 +153,7 @@ async fn clear_cached_chain(host: &Host) -> SyncResult<()> {async fn open_chain(ctx: &mut Ctx, encrypted_account_key: &str, encrypted_vek: &str, encrypted_private_key: Option<&str>, unlock_key: &str) -> SyncResult<()> {let opened = crypto::open_account_key_chain(unlock_key, encrypted_account_key, encrypted_vek, None)?;ctx.set_encryption_key(opened.vault_encryption_key.to_string());+ ctx.account_key = Some(opened.account_key.to_string());stage_account_private_key(ctx, &opened.account_key, encrypted_private_key).await;Ok(())}@@ -206,6 +217,7 @@ pub(crate) async fn accept_hierarchy_created_elsewhere(ctx: &mut Ctx) -> SyncReslet opened = crypto::open_account_key_chain(&session_key, &vault_key.encrypted_account_key, &encrypted_vek, None)?;cache_vault_key_blobs(&ctx.host, &vault_key).await?;switch_to_vek(ctx, &session_key, &opened.vault_encryption_key).await?;+ ctx.account_key = Some(opened.account_key.to_string());stage_account_private_key(ctx, &opened.account_key, vault_key.encrypted_account_private_key.as_deref()).await;Ok(())}@@ -246,3 +258,24 @@ async fn stage_account_private_key(ctx: &mut Ctx, account_key: &str, encrypted_pErr(error) => ctx.warn(format!("[VaultSync] The cached account private key did not open; shared grants stay closed. {}", error)).await,}}++/// The account signing private key, opened on first use from the cached encrypted copy with the session's Account Key+/// (the key the host's chain open returned). None when that key or the cached copy is missing or does not open it.+pub(crate) async fn signing_private_key(ctx: &mut Ctx) -> SyncResult<Option<String>> {+ if ctx.signing_private_key.is_some() {+ return Ok(ctx.signing_private_key.clone());+ }+ let (Some(account_key), Some(encrypted)) = (ctx.account_key.clone(), state::get::<String>(&ctx.host, state::ENCRYPTED_SIGNING_PRIVATE_KEY).await?) else { return Ok(None) };+ match crypto::open_account_signing_private_key(&encrypted, &account_key) {+ Ok(private_key) => ctx.signing_private_key = Some(private_key.to_string()),+ Err(error) => ctx.warn(format!("[VaultSync] The cached signing private key did not open; nothing can be signed this run. {}", error)).await,+ }+ Ok(ctx.signing_private_key.clone())+}++/// Whether the grant a manifest was served with carries a valid signature by its signer.+pub(crate) fn grant_signature_verifies(dto: &ManifestDto, recipient_public_key: &str, algorithm: &str, encrypted_vek: &str) -> bool {+ let (Some(signer_user_id), Some(signer_public_key), Some(signature)) = (dto.grant_signer_user_id.as_deref(), dto.grant_signer_public_key.as_deref(), dto.grant_signature.as_deref()) else { return false };+ let message = crypto::signing::grant_message(&dto.manifest_id, dto.key_version, signer_user_id, recipient_public_key, algorithm, encrypted_vek);+ crypto::signing::verify(signer_public_key, &message, signature)+}diff --git a/core/rust/src/vault_sync/pull.rs b/core/rust/src/vault_sync/pull.rsindex 4c5d7b525..b0b7e0c17 100644--- a/core/rust/src/vault_sync/pull.rs+++ b/core/rust/src/vault_sync/pull.rs@@ -419,6 +419,10 @@ async fn resolve_granted_vek(ctx: &Ctx, dto: &ManifestDto) -> SyncResult<String>if algorithm != types::ALGORITHM_RSA_OAEP_SHA256 {return Err(SyncError::VaultVersionIncompatible(format!("shared manifest {} grants its VEK under an unsupported algorithm \"{}\"; update the app", dto.manifest_id, algorithm)));}+ // Require the grant to be signed by the account's private key.+ if !keys::grant_signature_verifies(dto, &public_key, &algorithm, &encrypted_vek) {+ return Err(SyncError::ServerVaultUnreadable(format!("the grant on shared manifest {} carries no valid signature, refusing to assemble", dto.manifest_id)));+ }let private_key = keys::resolve_grant_private_key(ctx, &public_key).ok_or_else(|| SyncError::Snapshot(format!("this session holds no account private key that opens the grant on shared manifest {}, refusing to assemble", dto.manifest_id)))?;keys::decrypt_manifest_vek(&encrypted_vek, &dto.manifest_id, &private_key).map_err(|e| SyncError::ServerVaultUnreadable(format!("failed to decrypt the VEK of shared manifest {}, refusing to assemble: {}", dto.manifest_id, e)))}diff --git a/core/rust/src/vault_sync/push.rs b/core/rust/src/vault_sync/push.rsindex 9ab107ae0..df7d6f750 100644--- a/core/rust/src/vault_sync/push.rs+++ b/core/rust/src/vault_sync/push.rs@@ -397,6 +397,7 @@ struct LegacyAccountKeyMigration {#[zeroize(skip)]account_keys: crypto::AccountKeyBlobs,account_private_key: String,+ signing_private_key: String,}/// The content fingerprints one write carried, keyed like the baselines, to become the new baselines on success.@@ -473,7 +474,12 @@ async fn push_internal(ctx: &mut Ctx, cached: Option<CanonicalizedSet>, create_v}let mut written = WrittenFingerprints::default();let bucket_writes = encrypt_changed_buckets(ctx, &canonicalized.data_buckets, &candidates, &baselines, gate, &mut written).await?;- let manifest_writes = encrypt_changed_manifests(ctx, &candidates, &baselines, gate, &mut written).await?;+ // An upgrade push signs with the signing key it creates, which the server stores in the same write.+ let signing_key = match &migration {+ Some(migration) => Some(migration.signing_private_key.clone()),+ None => keys::signing_private_key(ctx).await?,+ };+ let manifest_writes = encrypt_changed_manifests(ctx, &candidates, &baselines, gate, signing_key.as_deref(), &mut written).await?;if manifest_writes.is_empty() && bucket_writes.is_empty() {ctx.log("[V2Push] No content changes detected (every manifest and data bucket matches the server baselines); skipping upload.").await;@@ -507,11 +513,12 @@ async fn start_account_key_migration(ctx: &Ctx, unlock_key: &str, create_vault_kreturn Ok(None);}let hierarchy = crypto::create_account_key_hierarchy(unlock_key)?;- ctx.log("[V2Push] Account-key migration: generated new VEK, AK and account keypair; vault content and all blobs will be re-encrypted and re-uploaded.").await;+ ctx.log("[V2Push] Account-key migration: generated new VEK, AK, account keypair and signing keypair; vault content and all blobs will be re-encrypted and re-uploaded.").await;Ok(Some(LegacyAccountKeyMigration {content_key: hierarchy.vault_encryption_key.clone(),account_keys: hierarchy.account_keys.clone(),account_private_key: hierarchy.account_private_key.clone(),+ signing_private_key: hierarchy.signing_private_key.clone(),}))}@@ -588,7 +595,7 @@ async fn encrypt_changed_buckets(ctx: &Ctx, buckets: &[DataBucket], candidates:}/// Gate, validate, pack and encrypt every changed candidate into the write batch, each with its own key.-async fn encrypt_changed_manifests(ctx: &Ctx, candidates: &[Candidate<'_>], baselines: &PushBaselines, gate: WriteGate, written: &mut WrittenFingerprints) -> SyncResult<Vec<ManifestWrite>> {+async fn encrypt_changed_manifests(ctx: &Ctx, candidates: &[Candidate<'_>], baselines: &PushBaselines, gate: WriteGate, signing_key: Option<&str>, written: &mut WrittenFingerprints) -> SyncResult<Vec<ManifestWrite>> {let mut writes = Vec::new();for candidate in candidates {let label = candidate.label();@@ -616,6 +623,16 @@ async fn encrypt_changed_manifests(ctx: &Ctx, candidates: &[Candidate<'_>], basectx.warn(format!("[V2Push] {} is missing its email keypair; its aliases stay personal until sharing is re-enabled.", label)).await;}+ // The server only accepts a new delivery key signed by the caller; a key that is already published needs none.+ let manifest_key_signature = match (&manifest_key, signing_key) {+ (Some(public_key), Some(signing_key)) => Some(crypto::signing::sign(signing_key, &crypto::signing::delivery_key_message(&candidate.record.manifest_id, public_key, candidate.current_revision))?),+ (Some(_), None) => {+ ctx.warn(format!("[V2Push] {} publishes its email key without a signing key; the server refuses it if the key is new.", label)).await;+ None+ }+ _ => None,+ };+let blob_refs: Vec<BlobRef> = candidate.manifest.referenced_blobs().into_iter().map(|(hash, category)| BlobRef { hash, category }).collect();writes.push(ManifestWrite {manifest_id: candidate.record.manifest_id.clone(),@@ -625,6 +642,7 @@ async fn encrypt_changed_manifests(ctx: &Ctx, candidates: &[Candidate<'_>], basecredentials_count: candidate.manifest.tables.get("Items").map(Vec::len).unwrap_or(0),blob_references: blob_refs,encryption_public_key: manifest_key,+ encryption_public_key_signature: manifest_key_signature,});written.insert(fingerprint_key, fingerprint);}@@ -721,8 +739,11 @@ async fn complete_account_key_migration(ctx: &mut Ctx, migration: &LegacyAccountstate::set(&ctx.host, state::ENCRYPTED_VEK, &blobs.encrypted_vek).await?;state::set(&ctx.host, state::ACCOUNT_PUBLIC_KEY, &blobs.account_public_key).await?;state::set(&ctx.host, state::ENCRYPTED_ACCOUNT_PRIVATE_KEY, &blobs.encrypted_account_private_key).await?;+ state::set(&ctx.host, state::SIGNING_PUBLIC_KEY, &blobs.signing_public_key).await?;+ state::set(&ctx.host, state::ENCRYPTED_SIGNING_PRIVATE_KEY, &blobs.encrypted_signing_private_key).await?;ctx.account_public_key = Some(blobs.account_public_key.clone());ctx.account_private_key = Some(migration.account_private_key.clone());+ ctx.signing_private_key = Some(migration.signing_private_key.clone());Ok(())}diff --git a/core/rust/src/vault_sync/sharing.rs b/core/rust/src/vault_sync/sharing.rsindex e8dc364b2..e9b6c13f3 100644--- a/core/rust/src/vault_sync/sharing.rs+++ b/core/rust/src/vault_sync/sharing.rs@@ -40,6 +40,8 @@ struct GroupInfo {#[serde(rename_all = "camelCase")]struct GroupManifestInfo {manifest_id: String,+ #[serde(default)]+ key_version: i64,}#[derive(Debug, Clone, Default, Deserialize)]@@ -47,9 +49,15 @@ struct GroupManifestInfo {struct GroupMemberInfo {user_id: String,#[serde(default)]+ username: String,+ #[serde(default)]public_key_id: Option<String>,#[serde(default)]public_key: Option<String>,+ #[serde(default)]+ public_key_signature: Option<String>,+ #[serde(default)]+ signing_public_key: Option<String>,}#[derive(Debug, Serialize)]@@ -59,6 +67,7 @@ struct CreateSharedManifestRequest<'a> {self_encrypted_vek: &'a str,self_public_key: &'a str,algorithm: &'a str,+ self_grant_signature: &'a str,encrypted_name: &'a str,}@@ -83,6 +92,7 @@ struct ManifestGrant {recipient_public_key_id: String,encrypted_vek: String,encrypted_name: Option<String>,+ signature: String,}#[derive(Debug, Serialize)]@@ -166,6 +176,11 @@ async fn administered_group(ctx: &Ctx, group_id: &str) -> SyncResult<GroupInfo>.ok_or_else(|| SyncError::Other(format!("Group {} is not one this account administers", group_id)))}+/// This account's user id in a group, which the grants it signs name.+fn own_user_id(ctx: &Ctx, group: &GroupInfo) -> SyncResult<String> {+ group.members.iter().find(|member| member.username.eq_ignore_ascii_case(&ctx.request.username)).map(|member| member.user_id.clone()).ok_or_else(|| SyncError::Other("This account is not a member of the group".to_string()))+}+/// This account's public key, which a new shared manifest's key is encrypted for.async fn own_public_key(ctx: &Ctx) -> SyncResult<Option<String>> {match &ctx.account_public_key {@@ -183,6 +198,7 @@ async fn create_shared_manifest(ctx: &mut Ctx) -> Outcome {// The new manifest's VEK is encrypted only for this account's own public key upon creation, other users are invited separately.let Some(self_public_key) = own_public_key(ctx).await? else { return Ok(Err(Refusal::VaultUpgradeRequired)) };+ let Some(signing_key) = keys::signing_private_key(ctx).await? else { return Ok(Err(Refusal::VaultUpgradeRequired)) };if state::get::<String>(&ctx.host, state::VAULT_PERSONAL_MANIFEST_ID).await?.is_none() {return Ok(Err(Refusal::VaultUpgradeRequired));}@@ -193,11 +209,13 @@ async fn create_shared_manifest(ctx: &mut Ctx) -> Outcome {let manifest_vek = crypto::generate_key_base64();let requested_id = db::new_id();let self_encrypted_vek = keys::encrypt_manifest_vek(&manifest_vek, &requested_id, &self_public_key)?;+ // A new manifest starts at key version 0.+ let self_grant_signature = crypto::signing::sign(&signing_key, &crypto::signing::grant_message(&requested_id, 0, &own_user_id(ctx, &group)?, &self_public_key, ALGORITHM_RSA_OAEP_SHA256, &self_encrypted_vek))?;let encrypted_name = pull::encrypt_manifest_name(&name, &requested_id, &manifest_vek)?;let response: CreateSharedManifestResponse = http::post(&ctx.host,&format!("Groups/{}/manifests", group.group_id),- &CreateSharedManifestRequest { manifest_id: &requested_id, self_encrypted_vek: &self_encrypted_vek, self_public_key: &self_public_key, algorithm: ALGORITHM_RSA_OAEP_SHA256, encrypted_name: &encrypted_name },+ &CreateSharedManifestRequest { manifest_id: &requested_id, self_encrypted_vek: &self_encrypted_vek, self_public_key: &self_public_key, algorithm: ALGORITHM_RSA_OAEP_SHA256, self_grant_signature: &self_grant_signature, encrypted_name: &encrypted_name },false,).await?;@@ -283,10 +301,16 @@ async fn invite_to_shared_manifest(ctx: &mut Ctx) -> Outcome {let group = administered_group(ctx, &target.group_id).await?;let manifest = group.manifests.iter().find(|candidate| ids_equal(&candidate.manifest_id, &manifest_id)).ok_or_else(|| SyncError::Other("The shared manifest does not belong to the group".to_string()))?;let member = group.members.iter().find(|candidate| candidate.user_id == user_id).ok_or_else(|| SyncError::Other("The recipient is not a member of the group".to_string()))?;- let (Some(recipient_public_key), Some(recipient_public_key_id)) = (member.public_key.clone(), member.public_key_id.clone()) else {+ let (Some(recipient_public_key), Some(recipient_public_key_id), Some(signature), Some(signing_public_key)) = (member.public_key.clone(), member.public_key_id.clone(), member.public_key_signature.as_deref(), member.signing_public_key.as_deref()) else {return Ok(Err(Refusal::Api(INVITE_RECIPIENT_NOT_READY.to_string())));};+ // Only encrypt the key for a public key its owner signed with their signing key.+ if !crypto::signing::verify(signing_public_key, &crypto::signing::account_public_key_message(&recipient_public_key), signature) {+ return Err(SyncError::Other(format!("The public key of {} carries no valid signature by their signing key", member.user_id)));+ }+ let Some(signing_key) = keys::signing_private_key(ctx).await? else { return Ok(Err(Refusal::VaultUpgradeRequired)) };+// Find this account's own grant on the manifest.let mut record = held_record(ctx, &manifest.manifest_id).await?;if record.is_none() {@@ -300,10 +324,12 @@ async fn invite_to_shared_manifest(ctx: &mut Ctx) -> Outcome {// The name travels encrypted in the invitation, so the recipient sees what they are invited to.let name = db::manifest_display_names(&ctx.host).await?.get(&id_key(&manifest.manifest_id)).cloned().filter(|name| !name.is_empty());+ let encrypted_vek = keys::encrypt_manifest_vek(&manifest_vek, &manifest.manifest_id, &recipient_public_key)?;let grant = ManifestGrant {recipient_user_id: member.user_id.clone(),recipient_public_key_id,- encrypted_vek: keys::encrypt_manifest_vek(&manifest_vek, &manifest.manifest_id, &recipient_public_key)?,+ signature: crypto::signing::sign(&signing_key, &crypto::signing::grant_message(&manifest.manifest_id, manifest.key_version, &own_user_id(ctx, &group)?, &recipient_public_key, ALGORITHM_RSA_OAEP_SHA256, &encrypted_vek))?,+ encrypted_vek,encrypted_name: name.map(|name| crypto::encrypt_with_public_key(name.as_bytes(), &recipient_public_key)).transpose()?,};diff --git a/core/rust/src/vault_sync/state.rs b/core/rust/src/vault_sync/state.rsindex 3eaaad293..fd11af98c 100644--- a/core/rust/src/vault_sync/state.rs+++ b/core/rust/src/vault_sync/state.rs@@ -19,6 +19,8 @@ pub(crate) struct Ctx {pub encryption_key: Option<String>,pub account_public_key: Option<String>,pub account_private_key: Option<String>,+ pub account_key: Option<String>,+ pub signing_private_key: Option<String>,pub is_dirty: bool,pub mutation_sequence: u64,/// The session key this run switched to; the next vault store hands it to the host.@@ -43,6 +45,8 @@ impl Ctx {encryption_key: request.encryption_key.clone(),account_public_key: request.account_public_key.clone(),account_private_key: request.account_private_key.clone(),+ account_key: request.account_key.clone(),+ signing_private_key: None,is_dirty: request.is_dirty,mutation_sequence: request.mutation_sequence,new_encryption_key: None,@@ -116,6 +120,8 @@ pub(crate) const ENCRYPTED_VEK: &str = "encryptedVek";pub(crate) const ENCRYPTED_ACCOUNT_KEY: &str = "encryptedAccountKey";pub(crate) const ACCOUNT_PUBLIC_KEY: &str = "accountPublicKey";pub(crate) const ENCRYPTED_ACCOUNT_PRIVATE_KEY: &str = "encryptedAccountPrivateKey";+pub(crate) const SIGNING_PUBLIC_KEY: &str = "signingPublicKey";+pub(crate) const ENCRYPTED_SIGNING_PRIVATE_KEY: &str = "encryptedSigningPrivateKey";pub(crate) const UNLOCK_KEY_DERIVATION_PARAMS: &str = "encryptionKeyDerivationParams";/// Read a value, `None` when absent or null.diff --git a/core/rust/src/vault_sync/tests/mod.rs b/core/rust/src/vault_sync/tests/mod.rsindex 9d20ccd10..61eaffd50 100644--- a/core/rust/src/vault_sync/tests/mod.rs+++ b/core/rust/src/vault_sync/tests/mod.rs@@ -2,6 +2,7 @@mod item_move;mod merge_edge_cases;+mod signatures;mod test_host;mod unloaded_blobs;mod unsupported_grant;@@ -674,8 +675,12 @@ fn manifest_migration_generates_the_key_hierarchy_and_pushes() {assert!(crypto::unwrap_key(body["migration"]["accountKeys"]["encryptedAccountKey"].as_str().unwrap(), &unlock_key, crypto::aad::ACCOUNT_KEY).is_err(), "the legacy vault key does not wrap the Account Key directly");let opened = crypto::open_account_key_chain(&unlock_key, body["migration"]["accountKeys"]["encryptedAccountKey"].as_str().unwrap(), body["migration"]["accountKeys"]["encryptedVek"].as_str().unwrap(), None).unwrap();assert_eq!(*opened.vault_encryption_key, new_key);+ let account_keys = &body["migration"]["accountKeys"];+ let signed = crypto::signing::account_public_key_message(account_keys["accountPublicKey"].as_str().unwrap());+ assert!(crypto::signing::verify(account_keys["signingPublicKey"].as_str().unwrap(), &signed, account_keys["accountPublicKeySignature"].as_str().unwrap()), "the upgrade push carries a signing key that signed the account public key");assert!(host.state.contains_key(state::ENCRYPTED_ACCOUNT_KEY));assert!(host.state.contains_key(state::ENCRYPTED_ACCOUNT_PRIVATE_KEY));+ assert_eq!(host.state[state::ENCRYPTED_SIGNING_PRIVATE_KEY], account_keys["encryptedSigningPrivateKey"]);assert_eq!(host.rekeyed_stores_found_the_chain, vec![true], "the chain is cached before the vault is stored under the VEK");}@@ -850,7 +855,7 @@ fn status_check_reports_newer_server_state_without_touching_the_vault() {/// The `GET v2/VaultKey/Password` answer for a hierarchy the server holds.fn vault_key_body(hierarchy: &crypto::AccountKeyHierarchy) -> Value {let blobs = &hierarchy.account_keys;- json!({ "vaultKey": { "type": "password", "encryptedAccountKey": blobs.encrypted_account_key, "encryptedVek": blobs.encrypted_vek, "accountPublicKey": blobs.account_public_key, "encryptedAccountPrivateKey": blobs.encrypted_account_private_key, "salt": "salt", "encryptionType": "Argon2Id", "encryptionSettings": "{}" } })+ json!({ "vaultKey": { "type": "password", "encryptedAccountKey": blobs.encrypted_account_key, "encryptedVek": blobs.encrypted_vek, "accountPublicKey": blobs.account_public_key, "encryptedAccountPrivateKey": blobs.encrypted_account_private_key, "signingPublicKey": blobs.signing_public_key, "encryptedSigningPrivateKey": blobs.encrypted_signing_private_key, "salt": "salt", "encryptionType": "Argon2Id", "encryptionSettings": "{}" } })}/// The cross-device race: this device logged in while the account was legacy (no cached chain, unlock key session), and@@ -897,6 +902,8 @@ fn resolve_vault_key_opens_the_chain_from_the_server() {assert_eq!(result["encryptionKey"], hierarchy.vault_encryption_key);assert_eq!(host.state[state::ENCRYPTED_ACCOUNT_PRIVATE_KEY], hierarchy.account_keys.encrypted_account_private_key);assert_eq!(host.state[state::ENCRYPTED_ACCOUNT_KEY], hierarchy.account_keys.encrypted_account_key);+ assert_eq!(host.state[state::SIGNING_PUBLIC_KEY], hierarchy.account_keys.signing_public_key);+ assert_eq!(host.state[state::ENCRYPTED_SIGNING_PRIVATE_KEY], hierarchy.account_keys.encrypted_signing_private_key);assert!(host.store_calls.is_empty(), "resolving a key never touches the stored vault");}diff --git a/core/rust/src/vault_sync/types.rs b/core/rust/src/vault_sync/types.rsindex 9069def4a..77effd0ca 100644--- a/core/rust/src/vault_sync/types.rs+++ b/core/rust/src/vault_sync/types.rs@@ -57,6 +57,8 @@ pub struct SyncRequest {#[serde(default)]pub account_private_key: Option<String>,#[serde(default)]+ pub account_key: Option<String>,+ #[serde(default)]pub is_dirty: bool,#[serde(default)]pub mutation_sequence: u64,@@ -573,6 +575,14 @@ pub struct ManifestDto {pub algorithm: Option<String>,#[serde(default)]pub encryption_public_key: Option<String>,+ #[serde(default)]+ pub grant_signature: Option<String>,+ #[serde(default)]+ pub grant_signer_user_id: Option<String>,+ #[serde(default)]+ pub grant_signer_public_key: Option<String>,+ #[serde(default)]+ pub key_version: i64,}#[derive(Debug, Clone, Default, Deserialize)]@@ -626,6 +636,8 @@ pub struct ManifestWrite {pub blob_references: Vec<BlobRef>,#[serde(skip_serializing_if = "Option::is_none")]pub encryption_public_key: Option<String>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub encryption_public_key_signature: Option<String>,}#[derive(Debug, Clone, Serialize)]@@ -746,6 +758,10 @@ pub struct VaultKeyResponse {#[serde(default)]pub account_public_key: Option<String>,#[serde(default)]+ pub signing_public_key: Option<String>,+ #[serde(default)]+ pub encrypted_signing_private_key: Option<String>,+ #[serde(default)]pub encrypted_vek: Option<String>,#[serde(default)]pub salt: String,