Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
468 changes: 464 additions & 4 deletions sdk/keyvault/azure-security-keyvault-keys/CHANGELOG.md

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,22 @@ public static JsonWebKeySignatureAlgorithm fromString(String name) {
public static Collection<JsonWebKeySignatureAlgorithm> values() {
return values(JsonWebKeySignatureAlgorithm.class);
}

/**
* HMAC using SHA-256, as described in https://tools.ietf.org/html/rfc7518.
*/
@Generated
public static final JsonWebKeySignatureAlgorithm HS256 = fromString("HS256");

/**
* HMAC using SHA-384, as described in https://tools.ietf.org/html/rfc7518.
*/
@Generated
public static final JsonWebKeySignatureAlgorithm HS384 = fromString("HS384");

/**
* HMAC using SHA-512, as described in https://tools.ietf.org/html/rfc7518.
*/
@Generated
public static final JsonWebKeySignatureAlgorithm HS512 = fromString("HS512");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.security.keyvault.keys.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.azure.core.util.Base64Url;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.Objects;

/**
* The key attestation information.
*/
@Immutable
public final class KeyAttestation implements JsonSerializable<KeyAttestation> {
/*
* A base64url-encoded string containing certificates in PEM format, used for attestation validation.
*/
@Generated
private Base64Url certificatePemFile;

/*
* The attestation blob bytes encoded as base64url string corresponding to a private key.
*/
@Generated
private Base64Url privateKeyAttestation;

/*
* The attestation blob bytes encoded as base64url string corresponding to a public key in case of asymmetric key.
*/
@Generated
private Base64Url publicKeyAttestation;

/*
* The version of the attestation.
*/
@Generated
private String version;

/**
* Creates an instance of KeyAttestation class.
*/
@Generated
private KeyAttestation() {
}

/**
* Get the certificatePemFile property: A base64url-encoded string containing certificates in PEM format, used for
* attestation validation.
*
* @return the certificatePemFile value.
*/
@Generated
public byte[] getCertificatePemFile() {
if (this.certificatePemFile == null) {
return null;
}
return this.certificatePemFile.decodedBytes();
}

/**
* Get the privateKeyAttestation property: The attestation blob bytes encoded as base64url string corresponding to a
* private key.
*
* @return the privateKeyAttestation value.
*/
@Generated
public byte[] getPrivateKeyAttestation() {
if (this.privateKeyAttestation == null) {
return null;
}
return this.privateKeyAttestation.decodedBytes();
}

/**
* Get the publicKeyAttestation property: The attestation blob bytes encoded as base64url string corresponding to a
* public key in case of asymmetric key.
*
* @return the publicKeyAttestation value.
*/
@Generated
public byte[] getPublicKeyAttestation() {
if (this.publicKeyAttestation == null) {
return null;
}
return this.publicKeyAttestation.decodedBytes();
}

/**
* Get the version property: The version of the attestation.
*
* @return the version value.
*/
@Generated
public String getVersion() {
return this.version;
}

/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("certificatePemFile", Objects.toString(this.certificatePemFile, null));
jsonWriter.writeStringField("privateKeyAttestation", Objects.toString(this.privateKeyAttestation, null));
jsonWriter.writeStringField("publicKeyAttestation", Objects.toString(this.publicKeyAttestation, null));
jsonWriter.writeStringField("version", this.version);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of KeyAttestation from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of KeyAttestation if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IOException If an error occurs while reading the KeyAttestation.
*/
@Generated
public static KeyAttestation fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
KeyAttestation deserializedKeyAttestation = new KeyAttestation();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("certificatePemFile".equals(fieldName)) {
deserializedKeyAttestation.certificatePemFile
= reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString()));
} else if ("privateKeyAttestation".equals(fieldName)) {
deserializedKeyAttestation.privateKeyAttestation
= reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString()));
} else if ("publicKeyAttestation".equals(fieldName)) {
deserializedKeyAttestation.publicKeyAttestation
= reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString()));
} else if ("version".equals(fieldName)) {
deserializedKeyAttestation.version = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedKeyAttestation;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,29 @@ public static KeyAttributes fromJson(JsonReader jsonReader) throws IOException {
deserializedKeyAttributes.exportable = reader.getNullable(JsonReader::getBoolean);
} else if ("hsmPlatform".equals(fieldName)) {
deserializedKeyAttributes.hsmPlatform = reader.getString();
} else if ("attestation".equals(fieldName)) {
deserializedKeyAttributes.attestation = KeyAttestation.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedKeyAttributes;
});
}

/*
* The key or key version attestation information.
*/
@Generated
private KeyAttestation attestation;

/**
* Get the attestation property: The key or key version attestation information.
*
* @return the attestation value.
*/
@Generated
public KeyAttestation getAttestation() {
return this.attestation;
}
}
7 changes: 3 additions & 4 deletions sdk/keyvault/azure-security-keyvault-keys/tsp-location.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
directory: specification/keyvault/Security.KeyVault.Keys
commit: a0eb4f02951e8b7dd80e72e108b9cf7618718bc9
commit: 21ffc3434a86c2363e7bcdb1217d36b98ca36280
repo: Azure/azure-rest-api-specs
cleanup: true
additionalDirectories:
- specification/keyvault/Security.KeyVault.Common/
additionalDirectories:
- specification/keyvault/Security.KeyVault.Common