Additional updates

This commit is contained in:
Cyrus 2023-12-29 07:20:27 -05:00
parent e75a4c2128
commit bc71285442
2 changed files with 33 additions and 11 deletions

View File

@ -6,18 +6,17 @@ import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.ManyToOne;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
/**
* Represents an issued attestation certificate to a HIRS Client.
*/
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@Entity
public class IssuedAttestationCertificate extends DeviceAssociatedCertificate {
@ -46,8 +45,8 @@ public class IssuedAttestationCertificate extends DeviceAssociatedCertificate {
final List<PlatformCredential> platformCredentials)
throws IOException {
super(certificateBytes);
this.endorsementCredential = endorsementCredential;
this.platformCredentials = platformCredentials;
this.endorsementCredential = new EndorsementCredential(endorsementCredential.getRawBytes());
this.platformCredentials = platformCredentials.stream().toList();
}
/**
@ -64,4 +63,15 @@ public class IssuedAttestationCertificate extends DeviceAssociatedCertificate {
this(readBytes(certificatePath), endorsementCredential, platformCredentials);
}
public EndorsementCredential getEndorsementCredential() {
try {
return new EndorsementCredential(endorsementCredential.getRawBytes());
} catch (IOException ioEx) {
return null;
}
}
public List<PlatformCredential> getPlatformCredentials() {
return Collections.unmodifiableList(platformCredentials);
}
}

View File

@ -1,8 +1,6 @@
package hirs.attestationca.persist.entity.userdefined.certificate.attributes;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.Collections;
@ -15,10 +13,8 @@ import java.util.List;
@AllArgsConstructor
public abstract class PlatformConfiguration {
private List<ComponentIdentifier> componentIdentifier;
@Getter @Setter
private URIReference componentIdentifierUri;
private List<PlatformProperty> platformProperties;
@Getter @Setter
private URIReference platformPropertiesUri;
/**
@ -43,9 +39,25 @@ public abstract class PlatformConfiguration {
public PlatformConfiguration(final List<ComponentIdentifier> componentIdentifier,
final List<PlatformProperty> platformProperties,
final URIReference platformPropertiesUri) {
this.componentIdentifier = componentIdentifier;
this.platformProperties = platformProperties;
this.platformPropertiesUri = platformPropertiesUri;
this.componentIdentifier = componentIdentifier.stream().toList();
this.platformProperties = platformProperties.stream().toList();
this.platformPropertiesUri = new URIReference(platformPropertiesUri.getSequence());
}
public URIReference getComponentIdentifierUri() {
return new URIReference(componentIdentifierUri.getSequence());
}
public void setComponentIdentifierUri(final URIReference componentIdentifierUri) {
this.componentIdentifierUri = new URIReference(componentIdentifierUri.getSequence());
}
public URIReference getPlatformPropertiesUri() {
return new URIReference(platformPropertiesUri.getSequence());
}
public void setPlatformPropertiesUri(final URIReference platformPropertiesUri) {
this.platformPropertiesUri = new URIReference(platformPropertiesUri.getSequence());
}
/**