Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.

Commit 4dde14e

Browse files
authored
Fix Key Vault - Keys Samples Issue (Azure#38319)
* Fix Key Vault - Keys Samples Issue * Fix ci error
1 parent 2291b6f commit 4dde14e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sdk/keyvault/azure-security-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public void signVerify() throws NoSuchAlgorithmException {
209209
signResponse.getAlgorithm());
210210
// END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte-Context
211211

212-
byte[] signature = new byte[100];
212+
byte[] signature = signResult.getSignature();
213213

214214
// BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte
215215
byte[] myData = new byte[100];
@@ -224,7 +224,7 @@ public void signVerify() throws NoSuchAlgorithmException {
224224
System.out.printf("Verification status: %s.%n", verifyResult.isValid());
225225
// END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte
226226

227-
byte[] signatureBytes = new byte[100];
227+
byte[] signatureBytes = signResponse.getSignature();
228228

229229
// BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte-Context
230230
byte[] dataBytes = new byte[100];
@@ -308,7 +308,7 @@ public void signDataVerifyData() throws NoSuchAlgorithmException {
308308
CryptographyClient cryptographyClient = createClient();
309309

310310
// BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte
311-
byte[] data = new byte[100];
311+
byte[] data = new byte[32];
312312
new Random(0x1234567L).nextBytes(data);
313313

314314
SignResult signResult = cryptographyClient.sign(SignatureAlgorithm.ES256, data);
@@ -318,7 +318,7 @@ public void signDataVerifyData() throws NoSuchAlgorithmException {
318318
// END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte
319319

320320
// BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte-Context
321-
byte[] plainTextData = new byte[100];
321+
byte[] plainTextData = new byte[32];
322322
new Random(0x1234567L).nextBytes(plainTextData);
323323

324324
SignResult signingResult = cryptographyClient.sign(SignatureAlgorithm.ES256, plainTextData);
@@ -327,10 +327,10 @@ public void signDataVerifyData() throws NoSuchAlgorithmException {
327327
signingResult.getSignature().length, new Context("key1", "value1"));
328328
// END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte-Context
329329

330-
byte[] signature = new byte[100];
330+
byte[] signature = signResult.getSignature();
331331

332332
// BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte
333-
byte[] myData = new byte[100];
333+
byte[] myData = new byte[32];
334334
new Random(0x1234567L).nextBytes(myData);
335335

336336
// A signature can be obtained from the SignResult returned by the CryptographyClient.sign() operation.
@@ -339,10 +339,10 @@ public void signDataVerifyData() throws NoSuchAlgorithmException {
339339
System.out.printf("Verification status: %s.%n", verifyResult.isValid());
340340
// END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte
341341

342-
byte[] mySignature = new byte[100];
342+
byte[] mySignature = signingResult.getSignature();
343343

344344
// BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte-Context
345-
byte[] dataToVerify = new byte[100];
345+
byte[] dataToVerify = new byte[32];
346346
new Random(0x1234567L).nextBytes(dataToVerify);
347347

348348
// A signature can be obtained from the SignResult returned by the CryptographyClient.sign() operation.

0 commit comments

Comments
 (0)