Key Vault createOctKey Error importKey Error

祎 李 20 Reputation points
2024-07-02T08:39:26.9+00:00

What is the reason for the failure of OCT-HSM?

1.createOctKey sample code:

CreateOctKeyOptions testKey = new CreateOctKeyOptions("testOctKey")

.setKeySize(128)

.setHardwareProtected(true);

KeyVaultKey octKey = keyClient.createOctKey(testKey);

ERROR: Status code 400, "{"error":{"code":"BadParameter","message":"Property has invalid value\r\n"}}"

2.importKey sample code:

byte[] key = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};

SecretKey secretKeySpec = new SecretKeySpec(key, "AES");

JsonWebKey jsonWebKey =

JsonWebKey.fromAes(secretKeySpec, Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY));

ImportKeyOptions importKeyOptions = new ImportKeyOptions("teatOctKey", jsonWebKey).setHardwareProtected(true);

KeyVaultKey teatOctKey = keyClient.importKey(importKeyOptions);

ERROR: Status code 400, "{"error":{"code":"BadParameter","message":"The property "key" must be a valid JsonWebKey object."}}"

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,810 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.