-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customer provided (and managed) key? #322
Comments
Hi @lsong0905 , the customer provided key feature is not implemented in this cpp sdk yet. We can provide in future release if you need. To implement the customer provided key feature, we need to add a few APIs, so that you can provide the key to server side for encryption when uploading and for decryption when downloading. And about the customer managed key, our cpp sdk doesn't need to do anything, you can just configure it on Azure Portal. There's another feature with which you can store the key somewhere and reference it with a name rather than provide it in plaintext everytime you operate on a blob. But I think this feature is not completely ready on server side. I want to know which is the feature you want, so that we can help accordingly. |
@lsong0905 In addition, about the |
@JinmingHu-MSFT Thank you for the reply! Regarding the customer-provided key, can we still specify this in the request header as mentioned here (https://docs.microsoft.com/en-us/rest/api/storageservices/put-blob)? I do not see the request headers for key, algorithm and sha256 defined in constants.dat, but still wonder if it is possible to add them to the header. Also, I have a few question regarding the customer-managed key though. |
As I said in the previous reply, we haven't implemented this feature in current release. If you request it, we'll add it in future release, maybe 7.3.0 I think. As you can see in the link you mentioned, the encryption key is provided in plaintext in header Now there is another new feature, which I think is not completely ready at server side, called CPK-N. In this feature, you store a key in Microsoft Key Vault or somewhere else, and associate it with a name, like key1, key2, key3, etc. Instead of providing the key in plaintext everytime you call an API, you just reference it by its name, in header So which is the feature you really want, CPK or CPK-N, or both? |
@lsong0905 Customer-managed key is a storage-account-scoped setting, you can easily configure it on Azure Portal. Once configured, all new blobs in this storage account are encrypted with the new key instead of the default Microsoft-managed key. Neither our cpp sdk nor your code calling cpp sdk needs to do anything. If you want to configure this via SDK rather than Azure Portal, have a look at SRP SDK here in the |
@JinmingHu-MSFT Thank you for the reply. To answer your question regarding customer provided key, I would say both CPK and CPK-N would be okay with me. My initial plan was CPK. And I know the feature has not been implemented yet as you mentioned. However, if I add optional headers (x-ms-encryption-key, x-ms-encryption-key-sha256 and x-ms-encryption-algorithm) and provide them in plaintext for the REST requests, is it going to apply encryption with the provided headers? And yes. I will reference the link to configure the setting. Thank you. |
Hi @lsong0905 ,
Yes, it's going to work, since the CPK feature is ready at server side long time ago, and it's not complicated, just three new headers. Maybe you need to edit the source code and build the library by yourself. |
@JinmingHu-MSFT Thank you for the help. I will try with CPK and see if I get expected results. It would be nice to have that implemented in future release as well. Plus, is CPK-N will be fully available anytime near future? |
@lsong0905 Yes, CPK-N is around the corner, do you want it in future release as well? |
@JinmingHu-MSFT Yes. That would give us more options for server side encryption. Regarding CPK, I wrote a simple test program and tried uploading blobs with CPK. I am sure I am missing something or probably adding the headers in wrong way, but when I check the uploaded blob, the blob has been uploaded but was NOT encrypted. Here is a code snippet from my test program.
block_blob.upload_from_stream((*iface->m_istream), olen, azure::storage::access_condition(), reqOptions, m_context);` From the azure logging file, I see the request header contains the three headers I added for encryption.
When I ran list command via azure cli, I see the object I uploaded, but its "serverEncrypted" field is set to false, and I was able to download without providing the key. So I assume the blob was not encrypted.
Would you please guide me how to add the additional headers into the request? |
@lsong0905 Your value of header Try |
@JinmingHu-MSFT I still see the same symptom with the value of sha256. The blob has been uploaded without encryption, and I am able to download it without the key.
|
@lsong0905 It works on my side. Here's my test code
Can you check your code against my code and see if there's anything wrong? |
@JinmingHu-MSFT I do not think my code differs much from what you have provided. Is there some change needed to be made in the sdk (7.0.0) before running the code?
|
Update: I was able to apply SSE with CPK without the issue if connected to real backend. The problem is only happening if I connect and run operations via emulator. |
@lsong0905 Seems the emulator doesn't function well |
@JinmingHu-MSFT Thank you for the help! How can I track of the new features (CPK and CPK-N)? |
@lsong0905 The CPK is done, see it here. It will be merged into master branch soon after code review. The CPK-N might still take some time, I'll update this issue if there are any updates. |
BTW, which emulator are you using, Azurite? |
@JinmingHu-MSFT Thank you for the link! And yes. It is Azurite. |
@lsong0905 I just confirmed with my colleague, Azurite doesn't support CPK-V yet. If you need that, you may want to create a feature request on their GitHub repo. |
@JinmingHu-MSFT Okay! I am now testing against the real backend, and if our organization needs to test with Azurite, I will create a feature request on the repo. |
Hello,
As described in the following links
I want to apply and test operations such as upload, download, etc with customer provided key (and customer managed key as well). However, I am having trouble finding a way to provide the key to the sdk unless I am not missing something. I see blob.h has some functions and flags that seem to enable server side encryption such as set_server_encrypted() and server_encrypted(), but no functions to receive the key, specifying the algorithm, its SHA256 value, etc.
Would you please guide me how to apply SSE with customer provided (and managed) key for upload operation?
The sdk version is azure-storage-cpp-7.0.0.
The text was updated successfully, but these errors were encountered: