亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Azure 存儲 blob 客戶端加密不會解密 Java

Azure 存儲 blob 客戶端加密不會解密 Java

holdtom 2023-07-19 10:42:12
Azure 存儲 blob,使用客戶端加密上傳 blob,使用 CEK 和 KEK?,F在嘗試在客戶端使用 KEK 下載解密的文件。但文件已下載但未解密。僅顯示加密文件。public class KeyVaultGettingStarted {    public static void main(String[] args) throws StorageException,            NoSuchAlgorithmException, InterruptedException, ExecutionException,            URISyntaxException, InvalidKeyException, IOException {        Utility.printSampleStartInfo("KeyVaultGettingStarted");        // Get the key ID from Utility if it exists.        String keyID = Utility.keyVaultKeyID;        // If no key ID was specified, we will create a new secret in Key Vault.        // To create a new secret, this client needs full permission to Key        // Vault secrets.        // Once the secret is created, its ID can be added to App.config. Once        // this is done,        // this client only needs read access to secrets.        if (keyID == null || keyID.isEmpty()) {            keyID = KeyVaultUtility.createSecret("KVGettingStartedSecret");        }        // Retrieve storage account information from connection string        // How to create a storage connection string -        // https://azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/        CloudStorageAccount storageAccount = CloudStorageAccount                .parse(Utility.storageConnectionString);        CloudBlobClient client = storageAccount.createCloudBlobClient();        CloudBlobContainer container = client                .getContainerReference("blobencryptioncontainer"                        + UUID.randomUUID().toString().replace("-", ""));        container.createIfNotExists();        // Construct a resolver capable of looking up keys and secrets stored in        // Key Vault.        KeyVaultKeyResolver cloudResolver = new KeyVaultKeyResolver(                KeyVaultUtility.GetKeyVaultClient());}Azure 存儲 blob,使用客戶端加密上傳 blob,使用 CEK 和 KEK。現在嘗試在客戶端使用 KEK 下載解密的文件。但文件已下載但未解密。僅顯示加密文件。
查看完整描述

1 回答

?
守候你守候我

TA貢獻1802條經驗 獲得超10個贊

請將下載方式改為:

blob.downloadToFile("C:\\Users\\kashyap\\Downloads\\abc.txt", null, uploadOptions, null);

您可以看到我上傳到 azure blob 的圖片已損壞:

http://img3.sycdn.imooc.com/64b74dbf0001591804530185.jpg

但是當我用這個方法下載時,它又變回圖片了:

http://img3.sycdn.imooc.com/64b74dcc000147f206260096.jpg

http://img2.sycdn.imooc.com/64b74dd60001afd905720380.jpg


查看完整回答
反對 回復 2023-07-19
  • 1 回答
  • 0 關注
  • 135 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號