Skip to content

Commit 3f3f7b7

Browse files
LWChrisheaths
andauthored
Update Sample5_SignVerify.md (Azure#18590)
* Update Sample5_SignVerify.md Renamed variabled `rsaKey` and `ecKey` to `...KeyOptions`, to better illustrate that the object does not hold the key but the config options that tell the `keyClient` how to create the new key. * Rename variables to better illustrate the actual referenced objects Rename variable `rsaKey` to `rsaKeyOptions` since that object does not hold the key but the options which tell the keyClient how to create the new RSA key. Rename `cloudRsaKey` to `rsaKey` since that variable contains a reference to a key object. Both changes analogous for EC keys. * Update Sample5_SignVerify.md Co-authored-by: Heath Stewart <heaths@microsoft.com>
1 parent 3d0536d commit 3f3f7b7

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

sdk/keyvault/Azure.Security.KeyVault.Keys/samples/Sample5_SignVerify.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,32 @@ First, we'll create both an RSA key and an EC key which will be used to sign and
2020

2121
```C# Snippet:KeysSample5CreateKey
2222
string rsaKeyName = $"CloudRsaKey-{Guid.NewGuid()}";
23-
var rsaKey = new CreateRsaKeyOptions(rsaKeyName, hardwareProtected: false)
23+
var rsaKeyOptions = new CreateRsaKeyOptions(rsaKeyName, hardwareProtected: false)
2424
{
2525
KeySize = 2048,
2626
};
2727

2828
string ecKeyName = $"CloudEcKey-{Guid.NewGuid()}";
29-
var ecKey = new CreateEcKeyOptions(ecKeyName, hardwareProtected: false)
29+
var ecKeyOptions = new CreateEcKeyOptions(ecKeyName, hardwareProtected: false)
3030
{
3131
CurveName = KeyCurveName.P256K,
3232
};
3333

34-
KeyVaultKey cloudRsaKey = keyClient.CreateRsaKey(rsaKey);
35-
Debug.WriteLine($"Key is returned with name {cloudRsaKey.Name} and type {cloudRsaKey.KeyType}");
34+
KeyVaultKey rsaKey = keyClient.CreateRsaKey(rsaKeyOptions);
35+
Debug.WriteLine($"Key is returned with name {rsaKey.Name} and type {rsaKey.KeyType}");
3636

37-
KeyVaultKey cloudEcKey = keyClient.CreateEcKey(ecKey);
38-
Debug.WriteLine($"Key is returned with name {cloudEcKey.Name} and type {cloudEcKey.KeyType}");
37+
KeyVaultKey ecKey = keyClient.CreateEcKey(ecKeyOptions);
38+
Debug.WriteLine($"Key is returned with name {ecKey.Name} and type {ecKey.KeyType}");
3939
```
4040

4141
## Creating CryptographyClients
4242

4343
Then, we create the `CryptographyClient` which can perform cryptographic operations with the key we just created using the same credential created above.
4444

4545
```C# Snippet:KeysSample5CryptographyClient
46-
var rsaCryptoClient = new CryptographyClient(cloudRsaKey.Id, new DefaultAzureCredential());
46+
var rsaCryptoClient = new CryptographyClient(rsaKey.Id, new DefaultAzureCredential());
4747

48-
var ecCryptoClient = new CryptographyClient(cloudEcKey.Id, new DefaultAzureCredential());
48+
var ecCryptoClient = new CryptographyClient(ecKey.Id, new DefaultAzureCredential());
4949
```
5050

5151
## Signing keys with the Sign and Verify methods

sdk/keyvault/Azure.Security.KeyVault.Keys/tests/samples/Sample5_SignVerify.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@ public void SignVerifySync()
3434

3535
#region Snippet:KeysSample5CreateKey
3636
string rsaKeyName = $"CloudRsaKey-{Guid.NewGuid()}";
37-
var rsaKey = new CreateRsaKeyOptions(rsaKeyName, hardwareProtected: false)
37+
var rsaKeyOptions = new CreateRsaKeyOptions(rsaKeyName, hardwareProtected: false)
3838
{
3939
KeySize = 2048,
4040
};
4141

4242
string ecKeyName = $"CloudEcKey-{Guid.NewGuid()}";
43-
var ecKey = new CreateEcKeyOptions(ecKeyName, hardwareProtected: false)
43+
var ecKeyOptions = new CreateEcKeyOptions(ecKeyName, hardwareProtected: false)
4444
{
4545
CurveName = KeyCurveName.P256K,
4646
};
4747

48-
KeyVaultKey cloudRsaKey = keyClient.CreateRsaKey(rsaKey);
49-
Debug.WriteLine($"Key is returned with name {cloudRsaKey.Name} and type {cloudRsaKey.KeyType}");
48+
KeyVaultKey rsaKey = keyClient.CreateRsaKey(rsaKeyOptions);
49+
Debug.WriteLine($"Key is returned with name {rsaKey.Name} and type {rsaKey.KeyType}");
5050

51-
KeyVaultKey cloudEcKey = keyClient.CreateEcKey(ecKey);
52-
Debug.WriteLine($"Key is returned with name {cloudEcKey.Name} and type {cloudEcKey.KeyType}");
51+
KeyVaultKey ecKey = keyClient.CreateEcKey(ecKeyOptions);
52+
Debug.WriteLine($"Key is returned with name {ecKey.Name} and type {ecKey.KeyType}");
5353
#endregion
5454

5555
#region Snippet:KeysSample5CryptographyClient
56-
var rsaCryptoClient = new CryptographyClient(cloudRsaKey.Id, new DefaultAzureCredential());
56+
var rsaCryptoClient = new CryptographyClient(rsaKey.Id, new DefaultAzureCredential());
5757

58-
var ecCryptoClient = new CryptographyClient(cloudEcKey.Id, new DefaultAzureCredential());
58+
var ecCryptoClient = new CryptographyClient(ecKey.Id, new DefaultAzureCredential());
5959
#endregion
6060

6161
#region Snippet:KeysSample5SignKey

0 commit comments

Comments
 (0)