Key Vault createOctKey Error importKey Error
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."}}"