public async Task AppendBlockFromUriAsync_CPK() { await using DisposingContainer test = await GetTestContainerAsync(); // Arrange await test.Container.SetAccessPolicyAsync(PublicAccessType.BlobContainer); var data = GetRandomBuffer(Constants.KB); using (var stream = new MemoryStream(data)) { AppendBlobClient sourceBlob = InstrumentClient(test.Container.GetAppendBlobClient(GetNewBlobName())); await sourceBlob.CreateAsync(); await sourceBlob.AppendBlockAsync(stream); AppendBlobClient destBlob = InstrumentClient(test.Container.GetAppendBlobClient(GetNewBlobName())); CustomerProvidedKey customerProvidedKey = GetCustomerProvidedKey(); destBlob = InstrumentClient(destBlob.WithCustomerProvidedKey(customerProvidedKey)); await destBlob.CreateAsync(); // Act Response <BlobAppendInfo> response = await destBlob.AppendBlockFromUriAsync( sourceBlob.Uri, new HttpRange(0, Constants.KB)); Assert.AreEqual(customerProvidedKey.EncryptionKeyHash, response.Value.EncryptionKeySha256); } }
public async Task CreateAsync_CPK() { await using DisposingContainer test = await GetTestContainerAsync(); // Arrange var blobName = GetNewBlobName(); AppendBlobClient blob = InstrumentClient(test.Container.GetAppendBlobClient(blobName)); CustomerProvidedKey customerProvidedKey = GetCustomerProvidedKey(); blob = InstrumentClient(blob.WithCustomerProvidedKey(customerProvidedKey)); // Act Response <BlobContentInfo> response = await blob.CreateAsync(); // Assert Assert.AreEqual(customerProvidedKey.EncryptionKeyHash, response.Value.EncryptionKeySha256); }
public async Task AppendBlockAsync_CPK() { await using DisposingContainer test = await GetTestContainerAsync(); // Arrange var blobName = GetNewBlobName(); AppendBlobClient blob = InstrumentClient(test.Container.GetAppendBlobClient(blobName)); CustomerProvidedKey customerProvidedKey = GetCustomerProvidedKey(); blob = InstrumentClient(blob.WithCustomerProvidedKey(customerProvidedKey)); var data = GetRandomBuffer(Constants.KB); await blob.CreateAsync(); // Act using var stream = new MemoryStream(data); Response <BlobAppendInfo> response = await blob.AppendBlockAsync( content : stream); // Assert Assert.AreEqual(customerProvidedKey.EncryptionKeyHash, response.Value.EncryptionKeySha256); }