mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-02-06 19:19:59 +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 existingCredential =
|
||||||
PlatformCredential.select(certificateManager)
|
PlatformCredential.select(certificateManager)
|
||||||
.byHashCode(platformCredential.getCertificateHash()).getCertificate();
|
.includeArchived()
|
||||||
|
.byHashCode(platformCredential
|
||||||
|
.getCertificateHash())
|
||||||
|
.getCertificate();
|
||||||
if (existingCredential == null) {
|
if (existingCredential == null) {
|
||||||
if (platformCredential.getPlatformSerial() != null) {
|
if (platformCredential.getPlatformSerial() != null) {
|
||||||
List<PlatformCredential> certificates = PlatformCredential
|
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
|
// if an identical certificate is archived, update the existing certificate to
|
||||||
// unarchive it and change the creation date
|
// unarchive it and change the creation date
|
||||||
if (existingCertificate.isArchived()) {
|
if (existingCertificate.isArchived()) {
|
||||||
|
|
||||||
existingCertificate.restore();
|
existingCertificate.restore();
|
||||||
existingCertificate.resetCreateTime();
|
existingCertificate.resetCreateTime();
|
||||||
certificateManager.update(existingCertificate);
|
certificateManager.update(existingCertificate);
|
||||||
|
@ -86,4 +86,14 @@ public abstract class AbstractEntity {
|
|||||||
}
|
}
|
||||||
return this.hashCode() == obj.hashCode();
|
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() {
|
public final String getArchivedDescription() {
|
||||||
return this.archivedDescription;
|
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);
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Certificate{"
|
return String.format("Certificate{%s, AuthID=%s, serialNumber=%s, "
|
||||||
+ ", serialNumber=" + serialNumber
|
+ "issuer=%s, AuthSerialNumber=%s, publicKeySize=%d, "
|
||||||
+ ", issuer='" + issuer + '\''
|
+ "signatureAlg=%s, Hash=%d}", super.toString(),
|
||||||
+ '}';
|
authorityKeyIdentifier, serialNumber.toString(),
|
||||||
|
issuer, authoritySerialNumber.toString(), publicKeySize,
|
||||||
|
signatureAlgorithm, certificateHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,4 +70,15 @@ public abstract class DeviceAssociatedCertificate extends Certificate {
|
|||||||
public void setDevice(final Device device) {
|
public void setDevice(final Device device) {
|
||||||
this.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…
x
Reference in New Issue
Block a user