rclone icon indicating copy to clipboard operation
rclone copied to clipboard

b2: Add Server-Side encryption support

Open fries1234 opened this issue 11 months ago • 7 comments

What is the purpose of this change?

This commit adds SSE-C (Server-Side Encryption - Customer) support to the B2 native backend. The server uses a customer provided AES-256 key to encrypt the files when you upload them to the bucket, and then it discards your key from the servers RAM after you're done uploading.

The option names and descriptions are based off the S3 backend implementation as the way S3 and B2 does SSE-C is pretty similar.

Was the change discussed in an issue or in the forum before?

I saw it discussed in #6585.

Checklist

  • [x] I have read the contribution guidelines.
  • [x] I have added tests for all changes in this PR if appropriate.
  • [x] I have added documentation for the changes if appropriate.
  • [x] All commit messages are in house style.
  • [x] I'm done, this Pull Request is ready for review :-)

fries1234 avatar Mar 08 '25 07:03 fries1234

just a thought: I wonder if the Base64 string getting converted into a Go UTF-8 string changes the data a tiny bit messing up the md5 hash compared to directly decoding the base64 string and hashing from the binary? I used openssl to generate 32 random bytes for an AES-256 key, which isn't exactly a UTF-8 compatible string.

fries1234 avatar Mar 08 '25 10:03 fries1234

All though thinking about it again, not converting the Base64 string to a Go UTF-8 string internally might break compatibility the rclone S3 backend (even if rclone doesn't officially support B2 as a provider in its s3 backend, it still does work with B2's S3 compatible api if you put the provider as AWS).

fries1234 avatar Mar 08 '25 21:03 fries1234

bump

fries1234 avatar Mar 12 '25 19:03 fries1234

bump 2.0

fries1234 avatar Mar 21 '25 07:03 fries1234

bump 3.0

fries1234 avatar Mar 28 '25 22:03 fries1234

I just ran the integration tests with SSE enabled and they seem to pass!

fries1234 avatar Apr 12 '25 09:04 fries1234

bump

fries1234 avatar Jun 14 '25 08:06 fries1234