mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-03-11 06:54:14 +00:00
Changed up some of the encoded for the rim byte array
This commit is contained in:
parent
efa2cada2d
commit
8fbd6e1a39
@ -94,6 +94,7 @@ import java.security.interfaces.RSAPublicKey;
|
|||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
import java.security.spec.MGF1ParameterSpec;
|
import java.security.spec.MGF1ParameterSpec;
|
||||||
import java.security.spec.RSAPublicKeySpec;
|
import java.security.spec.RSAPublicKeySpec;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -788,7 +789,7 @@ public abstract class AbstractAttestationCertificateAuthority
|
|||||||
try {
|
try {
|
||||||
support = SupportReferenceManifest.select(referenceManifestManager)
|
support = SupportReferenceManifest.select(referenceManifestManager)
|
||||||
.includeArchived()
|
.includeArchived()
|
||||||
.byHashCode(Hex.encodeHexString(messageDigest.digest(
|
.byHashCode(Base64.getEncoder().encodeToString(messageDigest.digest(
|
||||||
logFile.toByteArray())))
|
logFile.toByteArray())))
|
||||||
.getRIM();
|
.getRIM();
|
||||||
if (support == null) {
|
if (support == null) {
|
||||||
@ -830,7 +831,7 @@ public abstract class AbstractAttestationCertificateAuthority
|
|||||||
try {
|
try {
|
||||||
dbBaseRim = BaseReferenceManifest.select(referenceManifestManager)
|
dbBaseRim = BaseReferenceManifest.select(referenceManifestManager)
|
||||||
.includeArchived()
|
.includeArchived()
|
||||||
.byHashCode(Hex.encodeHexString(messageDigest.digest(
|
.byHashCode(Base64.getEncoder().encodeToString(messageDigest.digest(
|
||||||
swidFile.toByteArray())))
|
swidFile.toByteArray())))
|
||||||
.getRIM();
|
.getRIM();
|
||||||
if (dbBaseRim == null) {
|
if (dbBaseRim == null) {
|
||||||
@ -864,7 +865,7 @@ public abstract class AbstractAttestationCertificateAuthority
|
|||||||
for (ByteString swidFile : dv.getSwidfileList()) {
|
for (ByteString swidFile : dv.getSwidfileList()) {
|
||||||
dbBaseRim = BaseReferenceManifest.select(referenceManifestManager)
|
dbBaseRim = BaseReferenceManifest.select(referenceManifestManager)
|
||||||
.includeArchived()
|
.includeArchived()
|
||||||
.byHashCode(Hex.encodeHexString(messageDigest.digest(
|
.byHashCode(Base64.getEncoder().encodeToString(messageDigest.digest(
|
||||||
swidFile.toByteArray())))
|
swidFile.toByteArray())))
|
||||||
.getRIM();
|
.getRIM();
|
||||||
|
|
||||||
|
@ -413,7 +413,8 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
|
|||||||
for (SwidResource swidRes : resources) {
|
for (SwidResource swidRes : resources) {
|
||||||
supportReferenceManifest = SupportReferenceManifest.select(referenceManifestManager)
|
supportReferenceManifest = SupportReferenceManifest.select(referenceManifestManager)
|
||||||
.byRimHash(swidRes.getHashValue()).getRIM();
|
.byRimHash(swidRes.getHashValue()).getRIM();
|
||||||
if (swidRes.getName().equals(supportReferenceManifest.getFileName())) {
|
if (supportReferenceManifest !=null
|
||||||
|
&& swidRes.getName().equals(supportReferenceManifest.getFileName())) {
|
||||||
referenceManifestValidator.validateSupportRimHash(
|
referenceManifestValidator.validateSupportRimHash(
|
||||||
supportReferenceManifest.getRimBytes(), swidRes.getHashValue());
|
supportReferenceManifest.getRimBytes(), swidRes.getHashValue());
|
||||||
} else {
|
} else {
|
||||||
@ -422,7 +423,7 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
|
|||||||
}
|
}
|
||||||
if (supportReferenceManifest == null) {
|
if (supportReferenceManifest == null) {
|
||||||
fwStatus = new AppraisalStatus(FAIL,
|
fwStatus = new AppraisalStatus(FAIL,
|
||||||
"Support Reference Integrity Manifest\n");
|
"Support Reference Integrity Manifest can not be found\n");
|
||||||
passed = false;
|
passed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package hirs.data.persist;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import org.apache.commons.codec.binary.Hex;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
@ -19,6 +18,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,7 +139,7 @@ public abstract class ReferenceManifest extends ArchivableEntity {
|
|||||||
if (digest == null) {
|
if (digest == null) {
|
||||||
this.rimHash = "";
|
this.rimHash = "";
|
||||||
} else {
|
} else {
|
||||||
this.rimHash = Hex.encodeHexString(
|
this.rimHash = Base64.getEncoder().encodeToString(
|
||||||
digest.digest(rimBytes));
|
digest.digest(rimBytes));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user