diff --git a/sdk/storage/azure-storage-blob-cryptography/README.md b/sdk/storage/azure-storage-blob-cryptography/README.md index 9469ca999f2d..b37507267dd7 100644 --- a/sdk/storage/azure-storage-blob-cryptography/README.md +++ b/sdk/storage/azure-storage-blob-cryptography/README.md @@ -6,6 +6,8 @@ Unstructured data is data that does not adhere to a particular data model or definition, such as text or binary data. This package supports client side encryption for blob storage. +[Source code][source] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] | [Samples][samples] + ## Getting started ### Prerequisites @@ -120,7 +122,7 @@ The following sections provide several code snippets covering some of the most c Create an `EncryptedBlobClient` using a `BlobClient`. `BlobClient` construction is explained in the `azure-storage-blob` README. - + ```java EncryptedBlobClient client = new EncryptedBlobClientBuilder() .key(key, keyWrapAlgorithm) @@ -133,18 +135,20 @@ EncryptedBlobClient client = new EncryptedBlobClientBuilder() Create a `BlobServiceClient` using a connection string. - + ```java EncryptedBlobClient client = new EncryptedBlobClientBuilder() .key(key, keyWrapAlgorithm) .keyResolver(keyResolver) .connectionString(connectionString) + .containerName(containerName) + .blobName(blobName) .buildEncryptedBlobClient(); ``` ### Use a local `KeyEncryptionKey` - + ```java JsonWebKey localKey = JsonWebKey.fromAes(new SecretKeySpec(keyBytes, secretKeyAlgorithm), Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY)) @@ -155,12 +159,14 @@ AsyncKeyEncryptionKey akek = new KeyEncryptionKeyClientBuilder() EncryptedBlobClient client = new EncryptedBlobClientBuilder() .key(akek, keyWrapAlgorithm) .connectionString(connectionString) + .containerName(containerName) + .blobName(blobName) .buildEncryptedBlobClient(); ``` ### Use a `KeyVaultKey` - + ```java KeyClient keyClient = new KeyClientBuilder() .vaultUrl(keyVaultUrl) @@ -177,6 +183,8 @@ AsyncKeyEncryptionKey akek = new KeyEncryptionKeyClientBuilder() EncryptedBlobClient client = new EncryptedBlobClientBuilder() .key(akek, keyWrapAlgorithm) .connectionString(connectionString) + .containerName(containerName) + .blobName(blobName) .buildEncryptedBlobClient(); ``` @@ -214,3 +222,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope [storage_account_create_cli]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli [storage_account_create_portal]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal [sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[source]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/storage/azure-storage-blob-cryptography/src/main/java +[docs]: https://azure.github.io/azure-sdk-for-java/ +[rest_docs]: https://docs.microsoft.com/rest/api/storageservices/blob-service-rest-api +[product_docs]: https://docs.microsoft.com/azure/storage/blobs/storage-blobs-overview +[samples]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/storage/azure-storage-blob-cryptography/src/samples diff --git a/sdk/storage/azure-storage-blob-cryptography/src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java b/sdk/storage/azure-storage-blob-cryptography/src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java index 7d64813e30b8..51de16039eac 100644 --- a/sdk/storage/azure-storage-blob-cryptography/src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java +++ b/sdk/storage/azure-storage-blob-cryptography/src/samples/java/com/azure/storage/blob/specialized/cryptography/ReadmeSamples.java @@ -37,6 +37,8 @@ public class ReadmeSamples { private TokenCredential tokenCredential; private String keyVaultUrl; private String keyName; + private String containerName; + private String blobName; public void getEncryptedBlobClientBlobClient() { EncryptedBlobClient client = new EncryptedBlobClientBuilder() @@ -51,6 +53,8 @@ public void getEncryptedBlobClient() { .key(key, keyWrapAlgorithm) .keyResolver(keyResolver) .connectionString(connectionString) + .containerName(containerName) + .blobName(blobName) .buildEncryptedBlobClient(); } @@ -64,6 +68,8 @@ public void getClientLocalKey() { EncryptedBlobClient client = new EncryptedBlobClientBuilder() .key(akek, keyWrapAlgorithm) .connectionString(connectionString) + .containerName(containerName) + .blobName(blobName) .buildEncryptedBlobClient(); } @@ -83,6 +89,8 @@ public void getClientKeyVaultKey() { EncryptedBlobClient client = new EncryptedBlobClientBuilder() .key(akek, keyWrapAlgorithm) .connectionString(connectionString) + .containerName(containerName) + .blobName(blobName) .buildEncryptedBlobClient(); }