Skip to content

Commit 60f5f5c

Browse files
committed
specify SSE-C in --object-sse as well
1 parent b6015eb commit 60f5f5c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

server/src/storage/s3.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub struct S3Config {
8888

8989
/// Server side encryption to use for operations with objects.
9090
/// Currently, this only supports SSE-C. Value should be
91-
/// like AES256:<base64_encoded_encryption_key>.
91+
/// like SSE-C:AES256:<base64_encoded_encryption_key>.
9292
#[arg(long, env = "P_OBJECT_SSE", value_name = "object-sse")]
9393
pub object_sse: Option<ObjectSse>,
9494

@@ -157,9 +157,14 @@ impl FromStr for ObjectSse {
157157

158158
fn from_str(s: &str) -> Result<Self, Self::Err> {
159159
let parts = s.split(':').collect::<Vec<_>>();
160-
if parts.len() == 2 {
161-
let algorithm = parts[0];
162-
let encryption_key = parts[1];
160+
if parts.len() == 3 {
161+
let sse_type = parts[0];
162+
if sse_type != "SSE-C" {
163+
return Err("Only SSE-C is supported for object encryption for now".into());
164+
}
165+
166+
let algorithm = parts[1];
167+
let encryption_key = parts[2];
163168

164169
let alg = ObjectEncryptionAlgorithm::from_str(algorithm)?;
165170

@@ -170,7 +175,7 @@ impl FromStr for ObjectSse {
170175
},
171176
})
172177
} else {
173-
Err("Expected <algorithm>:<base64_encryption_key>".into())
178+
Err("Expected SSE-C:AES256:<base64_encryption_key>".into())
174179
}
175180
}
176181
}

0 commit comments

Comments
 (0)