Skip to content

Commit

Permalink
Merge branch 'main' into v3_issue_896-add-platform-certificate-class-…
Browse files Browse the repository at this point in the history
…registry-support-to-the-aca
  • Loading branch information
ThatSilentCoder committed Feb 13, 2025
2 parents 1892075 + 9c0ff03 commit 3cbaa26
Show file tree
Hide file tree
Showing 20 changed files with 329 additions and 640 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public class TPMInfo implements Serializable {
@Column(nullable = true)
private short tpmVersionRevMinor;

/**
* identity certificate for the device.
*/
@Getter
@XmlElement
@XmlJavaTypeAdapter(X509CertificateAdapter.class)
@Lob
Expand Down Expand Up @@ -178,15 +182,6 @@ public TPMInfo() {
identityCertificate = null;
}

/**
* Used to retrieve the identity certificate for the device.
*
* @return a byte array holding the certificate information
*/
public X509Certificate getIdentityCertificate() {
return identityCertificate;
}

private void setIdentityCertificate(
final X509Certificate identityCertificate) {
if (identityCertificate == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import hirs.structs.elements.Struct;
import hirs.structs.elements.StructElementLength;
import hirs.structs.elements.StructElements;
import lombok.Getter;

import java.util.Arrays;

Expand All @@ -16,75 +17,63 @@
"deviceInfoReportLength", "deviceInfoReport"})
public class IdentityRequestEnvelope implements Struct {

/**
* the length of the identity request blob.
*/
@Getter
@StructElementLength(fieldName = "request")
private int requestLength;

private byte[] request;

/**
* the length of the endorsementCredentialModulus blob.
*/
@Getter
@StructElementLength(fieldName = "endorsementCredentialModulus")
private int endorsementCredentialModulusLength;

private byte[] endorsementCredentialModulus;

/**
* the length of the endorsementCredential blob.
*/
@Getter
@StructElementLength(fieldName = "endorsementCredential")
private int endorsementCredentialLength;

private byte[] endorsementCredential;

/**
* the length of the device info report.
*/
@Getter
@StructElementLength(fieldName = "deviceInfoReport")
private int deviceInfoReportLength;

private byte[] deviceInfoReport;

/**
* @return the length of the identity request blob.
*/
public int getRequestLength() {
return requestLength;
}

/**
* @return the identity request.
*/
public byte[] getRequest() {
return Arrays.copyOf(request, request.length);
}

/**
* @return the length of the endorsementCredentialModulus blob
*/
public int getEndorsementCredentialModulusLength() {
return endorsementCredentialModulusLength;
}

/**
* @return the endorsementCredentialModulus blob.
*/
public byte[] getEndorsementCredentialModulus() {
return Arrays.copyOf(endorsementCredentialModulus, endorsementCredentialModulus.length);
}

/**
* @return the length of the endorsementCredential blob
*/
public int getEndorsementCredentialLength() {
return endorsementCredentialLength;
}

/**
* @return the endorsementCredential
*/
public byte[] getEndorsementCredential() {
return Arrays.copyOf(endorsementCredential, endorsementCredential.length);
}

/**
* @return the length of the device info report
*/
public int getDeviceInfoReportLength() {
return deviceInfoReportLength;
}

/**
* @return the device info report
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import hirs.structs.elements.Struct;
import hirs.structs.elements.StructElementLength;
import hirs.structs.elements.StructElements;
import lombok.Getter;

import java.util.Arrays;

Expand All @@ -13,11 +14,19 @@
"symmetricAttestation"})
public class IdentityResponseEnvelope implements Struct {

/**
* the asymmetric contents block size.
*/
@Getter
@StructElementLength(fieldName = "asymmetricContents")
private int asymmetricContentsSize;

private byte[] asymmetricContents;

/**
* the symmetric attestation.
*/
@Getter
private SymmetricAttestation symmetricAttestation;

/**
Expand All @@ -29,21 +38,4 @@ public byte[] getAsymmetricContents() {
return Arrays.copyOf(asymmetricContents, asymmetricContents.length);
}

/**
* Gets the asymmetric contents block size.
*
* @return the asymmetric contents block size
*/
public int getAsymmetricContentsSize() {
return asymmetricContentsSize;
}

/**
* Gets the symmetric attestation.
*
* @return the symmetric attestation.
*/
public SymmetricAttestation getSymmetricAttestation() {
return symmetricAttestation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import hirs.structs.elements.StructElementLength;
import hirs.structs.elements.StructElements;
import hirs.structs.elements.tpm.SymmetricKeyParams;
import lombok.Getter;

import java.util.Arrays;

Expand All @@ -15,30 +16,20 @@
@StructElements(elements = {"credentialSize", "algorithm", "credential"})
public class SymmetricAttestation implements Struct {

/**
* the size of the credential block.
*/
@Getter
@StructElementLength(fieldName = "credential")
private int credentialSize;

private SymmetricKeyParams algorithm;

private byte[] credential;

/**
* Gets the credential block size.
*
* @return the size of the credential block
* the algorithm and other meta data regarding the key.
*/
public int getCredentialSize() {
return credentialSize;
}
@Getter
private SymmetricKeyParams algorithm;

/**
* Gets the key parameters for the credential.
*
* @return the algorithm and other meta data regarding the key
*/
public SymmetricKeyParams getAlgorithm() {
return algorithm;
}
private byte[] credential;

/**
* Gets the credential block.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,41 @@
import hirs.structs.elements.Struct;
import hirs.structs.elements.StructElementLength;
import hirs.structs.elements.StructElements;
import lombok.Getter;

/**
* As defined in TCPA 4.20, the key parameters data structure describes the parameters used to
* generate a key pair and to store the parts of a key.
*/
@Getter
@StructElements(elements = {"algorithmId", "encryptionScheme", "signatureScheme", "paramsSize",
"params"})
public class AsymmetricKeyParams implements Struct {

private int algorithmId;

private short encryptionScheme;

private short signatureScheme;

@StructElementLength(fieldName = "params")
private int paramsSize;

private RsaSubParams params;

/**
* @return the key algorithm
* the key algorithm.
*/
public int getAlgorithmId() {
return algorithmId;
}
private int algorithmId;

/**
* @return the size of the params field
* the encryption scheme that the key uses.
*/
public int getParamsSize() {
return paramsSize;
}
private short encryptionScheme;

/**
* @return the encryption scheme that the key uses
* the signature scheme that the key uses to perform digital signatures.
*/
public short getEncryptionScheme() {
return encryptionScheme;
}
private short signatureScheme;

/**
* @return the signature scheme that the key uses to perform digital signatures
* the size of the params field.
*/
public short getSignatureScheme() {
return signatureScheme;
}
@StructElementLength(fieldName = "params")
private int paramsSize;

/**
* @return parameter information dependant upon the key algorithm.
* parameter information dependant upon the key algorithm.
*/
public RsaSubParams getParams() {
return params;
}
private RsaSubParams params;

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

import hirs.structs.elements.Struct;
import hirs.structs.elements.StructElements;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
* As specified in TCPA Main Specification section 4.27.3. This structure contains the public
* portion of an asymmetric key pair. It contains all the information necessary for it's unambiguous
* usage.
*/
@Getter
@NoArgsConstructor
@StructElements(elements = {"asymmetricKeyParams", "storePubKey"})
public class AsymmetricPublicKey implements Struct {

Expand Down Expand Up @@ -36,28 +40,14 @@ public class AsymmetricPublicKey implements Struct {
*/
public static final short DEFAULT_RSA_SIGNATURE_SCHEME = 0x1;

private AsymmetricKeyParams asymmetricKeyParams;

private StorePubKey storePubKey;

/**
* Default constructor. This is required for the {@link
* hirs.structs.converters.StructConverter}.
* information regarding this key.
*/
public AsymmetricPublicKey() {
}
private AsymmetricKeyParams asymmetricKeyParams;

/**
* @return information regarding this key
* the public as described by the key parameters.
*/
public AsymmetricKeyParams getAsymmetricKeyParams() {
return asymmetricKeyParams;
}
private StorePubKey storePubKey;

/**
* @return the public as described by the key parameters.
*/
public StorePubKey getStorePubKey() {
return storePubKey;
}
}
Loading

0 comments on commit 3cbaa26

Please sign in to comment.