diff --git a/proxmox-subscription/Cargo.toml b/proxmox-subscription/Cargo.toml index ab28efb0..84876211 100644 --- a/proxmox-subscription/Cargo.toml +++ b/proxmox-subscription/Cargo.toml @@ -13,13 +13,13 @@ rust-version.workspace = true [dependencies] anyhow.workspace = true -base64 = { workspace = true, optional = true } hex = { workspace = true, optional = true } openssl = { workspace = true, optional = true } regex.workspace = true serde.workspace = true serde_json.workspace = true +proxmox-base64 = { workspace = true, optional = true } proxmox-http = { workspace = true, optional = true, features = ["client-trait", "http-helpers"] } proxmox-serde.workspace = true proxmox-sys = { workspace = true, optional = true } @@ -29,5 +29,5 @@ proxmox-schema = { workspace = true, features = ["api-macro"], optional = true } [features] default = ["impl"] -impl = [ "dep:base64", "dep:hex", "dep:openssl", "dep:proxmox-http", "dep:proxmox-sys", "dep:proxmox-time"] +impl = [ "dep:proxmox-base64", "dep:hex", "dep:openssl", "dep:proxmox-http", "dep:proxmox-sys", "dep:proxmox-time"] api-types = ["dep:proxmox-schema"] diff --git a/proxmox-subscription/src/files.rs b/proxmox-subscription/src/files.rs index 37008f4a..39f05ca5 100644 --- a/proxmox-subscription/src/files.rs +++ b/proxmox-subscription/src/files.rs @@ -21,7 +21,7 @@ fn parse_subscription_file(raw: &str) -> Result, Error> }; // second line is checksum of encoded data let checksum = if let Some(csum) = cfg.next() { - base64::decode(csum)? + proxmox_base64::decode(csum)? } else { return Ok(None); }; @@ -35,7 +35,7 @@ fn parse_subscription_file(raw: &str) -> Result, Error> let mut encoded = encoded_with_newlines.clone(); encoded.retain(|c| c != '\n'); - let decoded = base64::decode(&encoded)?; + let decoded = proxmox_base64::decode(&encoded)?; let decoded = std::str::from_utf8(&decoded)?; let info: SubscriptionInfo = serde_json::from_str(decoded)?; @@ -116,14 +116,14 @@ pub fn write_subscription>( } else if let SubscriptionStatus::New = info.status { format!("{}\n", info.key.as_ref().unwrap()) } else { - let encoded = base64::encode(serde_json::to_string(&info)?); + let encoded = proxmox_base64::encode(serde_json::to_string(&info)?); let csum = format!( "{}{}{}", info.checktime.unwrap_or(0), encoded, SHARED_KEY_DATA ); - let csum = base64::encode(md5sum(csum.as_bytes())?); + let csum = proxmox_base64::encode(md5sum(csum.as_bytes())?); format!("{}\n{}\n{}\n", info.key.as_ref().unwrap(), csum, encoded) };