key vault 创建导入OCT-HSM密钥异常
- createOctKey
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"}}"
- importKey
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."}}"