Azure 存儲(chǔ) blob,使用客戶端加密上傳 blob,使用 CEK 和 KEK?,F(xiàn)在嘗試在客戶端使用 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 存儲(chǔ) blob,使用客戶端加密上傳 blob,使用 CEK 和 KEK?,F(xiàn)在嘗試在客戶端使用 KEK 下載解密的文件。但文件已下載但未解密。僅顯示加密文件。
1 回答

守候你守候我
TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊
請(qǐng)將下載方式改為:
blob.downloadToFile("C:\\Users\\kashyap\\Downloads\\abc.txt", null, uploadOptions, null);
您可以看到我上傳到 azure blob 的圖片已損壞:
但是當(dāng)我用這個(gè)方法下載時(shí),它又變回圖片了:
添加回答
舉報(bào)
0/150
提交
取消