mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-18 02:39:56 +00:00
* This commit fixes an error produced when provisioning when the certificate from a previous provision is deleted from the ACA. The error involves doing a look up for an existing certificate and getting nothing however this is due to not using the 'includeArchived' attribute for the Certificate Selector. Include Archived is used when manually uploading a certificate.
This commit is contained in:
parent
0f3cfeb7b5
commit
81e13831b2
@ -109,7 +109,10 @@ public final class CredentialManagementHelper {
|
||||
}
|
||||
PlatformCredential existingCredential =
|
||||
PlatformCredential.select(certificateManager)
|
||||
.byHashCode(platformCredential.getCertificateHash()).getCertificate();
|
||||
.includeArchived()
|
||||
.byHashCode(platformCredential
|
||||
.getCertificateHash())
|
||||
.getCertificate();
|
||||
if (existingCredential == null) {
|
||||
if (platformCredential.getPlatformSerial() != null) {
|
||||
List<PlatformCredential> certificates = PlatformCredential
|
||||
|
@ -739,7 +739,6 @@ public class CertificateRequestPageController extends PageController<NoPageParam
|
||||
// if an identical certificate is archived, update the existing certificate to
|
||||
// unarchive it and change the creation date
|
||||
if (existingCertificate.isArchived()) {
|
||||
|
||||
existingCertificate.restore();
|
||||
existingCertificate.resetCreateTime();
|
||||
certificateManager.update(existingCertificate);
|
||||
|
@ -86,4 +86,14 @@ public abstract class AbstractEntity {
|
||||
}
|
||||
return this.hashCode() == obj.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return String.format("UUID=%s, createTime=%s",
|
||||
getId(), getCreateTime().toString());
|
||||
} catch (NullPointerException npEx) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,4 +107,16 @@ public abstract class ArchivableEntity extends AbstractEntity {
|
||||
public final String getArchivedDescription() {
|
||||
return this.archivedDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(super.toString());
|
||||
if (archivedTime != null) {
|
||||
sb.append(String.format(", archivedTime=%s, archiveDescription=%s",
|
||||
archivedTime.toString(), archivedDescription));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
@ -394,4 +394,9 @@ public class Device extends AbstractEntity {
|
||||
return this.name.equals(other.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Device{name=%s, status=%s}",
|
||||
name, supplyChainValidationStatus);
|
||||
}
|
||||
}
|
||||
|
@ -1083,10 +1083,12 @@ public abstract class Certificate extends ArchivableEntity {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Certificate{"
|
||||
+ ", serialNumber=" + serialNumber
|
||||
+ ", issuer='" + issuer + '\''
|
||||
+ '}';
|
||||
return String.format("Certificate{%s, AuthID=%s, serialNumber=%s, "
|
||||
+ "issuer=%s, AuthSerialNumber=%s, publicKeySize=%d, "
|
||||
+ "signatureAlg=%s, Hash=%d}", super.toString(),
|
||||
authorityKeyIdentifier, serialNumber.toString(),
|
||||
issuer, authoritySerialNumber.toString(), publicKeySize,
|
||||
signatureAlgorithm, certificateHash);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,4 +70,15 @@ public abstract class DeviceAssociatedCertificate extends Certificate {
|
||||
public void setDevice(final Device device) {
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(super.toString());
|
||||
if (device != null) {
|
||||
sb.append(String.format("%nDevice -> %s", getDevice().toString()));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user