return res;
}
+// dummy routine does not really prepare for decrypt, juste sets
+// crypt_http_responses (for RGWCompleteMultipart)
+int rgw_s3_prepare_decrypt(req_state* s,
+ map<string, bufferlist>& attrs,
+ std::map<std::string, std::string>& crypt_http_responses)
+{
+ // RGWDecryptContext cb(s);
+ int res = 0;
+ std::string stored_mode = get_str_attribute(attrs, RGW_ATTR_CRYPT_MODE);
+ ldpp_dout(s, 15) << "Encryption mode: " << stored_mode << dendl;
+ if (stored_mode == "SSE-C-AES256") {
+ auto keymd5 = to_base64(get_str_attribute(attrs, RGW_ATTR_CRYPT_KEYMD5));
+ crypt_http_responses["x-amz-server-side-encryption-customer-algorithm"] = "AES256";
+ crypt_http_responses["x-amz-server-side-encryption-customer-key-MD5"] = keymd5;
+ return 0;
+ }
+ if (stored_mode == "SSE-KMS") {
+ std::string key_id = get_str_attribute(attrs, RGW_ATTR_CRYPT_KEYID);
+ crypt_http_responses["x-amz-server-side-encryption"] = "aws:kms";
+ crypt_http_responses["x-amz-server-side-encryption-aws-kms-key-id"] = key_id;
+ return 0;
+ }
+ if (stored_mode == "RGW-AUTO") {
+ return 0;
+ }
+ if (stored_mode == "AES256") {
+ crypt_http_responses["x-amz-server-side-encryption"] = "AES256";
+ return 0;
+ }
+ /*no decryption*/
+ return 0;
+}
+
int rgw_remove_sse_s3_bucket_key(req_state *s, optional_yield y)
{
int res;
std::map<std::string,
std::string>& crypt_http_responses);
+int rgw_s3_prepare_decrypt(req_state *s,
+ std::map<std::string, ceph::bufferlist>& attrs,
+ std::map<std::string,
+ std::string>& crypt_http_responses);
+
static inline void set_attr(std::map<std::string, bufferlist>& attrs,
const char* key,
std::string_view value)
auto& target_attrs = meta_obj->get_attrs();
+ (void) rgw_s3_prepare_decrypt(s, target_attrs, crypt_http_responses);
+
if (cksum) {
/* validate computed checksum against supplied checksum, if present */
auto [hdr_cksum, supplied_cksum] =
std::optional<rgw::cksum::Cksum> cksum;
std::optional<std::string> armored_cksum;
off_t ofs = 0;
+ std::map<std::string, std::string> crypt_http_responses;
public:
RGWCompleteMultipart() {}
if (op_ret)
set_req_state_err(s, op_ret);
dump_errno(s);
+ for (auto &it : crypt_http_responses)
+ dump_header(s, it.first, it.second);
dump_header_if_nonempty(s, "x-amz-version-id", version_id);
end_header(s, this, to_mime_type(s->format));
if (op_ret == 0) {