issue_825: Successfully merged main into this branch

This commit is contained in:
TheSilentCoder 2024-11-15 10:24:38 -05:00
commit 86d2084171
109 changed files with 2063 additions and 3888 deletions

View File

@ -103,7 +103,6 @@ public class BaseReferenceManifest extends ReferenceManifest {
* @param rimBytes byte array representation of the RIM
* @throws IOException if unable to unmarshal the string
*/
@SuppressWarnings("checkstyle:AvoidInlineConditionals")
public BaseReferenceManifest(final String fileName, final byte[] rimBytes)
throws UnmarshalException {
super(rimBytes);
@ -127,9 +126,11 @@ public class BaseReferenceManifest extends ReferenceManifest {
SwidTagConstants.SWIDTAG_NAMESPACE, SwidTagConstants.META).item(0);
setTagId(softwareIdentity.getAttribute(SwidTagConstants.TAGID));
this.swidName = softwareIdentity.getAttribute(SwidTagConstants.NAME);
this.swidCorpus = Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.CORPUS)) ? 1 : 0;
this.swidCorpus =
Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.CORPUS)) ? 1 : 0;
this.setSwidPatch(Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.PATCH)));
this.setSwidSupplemental(Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.SUPPLEMENTAL)));
this.setSwidSupplemental(
Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.SUPPLEMENTAL)));
this.setSwidVersion(softwareIdentity.getAttribute(SwidTagConstants.VERSION));
this.setSwidTagVersion(softwareIdentity.getAttribute(SwidTagConstants.TAGVERSION));
@ -147,20 +148,22 @@ public class BaseReferenceManifest extends ReferenceManifest {
*/
private void parseSoftwareMeta(final Element softwareMeta) {
if (softwareMeta != null) {
this.colloquialVersion = softwareMeta.getAttribute(SwidTagConstants._COLLOQUIAL_VERSION_STR);
this.product = softwareMeta.getAttribute(SwidTagConstants._PRODUCT_STR);
this.revision = softwareMeta.getAttribute(SwidTagConstants._REVISION_STR);
this.edition = softwareMeta.getAttribute(SwidTagConstants._EDITION_STR);
this.rimLinkHash = softwareMeta.getAttribute(SwidTagConstants._RIM_LINK_HASH_STR);
this.bindingSpec = softwareMeta.getAttribute(SwidTagConstants._BINDING_SPEC_STR);
this.bindingSpecVersion = softwareMeta.getAttribute(SwidTagConstants._BINDING_SPEC_VERSION_STR);
this.setPlatformManufacturerId(softwareMeta.getAttribute(SwidTagConstants._PLATFORM_MANUFACTURER_ID_STR));
this.setPlatformManufacturer(softwareMeta.getAttribute(SwidTagConstants._PLATFORM_MANUFACTURER_STR));
this.setPlatformModel(softwareMeta.getAttribute(SwidTagConstants._PLATFORM_MODEL_STR));
this.platformVersion = softwareMeta.getAttribute(SwidTagConstants._PLATFORM_VERSION_STR);
this.payloadType = softwareMeta.getAttribute(SwidTagConstants._PAYLOAD_TYPE_STR);
this.pcURIGlobal = softwareMeta.getAttribute(SwidTagConstants._PC_URI_GLOBAL_STR);
this.pcURILocal = softwareMeta.getAttribute(SwidTagConstants._PC_URI_LOCAL_STR);
this.colloquialVersion = softwareMeta.getAttribute(SwidTagConstants.COLLOQUIAL_VERSION_STR);
this.product = softwareMeta.getAttribute(SwidTagConstants.PRODUCT_STR);
this.revision = softwareMeta.getAttribute(SwidTagConstants.REVISION_STR);
this.edition = softwareMeta.getAttribute(SwidTagConstants.EDITION_STR);
this.rimLinkHash = softwareMeta.getAttribute(SwidTagConstants.RIM_LINK_HASH_STR);
this.bindingSpec = softwareMeta.getAttribute(SwidTagConstants.BINDING_SPEC_STR);
this.bindingSpecVersion = softwareMeta.getAttribute(SwidTagConstants.BINDING_SPEC_VERSION_STR);
this.setPlatformManufacturerId(
softwareMeta.getAttribute(SwidTagConstants.PLATFORM_MANUFACTURER_ID_STR));
this.setPlatformManufacturer(
softwareMeta.getAttribute(SwidTagConstants.PLATFORM_MANUFACTURER_FULL_STR));
this.setPlatformModel(softwareMeta.getAttribute(SwidTagConstants.PLATFORM_MODEL_STR));
this.platformVersion = softwareMeta.getAttribute(SwidTagConstants.PLATFORM_VERSION_STR);
this.payloadType = softwareMeta.getAttribute(SwidTagConstants.PAYLOAD_TYPE_STR);
this.pcURIGlobal = softwareMeta.getAttribute(SwidTagConstants.PC_URI_GLOBAL_STR);
this.pcURILocal = softwareMeta.getAttribute(SwidTagConstants.PC_URI_LOCAL_STR);
} else {
log.warn("SoftwareMeta Tag not found.");
}
@ -202,7 +205,6 @@ public class BaseReferenceManifest extends ReferenceManifest {
* This method validates the .swidtag file at the given filepath against the
* schema. A successful validation results in the output of the tag's name
* and tagId attributes, otherwise a generic error message is printed.
*
*/
private Element getDirectoryTag(final byte[] rimBytes) {
if (rimBytes == null || rimBytes.length == 0) {
@ -254,7 +256,6 @@ public class BaseReferenceManifest extends ReferenceManifest {
* This method iterates over the list of File elements under the directory.
*
* @param rimBytes the bytes to find the files
*
*/
public List<SwidResource> getFileResources(final byte[] rimBytes) {
Element directoryTag = getDirectoryTag(rimBytes);
@ -267,8 +268,8 @@ public class BaseReferenceManifest extends ReferenceManifest {
swidResource = new SwidResource();
swidResource.setName(file.getAttribute(SwidTagConstants.NAME));
swidResource.setSize(file.getAttribute(SwidTagConstants.SIZE));
swidResource.setHashValue(file.getAttribute(SwidTagConstants._SHA256_HASH.getPrefix() + ":"
+ SwidTagConstants._SHA256_HASH.getLocalPart()));
swidResource.setHashValue(file.getAttribute(SwidTagConstants.SHA_256_HASH.getPrefix() + ":"
+ SwidTagConstants.SHA_256_HASH.getLocalPart()));
validHashes.add(swidResource);
}
@ -353,9 +354,15 @@ public class BaseReferenceManifest extends ReferenceManifest {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}
BaseReferenceManifest that = (BaseReferenceManifest) o;
return swidCorpus == that.swidCorpus && Objects.equals(swidName, that.swidName)
&& Objects.equals(colloquialVersion, that.colloquialVersion)

View File

@ -348,9 +348,9 @@ public class IdentityClaimProcessor extends AbstractProcessor {
String defaultClientName = String.format("%s_%s",
dv.getHw().getManufacturer(),
dv.getHw().getProductName());
BaseReferenceManifest dbBaseRim = null;
SupportReferenceManifest support = null;
EventLogMeasurements measurements;
BaseReferenceManifest baseRim = null;
SupportReferenceManifest supportRim = null;
EventLogMeasurements integrityMeasurements;
boolean isReplacement = false;
String replacementRimId = "";
String tagId = "";
@ -362,55 +362,55 @@ public class IdentityClaimProcessor extends AbstractProcessor {
if (dv.getSwidfileCount() > 0) {
for (ByteString swidFile : dv.getSwidfileList()) {
try {
dbBaseRim = (BaseReferenceManifest) referenceManifestRepository
baseRim = (BaseReferenceManifest) referenceManifestRepository
.findByBase64Hash(Base64.getEncoder()
.encodeToString(messageDigest
.digest(swidFile.toByteArray())));
if (dbBaseRim == null) {
if (baseRim == null) {
/*
Either the swidFile does not have a corresponding base RIM in the backend
or it was deleted. Check if there is a replacement by comparing tagId against
all other base RIMs, and then set the corresponding support rim's deviceName.
*/
dbBaseRim = new BaseReferenceManifest(
baseRim = new BaseReferenceManifest(
String.format("%s.swidtag",
defaultClientName),
swidFile.toByteArray());
List<BaseReferenceManifest> baseRims = referenceManifestRepository.findAllBaseRims();
for (BaseReferenceManifest bRim : baseRims) {
if (bRim.getTagId().equals(dbBaseRim.getTagId())) {
dbBaseRim = bRim;
replacementRimId = dbBaseRim.getAssociatedRim().toString();
if (bRim.getTagId().equals(baseRim.getTagId())) {
baseRim = bRim;
replacementRimId = baseRim.getAssociatedRim().toString();
isReplacement = true;
break;
}
}
dbBaseRim.setDeviceName(dv.getNw().getHostname());
this.referenceManifestRepository.save(dbBaseRim);
} else if (dbBaseRim.isArchived()) {
baseRim.setDeviceName(dv.getNw().getHostname());
this.referenceManifestRepository.save(baseRim);
} else if (baseRim.isArchived()) {
/*
This block accounts for RIMs that may have been soft-deleted (archived)
in an older version of the ACA.
*/
List<ReferenceManifest> rims = referenceManifestRepository.findByArchiveFlag(false);
for (ReferenceManifest rim : rims) {
if (rim.isBase() && rim.getTagId().equals(dbBaseRim.getTagId()) &&
rim.getCreateTime().after(dbBaseRim.getCreateTime())) {
dbBaseRim.setDeviceName(null);
dbBaseRim = (BaseReferenceManifest) rim;
dbBaseRim.setDeviceName(dv.getNw().getHostname());
if (rim.isBase() && rim.getTagId().equals(baseRim.getTagId()) &&
rim.getCreateTime().after(baseRim.getCreateTime())) {
baseRim.setDeviceName(null);
baseRim = (BaseReferenceManifest) rim;
baseRim.setDeviceName(dv.getNw().getHostname());
}
}
if (dbBaseRim.isArchived()) {
if (baseRim.isArchived()) {
throw new Exception("Unable to locate an unarchived base RIM.");
} else {
this.referenceManifestRepository.save(dbBaseRim);
this.referenceManifestRepository.save(baseRim);
}
} else {
dbBaseRim.setDeviceName(dv.getNw().getHostname());
this.referenceManifestRepository.save(dbBaseRim);
baseRim.setDeviceName(dv.getNw().getHostname());
this.referenceManifestRepository.save(baseRim);
}
tagId = dbBaseRim.getTagId();
tagId = baseRim.getTagId();
} catch (UnmarshalException e) {
log.error(e);
} catch (Exception ex) {
@ -425,11 +425,11 @@ public class IdentityClaimProcessor extends AbstractProcessor {
if (dv.getLogfileCount() > 0) {
for (ByteString logFile : dv.getLogfileList()) {
try {
support =
supportRim =
(SupportReferenceManifest) referenceManifestRepository.findByHexDecHashAndRimType(
Hex.encodeHexString(messageDigest.digest(logFile.toByteArray())),
ReferenceManifest.SUPPORT_RIM);
if (support == null) {
if (supportRim == null) {
/*
Either the logFile does not have a corresponding support RIM in the backend
or it was deleted. The support RIM for a replacement base RIM is handled
@ -439,28 +439,28 @@ public class IdentityClaimProcessor extends AbstractProcessor {
Optional<ReferenceManifest> replacementRim =
referenceManifestRepository.findById(UUID.fromString(replacementRimId));
if (replacementRim.isPresent()) {
support = (SupportReferenceManifest) replacementRim.get();
support.setDeviceName(dv.getNw().getHostname());
supportRim = (SupportReferenceManifest) replacementRim.get();
supportRim.setDeviceName(dv.getNw().getHostname());
} else {
throw new Exception("Unable to locate support RIM " + replacementRimId);
}
} else {
support = new SupportReferenceManifest(
supportRim = new SupportReferenceManifest(
String.format("%s.rimel",
defaultClientName),
logFile.toByteArray());
// this is a validity check
new TCGEventLog(support.getRimBytes());
new TCGEventLog(supportRim.getRimBytes());
// no issues, continue
support.setPlatformManufacturer(dv.getHw().getManufacturer());
support.setPlatformModel(dv.getHw().getProductName());
support.setFileName(String.format("%s_[%s].rimel", defaultClientName,
support.getHexDecHash().substring(
support.getHexDecHash().length() - NUM_OF_VARIABLES)));
supportRim.setPlatformManufacturer(dv.getHw().getManufacturer());
supportRim.setPlatformModel(dv.getHw().getProductName());
supportRim.setFileName(String.format("%s_[%s].rimel", defaultClientName,
supportRim.getHexDecHash().substring(
supportRim.getHexDecHash().length() - NUM_OF_VARIABLES)));
}
support.setDeviceName(dv.getNw().getHostname());
this.referenceManifestRepository.save(support);
} else if (support.isArchived()) {
supportRim.setDeviceName(dv.getNw().getHostname());
this.referenceManifestRepository.save(supportRim);
} else if (supportRim.isArchived()) {
/*
This block accounts for RIMs that may have been soft-deleted (archived)
in an older version of the ACA.
@ -468,21 +468,21 @@ public class IdentityClaimProcessor extends AbstractProcessor {
List<ReferenceManifest> rims = referenceManifestRepository.findByArchiveFlag(false);
for (ReferenceManifest rim : rims) {
if (rim.isSupport() &&
rim.getTagId().equals(support.getTagId()) &&
rim.getCreateTime().after(support.getCreateTime())) {
support.setDeviceName(null);
support = (SupportReferenceManifest) rim;
support.setDeviceName(dv.getNw().getHostname());
rim.getTagId().equals(supportRim.getTagId()) &&
rim.getCreateTime().after(supportRim.getCreateTime())) {
supportRim.setDeviceName(null);
supportRim = (SupportReferenceManifest) rim;
supportRim.setDeviceName(dv.getNw().getHostname());
}
}
if (support.isArchived()) {
if (supportRim.isArchived()) {
throw new Exception("Unable to locate an unarchived support RIM.");
} else {
this.referenceManifestRepository.save(support);
this.referenceManifestRepository.save(supportRim);
}
} else {
support.setDeviceName(dv.getNw().getHostname());
this.referenceManifestRepository.save(support);
supportRim.setDeviceName(dv.getNw().getHostname());
this.referenceManifestRepository.save(supportRim);
}
} catch (IOException ioEx) {
log.error(ioEx);
@ -497,18 +497,18 @@ public class IdentityClaimProcessor extends AbstractProcessor {
//update Support RIMs and Base RIMs.
for (ByteString swidFile : dv.getSwidfileList()) {
dbBaseRim = (BaseReferenceManifest) referenceManifestRepository
baseRim = (BaseReferenceManifest) referenceManifestRepository
.findByBase64Hash(Base64.getEncoder().encodeToString(messageDigest.digest(
swidFile.toByteArray())));
if (dbBaseRim != null) {
if (baseRim != null) {
// get file name to use
for (SwidResource swid : dbBaseRim.getFileResources()) {
for (SwidResource swid : baseRim.getFileResources()) {
matcher = pattern.matcher(swid.getName());
if (matcher.matches()) {
//found the file name
int dotIndex = swid.getName().lastIndexOf(".");
fileName = swid.getName().substring(0, dotIndex);
dbBaseRim.setFileName(String.format("%s.swidtag",
baseRim.setFileName(String.format("%s.swidtag",
fileName));
}
@ -519,19 +519,19 @@ public class IdentityClaimProcessor extends AbstractProcessor {
ReferenceManifest.SUPPORT_RIM);
if (dbSupport != null) {
dbSupport.setFileName(swid.getName());
dbSupport.setSwidTagVersion(dbBaseRim.getSwidTagVersion());
dbSupport.setTagId(dbBaseRim.getTagId());
dbSupport.setSwidTagVersion(dbBaseRim.getSwidTagVersion());
dbSupport.setSwidVersion(dbBaseRim.getSwidVersion());
dbSupport.setSwidPatch(dbBaseRim.isSwidPatch());
dbSupport.setSwidSupplemental(dbBaseRim.isSwidSupplemental());
dbBaseRim.setAssociatedRim(dbSupport.getId());
dbSupport.setSwidTagVersion(baseRim.getSwidTagVersion());
dbSupport.setTagId(baseRim.getTagId());
dbSupport.setSwidTagVersion(baseRim.getSwidTagVersion());
dbSupport.setSwidVersion(baseRim.getSwidVersion());
dbSupport.setSwidPatch(baseRim.isSwidPatch());
dbSupport.setSwidSupplemental(baseRim.isSwidSupplemental());
baseRim.setAssociatedRim(dbSupport.getId());
dbSupport.setUpdated(true);
dbSupport.setAssociatedRim(dbBaseRim.getId());
dbSupport.setAssociatedRim(baseRim.getId());
this.referenceManifestRepository.save(dbSupport);
}
}
this.referenceManifestRepository.save(dbBaseRim);
this.referenceManifestRepository.save(baseRim);
}
}
@ -542,40 +542,40 @@ public class IdentityClaimProcessor extends AbstractProcessor {
fileName = String.format("%s.measurement",
dv.getNw().getHostname());
try {
EventLogMeasurements temp = new EventLogMeasurements(fileName,
EventLogMeasurements deviceLiveLog = new EventLogMeasurements(fileName,
dv.getLivelog().toByteArray());
// find previous version.
measurements = referenceManifestRepository
integrityMeasurements = referenceManifestRepository
.byMeasurementDeviceName(dv.getNw().getHostname());
if (measurements != null) {
if (integrityMeasurements != null) {
// Find previous log and delete it
referenceManifestRepository.delete(measurements);
referenceManifestRepository.delete(integrityMeasurements);
}
List<BaseReferenceManifest> baseRims = referenceManifestRepository
.getBaseByManufacturerModel(dv.getHw().getManufacturer(),
dv.getHw().getProductName());
measurements = temp;
measurements.setPlatformManufacturer(dv.getHw().getManufacturer());
measurements.setPlatformModel(dv.getHw().getProductName());
integrityMeasurements = deviceLiveLog;
integrityMeasurements.setPlatformManufacturer(dv.getHw().getManufacturer());
integrityMeasurements.setPlatformModel(dv.getHw().getProductName());
if (tagId != null && !tagId.trim().isEmpty()) {
measurements.setTagId(tagId);
integrityMeasurements.setTagId(tagId);
}
measurements.setDeviceName(dv.getNw().getHostname());
measurements.archive();
integrityMeasurements.setDeviceName(dv.getNw().getHostname());
integrityMeasurements.archive();
this.referenceManifestRepository.save(measurements);
this.referenceManifestRepository.save(integrityMeasurements);
for (BaseReferenceManifest baseRim : baseRims) {
if (baseRim != null) {
for (BaseReferenceManifest bRim : baseRims) {
if (bRim != null) {
// pull the base versions of the swidtag and rimel and set the
// event log hash for use during provision
SupportReferenceManifest sBaseRim = referenceManifestRepository
.getSupportRimEntityById(baseRim.getAssociatedRim());
baseRim.setEventLogHash(temp.getHexDecHash());
sBaseRim.setEventLogHash(temp.getHexDecHash());
referenceManifestRepository.save(baseRim);
.getSupportRimEntityById(bRim.getAssociatedRim());
bRim.setEventLogHash(deviceLiveLog.getHexDecHash());
sBaseRim.setEventLogHash(deviceLiveLog.getHexDecHash());
referenceManifestRepository.save(bRim);
referenceManifestRepository.save(sBaseRim);
}
}
@ -611,11 +611,11 @@ public class IdentityClaimProcessor extends AbstractProcessor {
List<SupportReferenceManifest> patchRims = new ArrayList<>();
List<SupportReferenceManifest> dbSupportRims = this.referenceManifestRepository
.getSupportByManufacturerModel(manufacturer, model);
List<ReferenceDigestValue> sourcedValues = referenceDigestValueRepository
List<ReferenceDigestValue> expectedValues = referenceDigestValueRepository
.findByManufacturerAndModel(manufacturer, model);
Map<String, ReferenceDigestValue> digestValueMap = new HashMap<>();
sourcedValues.stream().forEach((rdv) -> {
expectedValues.stream().forEach((rdv) -> {
digestValueMap.put(rdv.getDigestValue(), rdv);
});
@ -634,9 +634,9 @@ public class IdentityClaimProcessor extends AbstractProcessor {
&& referenceDigestValueRepository.findBySupportRimHash(baseSupportRim.getHexDecHash())
.isEmpty()) {
try {
TCGEventLog logProcessor = new TCGEventLog(baseSupportRim.getRimBytes());
TCGEventLog eventLog = new TCGEventLog(baseSupportRim.getRimBytes());
ReferenceDigestValue rdv;
for (TpmPcrEvent tpe : logProcessor.getEventList()) {
for (TpmPcrEvent tpe : eventLog.getEventList()) {
rdv = new ReferenceDigestValue(baseSupportRim.getAssociatedRim(),
baseSupportRim.getId(), manufacturer, model, tpe.getPcrIndex(),
tpe.getEventDigestStr(), baseSupportRim.getHexDecHash(),
@ -648,8 +648,8 @@ public class IdentityClaimProcessor extends AbstractProcessor {
// since I have the base already I don't have to care about the backward
// linkage
for (SupportReferenceManifest supplemental : supplementalRims) {
logProcessor = new TCGEventLog(supplemental.getRimBytes());
for (TpmPcrEvent tpe : logProcessor.getEventList()) {
eventLog = new TCGEventLog(supplemental.getRimBytes());
for (TpmPcrEvent tpe : eventLog.getEventList()) {
// all RDVs will have the same base rim
rdv = new ReferenceDigestValue(baseSupportRim.getAssociatedRim(),
supplemental.getId(), manufacturer, model, tpe.getPcrIndex(),
@ -683,8 +683,8 @@ public class IdentityClaimProcessor extends AbstractProcessor {
ReferenceDigestValue dbRdv;
String patchedValue;
for (SupportReferenceManifest patch : patchRims) {
logProcessor = new TCGEventLog(patch.getRimBytes());
for (TpmPcrEvent tpe : logProcessor.getEventList()) {
eventLog = new TCGEventLog(patch.getRimBytes());
for (TpmPcrEvent tpe : eventLog.getEventList()) {
patchedValue = tpe.getEventDigestStr();
dbRdv = digestValueMap.get(patchedValue);

View File

@ -12,8 +12,8 @@ import hirs.attestationca.persist.entity.userdefined.rim.EventLogMeasurements;
import hirs.attestationca.persist.entity.userdefined.rim.ReferenceDigestValue;
import hirs.attestationca.persist.enums.AppraisalStatus;
import hirs.attestationca.persist.service.ValidationService;
import hirs.utils.rim.ReferenceManifestValidator;
import hirs.utils.SwidResource;
import hirs.utils.rim.ReferenceManifestValidator;
import hirs.utils.tpm.eventlog.TCGEventLog;
import hirs.utils.tpm.eventlog.TpmPcrEvent;
import lombok.extern.log4j.Log4j2;
@ -24,7 +24,12 @@ import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import static hirs.attestationca.persist.enums.AppraisalStatus.Status.FAIL;
import static hirs.attestationca.persist.enums.AppraisalStatus.Status.PASS;
@ -35,7 +40,6 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
private static PcrValidator pcrValidator;
/**
*
* @param device
* @param policySettings
* @param referenceManifestRepository
@ -66,7 +70,8 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
// In this case, try to look up the event log associated with the device, then get the base rim associated by event log hash
List<ReferenceManifest> deviceRims = referenceManifestRepository.findByDeviceName(hostName);
for (ReferenceManifest deviceRim : deviceRims) {
if (deviceRim instanceof BaseReferenceManifest && !deviceRim.isSwidSupplemental() && !deviceRim.isSwidPatch()) {
if (deviceRim instanceof BaseReferenceManifest && !deviceRim.isSwidSupplemental() &&
!deviceRim.isSwidPatch()) {
baseReferenceManifest = (BaseReferenceManifest) deviceRim;
}
@ -77,7 +82,9 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
// Attempt to get an event log from the database matching the expected hash
if (baseReferenceManifest == null && measurement != null) {
baseReferenceManifest = (BaseReferenceManifest)referenceManifestRepository.findByEventLogHashAndRimType(measurement.getHexDecHash(), ReferenceManifest.BASE_RIM);
baseReferenceManifest =
(BaseReferenceManifest) referenceManifestRepository.findByEventLogHashAndRimType(
measurement.getHexDecHash(), ReferenceManifest.BASE_RIM);
}
String failedString = "";
@ -101,7 +108,7 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
if (passed) {
List<SwidResource> resources =
((BaseReferenceManifest) baseReferenceManifest).getFileResources();
baseReferenceManifest.getFileResources();
fwStatus = new AppraisalStatus(PASS,
SupplyChainCredentialValidator.FIRMWARE_VALID);
@ -131,20 +138,22 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
try {
certs.add(cac.getX509Certificate());
} catch (IOException e) {
log.error("Error building CA chain for " + signingCert.getSubjectKeyIdentifier() + ": "
+ e.getMessage());
log.error(
"Error building CA chain for " + signingCert.getSubjectKeyIdentifier() + ": "
+ e.getMessage());
}
}
referenceManifestValidator.setTrustStore(certs);
try {
if (referenceManifestValidator.validateXmlSignature(signingCert.getX509Certificate().getPublicKey(),
signingCert.getSubjectKeyIdString(), signingCert.getEncodedPublicKey())) {
if (referenceManifestValidator.validateXmlSignature(
signingCert.getX509Certificate().getPublicKey(),
signingCert.getSubjectKeyIdString(), signingCert.getEncodedPublicKey())) {
try {
if (!SupplyChainCredentialValidator.verifyCertificate(
signingCert.getX509Certificate(), keyStore)) {
signingCert.getX509Certificate(), keyStore)) {
passed = false;
fwStatus = new AppraisalStatus(FAIL,
"Firmware validation failed: invalid certificate path.");
"Firmware validation failed: invalid certificate path.");
}
} catch (IOException ioEx) {
log.error("Error getting X509 cert from manager: " + ioEx.getMessage());
@ -197,10 +206,10 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
}
if (passed) {
TCGEventLog logProcessor;
TCGEventLog expectedEventLog;
try {
logProcessor = new TCGEventLog(supportReferenceManifest.getRimBytes());
baseline = logProcessor.getExpectedPCRValues();
expectedEventLog = new TCGEventLog(supportReferenceManifest.getRimBytes());
baseline = expectedEventLog.getExpectedPCRValues();
} catch (CertificateException cEx) {
log.error(cEx);
} catch (NoSuchAlgorithmException noSaEx) {
@ -233,21 +242,21 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
// part 2 of firmware validation check: bios measurements
// vs baseline tcg event log
// find the measurement
TCGEventLog tcgMeasurementLog;
LinkedList<TpmPcrEvent> tpmPcrEvents = new LinkedList<>();
List<ReferenceDigestValue> eventValue;
HashMap<String, ReferenceDigestValue> eventValueMap = new HashMap<>();
TCGEventLog actualEventLog;
LinkedList<TpmPcrEvent> failedPcrValues = new LinkedList<>();
List<ReferenceDigestValue> rimIntegrityMeasurements;
HashMap<String, ReferenceDigestValue> expectedEventLogRecords = new HashMap<>();
try {
if (measurement.getDeviceName().equals(hostName)) {
tcgMeasurementLog = new TCGEventLog(measurement.getRimBytes());
eventValue = referenceDigestValueRepository
actualEventLog = new TCGEventLog(measurement.getRimBytes());
rimIntegrityMeasurements = referenceDigestValueRepository
.findValuesByBaseRimId(baseReferenceManifest.getId());
for (ReferenceDigestValue rdv : eventValue) {
eventValueMap.put(rdv.getDigestValue(), rdv);
for (ReferenceDigestValue rdv : rimIntegrityMeasurements) {
expectedEventLogRecords.put(rdv.getDigestValue(), rdv);
}
tpmPcrEvents.addAll(pcrValidator.validateTpmEvents(
tcgMeasurementLog, eventValueMap, policySettings));
failedPcrValues.addAll(pcrValidator.validateTpmEvents(
actualEventLog, expectedEventLogRecords, policySettings));
}
} catch (CertificateException cEx) {
log.error(cEx);
@ -257,11 +266,11 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
log.error(ioEx);
}
if (!tpmPcrEvents.isEmpty()) {
if (!failedPcrValues.isEmpty()) {
StringBuilder sb = new StringBuilder();
sb.append(String.format("%d digest(s) were not found:%n",
tpmPcrEvents.size()));
for (TpmPcrEvent tpe : tpmPcrEvents) {
failedPcrValues.size()));
for (TpmPcrEvent tpe : failedPcrValues) {
sb.append(String.format("PCR Index %d - %s%n",
tpe.getPcrIndex(),
tpe.getEventTypeStr()));

View File

@ -39,10 +39,10 @@ configurations.checkstyle {
}
}
checkstyleMain {
source ='src/main/java'
source = 'src/main/java'
}
checkstyleTest {
source ='src/test/java'
source = 'src/test/java'
}
tasks.withType(Checkstyle) {
reports {

View File

@ -2,11 +2,11 @@
<!-- Docs at http://findbugs.sourceforge.net/manual/filter.html -->
<FindBugsFilter>
<Match>
<Package name="~hirs\.structs.*" />
<Package name="~hirs\.structs.*"/>
</Match>
<Match>
<!-- https://github.com/spotbugs/spotbugs/pull/2748 -->
<Bug pattern="CT_CONSTRUCTOR_THROW" />
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Match>
<!-- <Match>-->

View File

@ -2,22 +2,24 @@ package hirs.structs.converters;
import hirs.structs.elements.Struct;
import hirs.structs.elements.StructElementLength;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import org.apache.commons.lang3.reflect.ConstructorUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
/**
* StructBuilder implementation.
*
* @param <T> the type of Struct to build
*/
public class SimpleStructBuilder<T extends Struct> implements StructBuilder {
private T struct;
private final Class<T> clazz;
private T struct;
/**
* Instantiates the builder.
*
* @param clazz The type of struct to build
*/
public SimpleStructBuilder(final Class<T> clazz) {
@ -29,7 +31,7 @@ public class SimpleStructBuilder<T extends Struct> implements StructBuilder {
try {
struct = ConstructorUtils.invokeConstructor(clazz);
} catch (InstantiationException | IllegalAccessException
| NoSuchMethodException | InvocationTargetException e) {
| NoSuchMethodException | InvocationTargetException e) {
throw new StructBuilderException(
String.format("Unexpected error constructing new instance: %s",
clazz.getSimpleName(), e.getMessage()), e);
@ -59,17 +61,13 @@ public class SimpleStructBuilder<T extends Struct> implements StructBuilder {
public SimpleStructBuilder<T> set(final String field, final Number value) {
try {
String type = clazz.getDeclaredField(field).getType().getSimpleName();
switch (clazz.getDeclaredField(field).getType().getSimpleName()) {
case "short":
return setField(field, value.shortValue());
case "int":
return setField(field, value.intValue());
case "byte":
return setField(field, value.byteValue());
default:
throw new StructBuilderException(
String.format("Unhandled numeric field type: %s", type));
}
return switch (clazz.getDeclaredField(field).getType().getSimpleName()) {
case "short" -> setField(field, value.shortValue());
case "int" -> setField(field, value.intValue());
case "byte" -> setField(field, value.byteValue());
default -> throw new StructBuilderException(
String.format("Unhandled numeric field type: %s", type));
};
} catch (NoSuchFieldException | SecurityException e) {
throw new StructBuilderException(
String.format("Unexpected error setting field: %s",
@ -122,7 +120,7 @@ public class SimpleStructBuilder<T extends Struct> implements StructBuilder {
FieldUtils.writeField(field, struct, value);
field.setAccessible(false);
} catch (NoSuchFieldException | SecurityException
| IllegalArgumentException | IllegalAccessException e) {
| IllegalArgumentException | IllegalAccessException e) {
throw new StructBuilderException(
String.format("Unexpected error setting field: %s",
fieldName, e.getMessage()), e);

View File

@ -25,7 +25,7 @@ public class SimpleStructConverter implements StructConverter {
// using output stream resources, serialize the specified struct
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream)) {
DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream)) {
// obtain the struct elements definition
StructElements structElements = struct.getClass().getAnnotation(StructElements.class);

View File

@ -20,8 +20,8 @@ public interface StructConverter {
*
* @param data to be parsed
* @param type type of data being parsed
* @param <T> the {@link Struct} type
* @param <T> the {@link Struct} type
* @return de-serialized struct
*/
<T extends Struct> T convert(final byte[] data, final Class<T> type);
<T extends Struct> T convert(byte[] data, Class<T> type);
}

View File

@ -14,7 +14,7 @@ import java.lang.annotation.Target;
public @interface StructElementLength {
/**
* the field that this length represents.
* @return the field that this length represents.
*/
String fieldName();
}

View File

@ -13,7 +13,7 @@ import java.lang.annotation.Target;
public @interface StructElements {
/**
* elements in order to be processed by a converter.
* @return elements in order to be processed by a converter.
*/
String[] elements();
}

View File

@ -10,10 +10,10 @@ import java.util.Arrays;
* A container for an encoded {@link hirs.structs.elements.tpm.IdentityRequest},
* its associated endorsement credential, and its device information.
*/
@StructElements(elements = { "requestLength", "request",
"endorsementCredentialModulusLength", "endorsementCredentialModulus",
"endorsementCredentialLength", "endorsementCredential",
"deviceInfoReportLength", "deviceInfoReport" })
@StructElements(elements = {"requestLength", "request",
"endorsementCredentialModulusLength", "endorsementCredentialModulus",
"endorsementCredentialLength", "endorsementCredential",
"deviceInfoReportLength", "deviceInfoReport"})
public class IdentityRequestEnvelope implements Struct {
@StructElementLength(fieldName = "request")
@ -72,7 +72,6 @@ public class IdentityRequestEnvelope implements Struct {
}
/**
*
* @return the endorsementCredential
*/
public byte[] getEndorsementCredential() {
@ -80,7 +79,6 @@ public class IdentityRequestEnvelope implements Struct {
}
/**
*
* @return the length of the device info report
*/
public int getDeviceInfoReportLength() {
@ -88,7 +86,6 @@ public class IdentityRequestEnvelope implements Struct {
}
/**
*
* @return the device info report
*/
public byte[] getDeviceInfoReport() {

View File

@ -9,8 +9,8 @@ import java.util.Arrays;
/**
* Data structure used by the ACA to respond back to a client's {@link IdentityRequestEnvelope}.
*/
@StructElements(elements = { "asymmetricContentsSize", "asymmetricContents",
"symmetricAttestation" })
@StructElements(elements = {"asymmetricContentsSize", "asymmetricContents",
"symmetricAttestation"})
public class IdentityResponseEnvelope implements Struct {
@StructElementLength(fieldName = "asymmetricContents")

View File

@ -12,7 +12,7 @@ import java.util.Arrays;
* the envelope contains the Identity Credential that is signed by the ACA. This along with the key
* parameters are typically sent to the TPM to activate an Identity.
*/
@StructElements(elements = { "credentialSize", "algorithm", "credential" })
@StructElements(elements = {"credentialSize", "algorithm", "credential"})
public class SymmetricAttestation implements Struct {
@StructElementLength(fieldName = "credential")

View File

@ -8,8 +8,8 @@ import hirs.structs.elements.StructElements;
* 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.
*/
@StructElements(elements = { "algorithmId", "encryptionScheme", "signatureScheme", "paramsSize",
"params" })
@StructElements(elements = {"algorithmId", "encryptionScheme", "signatureScheme", "paramsSize",
"params"})
public class AsymmetricKeyParams implements Struct {
private int algorithmId;

View File

@ -8,7 +8,7 @@ import hirs.structs.elements.StructElements;
* portion of an asymmetric key pair. It contains all the information necessary for it's unambiguous
* usage.
*/
@StructElements(elements = { "asymmetricKeyParams", "storePubKey" })
@StructElements(elements = {"asymmetricKeyParams", "storePubKey"})
public class AsymmetricPublicKey implements Struct {
/**

View File

@ -35,11 +35,6 @@ public enum EncryptionScheme {
this.encryptionScheme = encryptionScheme;
}
@Override
public String toString() {
return this.encryptionScheme;
}
/**
* Maps an {@link EncryptionScheme} based upon an integer. If the scheme is unmapped, the
* default, {@link #PKCS1} is returned.
@ -48,11 +43,14 @@ public enum EncryptionScheme {
* @return the encryption scheme, or if unknown, the default.
*/
public static EncryptionScheme fromInt(final int scheme) {
switch (scheme) {
case OAEP_VALUE:
return OAEP;
default:
return PKCS1;
if (scheme == OAEP_VALUE) {
return OAEP;
}
return PKCS1;
}
@Override
public String toString() {
return this.encryptionScheme;
}
}

View File

@ -11,9 +11,9 @@ import java.util.Arrays;
* identity process. This structure contains information that is required by the Attestation
* Certificate Authority to attest an identity request.
*/
@StructElements(elements = { "version", "labelSize", "identityBindingSize", "endorsementSize",
@StructElements(elements = {"version", "labelSize", "identityBindingSize", "endorsementSize",
"platformSize", "conformanceSize", "identityKey", "label", "identityBinding",
"endorsementCredential", "platformCredential", "conformanceCredential" })
"endorsementCredential", "platformCredential", "conformanceCredential"})
public class IdentityProof implements Struct {
private Version version;

View File

@ -10,8 +10,8 @@ import java.util.Arrays;
* As specified in TCPA 4.30.2 specification. This structure is sent to the Attestation Certificate
* Authority to create an Identity Credential.
*/
@StructElements(elements = { "asymmetricBlobSize", "symmetricBlobSize", "asymmetricAlgorithm",
"symmetricAlgorithm", "asymmetricBlob", "symmetricBlob" })
@StructElements(elements = {"asymmetricBlobSize", "symmetricBlobSize", "asymmetricAlgorithm",
"symmetricAlgorithm", "asymmetricBlob", "symmetricBlob"})
public class IdentityRequest implements Struct {
@StructElementLength(fieldName = "asymmetricBlob")

View File

@ -8,7 +8,7 @@ import hirs.structs.elements.StructElements;
* portion of an asymmetric key pair. It contains all the information necessary for it's unambiguous
* usage.
*/
@StructElements(elements = { "asymmetricKeyParams", "storePubKey" })
@StructElements(elements = {"asymmetricKeyParams", "storePubKey"})
public class PublicKey implements Struct {
private AsymmetricKeyParams asymmetricKeyParams;

View File

@ -10,7 +10,7 @@ import java.util.Arrays;
* Parameters that are used to describe a particular {@link AsymmetricKeyParams} as specified by the
* TCPA 4.20.
*/
@StructElements(elements = { "keyLength", "totalPrimes", "exponentSize", "exponent" })
@StructElements(elements = {"keyLength", "totalPrimes", "exponentSize", "exponent"})
public class RsaSubParams implements Struct {
private int keyLength;

View File

@ -10,7 +10,7 @@ import java.util.Arrays;
* As specified in TCPA Main Specification section 4.27.2. This structure represents a public key of
* an asymmetric key pair.
*/
@StructElements(elements = { "keyLength", "key" })
@StructElements(elements = {"keyLength", "key"})
public class StorePubKey implements Struct {
@StructElementLength(fieldName = "key")

View File

@ -10,7 +10,7 @@ import java.util.Arrays;
* Part of the TPM Identity Request. This Structure is encrypted inside the request and is typically
* unencrypted by an Attestation Certificate Authority.
*/
@StructElements(elements = { "algorithmId", "encryptionScheme", "keySize", "key" })
@StructElements(elements = {"algorithmId", "encryptionScheme", "keySize", "key"})
public class SymmetricKey implements Struct {
/**

View File

@ -7,8 +7,8 @@ import hirs.structs.elements.StructElements;
/**
* Represents a symmetric key as specified in section 4.20 of the TCPA.
*/
@StructElements(elements = { "algorithmId", "encryptionScheme", "signatureScheme", "paramsSize",
"params" })
@StructElements(elements = {"algorithmId", "encryptionScheme", "signatureScheme", "paramsSize",
"params"})
public class SymmetricKeyParams implements Struct {
/**

View File

@ -10,7 +10,7 @@ import java.util.Arrays;
* Represents a dynamic key parameters data structure that is enclosed inside a {@link
* SymmetricKeyParams}.
*/
@StructElements(elements = { "keyLength", "blockSize", "ivSize", "iv" })
@StructElements(elements = {"keyLength", "blockSize", "ivSize", "iv"})
public class SymmetricSubParams implements Struct {
private int keyLength;

View File

@ -7,7 +7,7 @@ import hirs.structs.elements.StructElements;
* As specified in the TCPA Main Specification section 4.5. This structure represents the version of
* the TPM.
*/
@StructElements(elements = { "major", "minor", "revisionMajor", "revisionMinor" })
@StructElements(elements = {"major", "minor", "revisionMajor", "revisionMinor"})
public class Version implements Struct {
private byte major;

View File

@ -1,8 +1,9 @@
package hirs.structs.converters;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
/**
* Tests suite for {@link SimpleStructConverter}.
@ -13,24 +14,25 @@ public class SimpleStructBuilderTest {
/**
* Tests {@link SimpleStructBuilder#build()}.
* @throws NoSuchFieldException sometimes
* @throws IllegalAccessException sometimes
*
* @throws NoSuchFieldException sometimes
* @throws IllegalAccessException sometimes
* @throws IllegalArgumentException sometimes
*/
@Test
public final void testBuild() throws NoSuchFieldException, IllegalArgumentException,
IllegalAccessException {
TestStruct struct = new SimpleStructBuilder<>(TestStruct.class)
.set("testShort", NUMBER)
.set("testByte", NUMBER)
.set("testEmbeddedStruct", new SimpleStructBuilder<>(TestEmbeddedStruct.class)
.set("embeddedShort", NUMBER)
.set("embedded", ARRAY)
.build())
.set("testVariableStruct", new SimpleStructBuilder<>(TestVariableStruct.class)
.set("testArray", ARRAY)
.build())
.build();
.set("testShort", NUMBER)
.set("testByte", NUMBER)
.set("testEmbeddedStruct", new SimpleStructBuilder<>(TestEmbeddedStruct.class)
.set("embeddedShort", NUMBER)
.set("embedded", ARRAY)
.build())
.set("testVariableStruct", new SimpleStructBuilder<>(TestVariableStruct.class)
.set("testArray", ARRAY)
.build())
.build();
assertEquals(NUMBER, struct.getTestShort());
assertEquals(NUMBER, struct.getTestByte());

View File

@ -1,8 +1,9 @@
package hirs.structs.converters;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
/**
* Tests suite for {@link SimpleStructConverter}.
@ -10,11 +11,11 @@ import org.junit.jupiter.api.Test;
public class SimpleStructConverterTest {
private static final byte[] EXPECTED_BYTES =
new byte[]{0, 5, 0, 0, 0, 10, 0, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 6, 0, 0, 0, 0};
new byte[] {0, 5, 0, 0, 0, 10, 0, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 6, 0, 0, 0, 0};
private final TestStruct testStruct = new TestStruct();
private StructConverter converter = new SimpleStructConverter();
private final StructConverter converter = new SimpleStructConverter();
/**
* Tests {@link SimpleStructConverter#convert(hirs.structs.elements.Struct)}.
@ -47,8 +48,9 @@ public class SimpleStructConverterTest {
*/
@Test
public final void testNoElementsStructConvertToArray() {
assertThrows(StructConversionException.class, () ->
{converter.convert(new TestNoElementsAnnotationStruct());}, ".*@StructElements.*");
assertThrows(StructConversionException.class, () -> {
converter.convert(new TestNoElementsAnnotationStruct());
}, ".*@StructElements.*");
}
/**
@ -57,8 +59,9 @@ public class SimpleStructConverterTest {
*/
@Test
public final void testNoElementsStructConvertToStruct() {
assertThrows(StructConversionException.class, () ->
{converter.convert(new byte[1], TestNoElementsAnnotationStruct.class);}, ".*@StructElements.*");
assertThrows(StructConversionException.class, () -> {
converter.convert(new byte[1], TestNoElementsAnnotationStruct.class);
}, ".*@StructElements.*");
}
/**
@ -68,8 +71,9 @@ public class SimpleStructConverterTest {
*/
@Test
public final void testInvalidDataTypeStructConvertToArray() {
assertThrows(StructConversionException.class, () ->
{converter.convert(new TestInvalidDataTypeStruct());}, "Unsupported field type.*");
assertThrows(StructConversionException.class, () -> {
converter.convert(new TestInvalidDataTypeStruct());
}, "Unsupported field type.*");
}
/**
@ -79,8 +83,9 @@ public class SimpleStructConverterTest {
*/
@Test
public final void testInvalidDataTypeStructConvertToStruct() {
assertThrows(StructConversionException.class, () ->
{converter.convert(new byte[1], TestInvalidDataTypeStruct.class);}, "Unsupported field type.*");
assertThrows(StructConversionException.class, () -> {
converter.convert(new byte[1], TestInvalidDataTypeStruct.class);
}, "Unsupported field type.*");
}

View File

@ -9,7 +9,7 @@ import java.util.Arrays;
/**
* A struct to be embedded within TestStruct.
*/
@StructElements(elements = { "embeddedSize", "embeddedShort", "embedded" })
@StructElements(elements = {"embeddedSize", "embeddedShort", "embedded"})
public class TestEmbeddedStruct implements Struct {
private static final int EMBEDDED_SIZE = 10;
@ -18,7 +18,7 @@ public class TestEmbeddedStruct implements Struct {
private static final int HASH_CODE = 31;
private static final byte[] DEFAULT_ARRAY = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
private static final byte[] DEFAULT_ARRAY = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
@StructElementLength(fieldName = "embedded")
@ -28,6 +28,12 @@ public class TestEmbeddedStruct implements Struct {
private byte[] embedded = DEFAULT_ARRAY;
/**
* Returns true if the provided object is equivalent to this class.
*
* @param o object to compare
* @return true if the provided object is equal to this class
*/
@Override
public boolean equals(final Object o) {
if (this == o) {
@ -53,6 +59,7 @@ public class TestEmbeddedStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public byte[] getEmbedded() {
@ -61,6 +68,7 @@ public class TestEmbeddedStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public short getEmbeddedShort() {
@ -69,6 +77,7 @@ public class TestEmbeddedStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public int getEmbeddedSize() {

View File

@ -6,7 +6,7 @@ import hirs.structs.elements.StructElements;
/**
* Test Struct that has an unsupported data type.
*/
@StructElements(elements = { "testLong" })
@StructElements(elements = {"testLong"})
public class TestInvalidDataTypeStruct implements Struct {
private static final Long TEST_LONG_VALUE = 1L;

View File

@ -8,8 +8,8 @@ import hirs.structs.elements.StructElements;
* A Struct class designed to fully test the design of the converter being tested.
*/
@StructElements(
elements = { "testShort", "testEmbeddedStruct", "testByte", "testVariableStructLength",
"testVariableStruct" })
elements = {"testShort", "testEmbeddedStruct", "testByte", "testVariableStructLength",
"testVariableStruct"})
public class TestStruct implements Struct {
private static final short TEST_SHORT = 0x5;
@ -54,6 +54,7 @@ public class TestStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public byte getTestByte() {
@ -62,6 +63,7 @@ public class TestStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public short getTestShort() {
@ -70,6 +72,7 @@ public class TestStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public TestEmbeddedStruct getTestEmbeddedStruct() {
@ -78,6 +81,7 @@ public class TestStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public TestVariableStruct getTestVariableStruct() {
@ -86,6 +90,7 @@ public class TestStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public int getTestVariableStructLength() {

View File

@ -14,6 +14,7 @@ public class TestVariableStruct implements Struct {
/**
* Getter.
*
* @return value
*/
public byte[] getTestArray() {

View File

@ -3,8 +3,8 @@ plugins {
id 'checkstyle'
}
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
def packVersion = properties.get("packageVersion")
def jarVersion = properties.get("jarVersion")
//println "packageVersion is ${projVersion}"
@ -66,10 +66,10 @@ configurations.checkstyle {
}
}
checkstyleMain {
source ='src/main/java'
source = 'src/main/java'
}
checkstyleTest {
source ='src/test/java'
source = 'src/test/java'
}
tasks.withType(Checkstyle) {
reports {

View File

@ -2,14 +2,14 @@
<!-- Docs at http://findbugs.sourceforge.net/manual/filter.html -->
<FindBugsFilter>
<Match>
<Package name="~hirs\.utils.xjc.*" />
<Package name="~hirs\.utils.xjc.*"/>
</Match>
<Match>
<Package name="~hirs\.utils.rim.*" />
<Package name="~hirs\.utils.rim.*"/>
</Match>
<Match>
<!-- https://github.com/spotbugs/spotbugs/pull/2748 -->
<Bug pattern="CT_CONSTRUCTOR_THROW" />
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
</Match>
<!-- <Match>-->

View File

@ -27,40 +27,38 @@ import java.util.List;
@Log4j2
public final class PciIds {
/**
* Track status of pciids file.
*/
@Getter
private static String pciidsFileStatus = UefiConstants.FILESTATUS_NOT_ACCESSIBLE;
/**
* Name of pciids file in code.
*/
private static final String PCIIDS_FILENAME = "/pci.ids";
/**
* This pci ids file can be in different places on different distributions.
* Fedora/RHEL/Rocky/CentOS: /usr/share/hwdata/pci.ids
* Debian/Ubuntu: /usr/share/misc/pci.ids
* Fedora/RHEL/Rocky/CentOS: /usr/share/hwdata/pci.ids
* Debian/Ubuntu: /usr/share/misc/pci.ids
* If the file is not found on the system (such as with Windows systems),
* the file will have to be accessed from code.
*/
public static final List<String> PCI_IDS_PATH =
Collections.unmodifiableList(new ArrayList<>() {
private static final long serialVersionUID = 1L;
{
add("/usr/share/hwdata/pci.ids");
add("/usr/share/misc/pci.ids");
add("/tmp/pci.ids");
}
});
/**
* The PCI IDs Database object.
* This only needs to be loaded one time.
* The pci ids library protects the data inside the object by making it immutable.
*/
public static final PciIdsDatabase DB = new PciIdsDatabase();
/**
* Name of pciids file in code.
*/
private static final String PCIIDS_FILENAME = "/pci.ids";
/**
* Track status of pciids file.
*/
@Getter
private static String pciidsFileStatus = UefiConstants.FILESTATUS_NOT_ACCESSIBLE;
//Configure the PCI IDs Database object.
static {
@ -124,7 +122,8 @@ public final class PciIds {
/**
* Default private constructor so checkstyles doesn't complain.
*/
private PciIds() { }
private PciIds() {
}
/**
* Look up the vendor name from the PCI IDs list, if the input string contains an ID.
@ -172,7 +171,7 @@ public final class PciIds {
* If any part of this fails, return the original model value.
*
* @param refManufacturer ASN1UTF8String, likely from a ComponentIdentifier
* @param refModel ASN1UTF8String, likely from a ComponentIdentifier
* @param refModel ASN1UTF8String, likely from a ComponentIdentifier
* @return ASN1UTF8String with the discovered device name, or the original model value.
*/
public static ASN1UTF8String translateDevice(final ASN1UTF8String refManufacturer,
@ -199,7 +198,7 @@ public final class PciIds {
* If any part of this fails, return the original model value.
*
* @param refManufacturer String, likely from a ComponentResult
* @param refModel String, likely from a ComponentResult
* @param refModel String, likely from a ComponentResult
* @return String with the discovered device name, or the original model value.
*/
public static String translateDevice(final String refManufacturer,
@ -224,10 +223,10 @@ public final class PciIds {
* If any part of this fails, return the original manufacturer value.
*
* @param refClassCode String, formatted as 2 characters (1 byte) for each of the 3 categories
* . Example "010802":
* . Class: "01"
* . Subclass: "08"
* . Programming Interface: "02"
* . Example "010802":
* . Class: "01"
* . Subclass: "08"
* . Programming Interface: "02"
* @return List<String> 3-element list with the class code
* . 1st element: human-readable description of Class
* . 2nd element: human-readable description of Subclass

View File

@ -17,10 +17,20 @@ public final class StringValidator {
private final String fieldName;
private final Logger logger;
private StringValidator(final String value, final String fieldName, final Logger logger) {
this.value = value;
this.fieldName = fieldName;
if (logger == null) {
this.logger = log;
} else {
this.logger = logger;
}
}
/**
* Begins a validation operation.
*
* @param value the value to check
* @param value the value to check
* @param fieldName the name of the field (to be used in error reporting)
* @return a Validation object, upon which validation methods can be called
*/
@ -31,9 +41,9 @@ public final class StringValidator {
/**
* Begins a validation operation.
*
* @param value the value to check
* @param value the value to check
* @param fieldName the name of the field (to be used in error reporting)
* @param logger a logger to use in lieu of Validation's logger
* @param logger a logger to use in lieu of Validation's logger
* @return a Validation object, upon which validation methods can be called
*/
public static StringValidator check(final String value, final String fieldName,
@ -41,16 +51,6 @@ public final class StringValidator {
return new StringValidator(value, fieldName, logger);
}
private StringValidator(final String value, final String fieldName, final Logger logger) {
this.value = value;
this.fieldName = fieldName;
if (logger == null) {
this.logger = log;
} else {
this.logger = logger;
}
}
/**
* Assert that the given field is not null. Throws an IllegalArgumentException if the value
* is indeed null.

View File

@ -34,15 +34,14 @@ public final class Digest extends AbstractDigest {
DigestAlgorithm.SHA1,
new byte[SHA1_DIGEST_LENGTH]
);
private static final String SHA1_EMPTY_HEX =
"da39a3ee5e6b4b0d3255bfef95601890afd80709";
/**
* A SHA1 digest whose content is the hash of an empty buffer.
*/
public static final Digest SHA1_OF_NO_DATA;
private static final String SHA1_EMPTY_HEX =
"da39a3ee5e6b4b0d3255bfef95601890afd80709";
static {
try {
SHA1_OF_NO_DATA = new Digest(
@ -59,17 +58,17 @@ public final class Digest extends AbstractDigest {
columnDefinition = "varbinary(64)")
private final byte[] digest;
@Getter
@XmlElement
@Column(nullable = false)
@Enumerated(EnumType.ORDINAL)
@Getter
private final DigestAlgorithm algorithm;
/**
* Creates a new <code>Digest</code>.
*
* @param algorithm algorithm used to generate the digest
* @param digest digest value
* @param digest digest value
* @throws IllegalArgumentException if digest length does not match that of the algorithm
*/
public Digest(final DigestAlgorithm algorithm, final byte[] digest)
@ -81,6 +80,7 @@ public final class Digest extends AbstractDigest {
/**
* Creates a new <code>Digest</code> when an algorithm isn't specified.
*
* @param digest byte array value
*/
public Digest(final byte[] digest) {
@ -90,11 +90,22 @@ public final class Digest extends AbstractDigest {
/**
* Default constructor necessary for Hibernate.
*/
protected Digest() {
private Digest() {
this.algorithm = null;
this.digest = null;
}
/**
* Helper method to reverse the toString method. Returns a Digest given a String
* that was created using an AbstractDigest's toString method.
*
* @param digest String representation of an AbstractDigest
* @return Digest object recreated from the String passed in
*/
public static Digest fromString(final String digest) {
return new Digest(algorithmFromString(digest), digestFromString(digest));
}
/**
* Retrieves the digest.
*
@ -113,15 +124,4 @@ public final class Digest extends AbstractDigest {
public OptionalDigest asOptionalDigest() {
return new OptionalDigest(algorithm, digest);
}
/**
* Helper method to reverse the toString method. Returns a Digest given a String
* that was created using an AbstractDigest's toString method.
*
* @param digest String representation of an AbstractDigest
* @return Digest object recreated from the String passed in
*/
public static Digest fromString(final String digest) {
return new Digest(algorithmFromString(digest), digestFromString(digest));
}
}

View File

@ -3,7 +3,6 @@ package hirs.utils.digest;
/**
* Enumeration identifying the different outcomes of a comparison between
* two {@link Digest} objects.
*
*/
public enum DigestComparisonResultType {
/**

View File

@ -23,12 +23,12 @@ import java.util.Arrays;
@Access(AccessType.FIELD)
public final class OptionalDigest extends AbstractDigest {
@XmlElement
@Column(nullable = true, name = "digest", length = SHA512_DIGEST_LENGTH,
@Column(name = "digest", length = SHA512_DIGEST_LENGTH,
columnDefinition = "varbinary(64)")
private final byte[] digest;
@XmlElement
@Column(nullable = true)
@Column
@Enumerated(EnumType.ORDINAL)
@Getter
private final DigestAlgorithm algorithm;
@ -37,7 +37,7 @@ public final class OptionalDigest extends AbstractDigest {
* Creates a new <code>OptionalDigest</code>.
*
* @param digestAlgorithm algorithm used to generate the digest
* @param optionalDigest digest value
* @param optionalDigest digest value
* @throws IllegalArgumentException if digest length does not match that of the algorithm
*/
public OptionalDigest(final DigestAlgorithm digestAlgorithm, final byte[] optionalDigest)
@ -50,11 +50,22 @@ public final class OptionalDigest extends AbstractDigest {
/**
* Default constructor necessary for Hibernate.
*/
protected OptionalDigest() {
private OptionalDigest() {
this.algorithm = null;
this.digest = null;
}
/**
* Helper method to reverse the toString method. Returns an OptionalDigest given a String
* that was created using an AbstractDigest's toString method.
*
* @param digest String representation of an AbstractDigest
* @return OptionalDigest object recreated from the String passed in
*/
public static OptionalDigest fromString(final String digest) {
return new OptionalDigest(algorithmFromString(digest), digestFromString(digest));
}
/**
* Returns the digest.
*
@ -73,15 +84,4 @@ public final class OptionalDigest extends AbstractDigest {
public Digest asDigest() {
return new Digest(algorithm, digest);
}
/**
* Helper method to reverse the toString method. Returns an OptionalDigest given a String
* that was created using an AbstractDigest's toString method.
*
* @param digest String representation of an AbstractDigest
* @return OptionalDigest object recreated from the String passed in
*/
public static OptionalDigest fromString(final String digest) {
return new OptionalDigest(algorithmFromString(digest), digestFromString(digest));
}
}

View File

@ -18,6 +18,7 @@ public final class DeviceInfoEnums {
* Constant variable representing the various Long sized strings.
*/
public static final int LONG_STRING_LENGTH = 255;
/**
* Default private constructor so checkstyles doesn't complain.
*/

View File

@ -12,8 +12,7 @@ public class PolicyManagerException extends RuntimeException {
* Creates a new <code>PolicyManagerException</code> that has the message
* <code>msg</code>.
*
* @param msg
* exception message
* @param msg exception message
*/
public PolicyManagerException(final String msg) {
super(msg);
@ -23,8 +22,7 @@ public class PolicyManagerException extends RuntimeException {
* Creates a new <code>PolicyManagerException</code> that wraps the given
* <code>Throwable</code>.
*
* @param t
* root cause
* @param t root cause
*/
public PolicyManagerException(final Throwable t) {
super(t);
@ -34,10 +32,8 @@ public class PolicyManagerException extends RuntimeException {
* Creates a new <code>PolicyManagerException</code> that has the message
* <code>msg</code> and wraps the root cause.
*
* @param msg
* exception message
* @param t
* root cause
* @param msg exception message
* @param t root cause
*/
public PolicyManagerException(final String msg, final Throwable t) {
super(msg, t);

View File

@ -277,8 +277,8 @@ public class ReferenceManifestValidator {
filepath = file.getAttribute(SwidTagConstants.NAME);
}
if (getHashValue(filepath, "SHA256").equals(
file.getAttribute(SwidTagConstants._SHA256_HASH.getPrefix() + ":"
+ SwidTagConstants._SHA256_HASH.getLocalPart()))) {
file.getAttribute(SwidTagConstants.SHA_256_HASH.getPrefix() + ":"
+ SwidTagConstants.SHA_256_HASH.getLocalPart()))) {
log.info("Support RIM hash verified for {}", filepath);
return true;
} else {
@ -377,7 +377,7 @@ public class ReferenceManifestValidator {
*
* @param signature the signature that failed to validate
* @param context the context used for validation
* @throws XMLSignatureException
* @throws XMLSignatureException if there is an issue validating the provided signature
*/
private void whySignatureInvalid(final XMLSignature signature, final DOMValidateContext context)
throws XMLSignatureException {
@ -415,7 +415,7 @@ public class ReferenceManifestValidator {
throws Exception {
if (cert == null || trustStore == null) {
throw new Exception("Null certificate or truststore received");
} else if (trustStore.size() == 0) {
} else if (trustStore.isEmpty()) {
throw new Exception("Truststore is empty");
}
@ -542,9 +542,8 @@ public class ReferenceManifestValidator {
*
* @param pemString the input string
* @return an X509Certificate created from the string, or null
* @throws Exception if certificate cannot be successfully parsed
*/
private X509Certificate parseCertFromPEMString(final String pemString) throws Exception {
private X509Certificate parseCertFromPEMString(final String pemString) {
String certificateHeader = "-----BEGIN CERTIFICATE-----";
String certificateFooter = "-----END CERTIFICATE-----";
try {
@ -614,7 +613,7 @@ public class ReferenceManifestValidator {
*
* @param certificate the cert to pull the subjectKeyIdentifier from
* @return the String representation of the subjectKeyIdentifier
* @throws IOException
* @throws IOException if there are issues retrieving the certificate subject key identifier
*/
private String getCertificateSubjectKeyIdentifier(final X509Certificate certificate)
throws IOException {
@ -631,7 +630,7 @@ public class ReferenceManifestValidator {
/**
* This method parses the subject key identifier from the KeyName element of a signature.
*
* @param doc
* @param doc document
* @return SKID if found, or an empty string.
*/
private String getKeyName(final Document doc) {

View File

@ -78,83 +78,83 @@ public final class SwidTagConstants {
public static final String FX_SEPARATOR = ":";
public static final String RFC3852_PFX = "rcf3852";
public static final String RFC3339_PFX = "rcf3339";
public static final String _COLLOQUIAL_VERSION_STR = N8060_PFX + FX_SEPARATOR
public static final String COLLOQUIAL_VERSION_STR = N8060_PFX + FX_SEPARATOR
+ COLLOQUIAL_VERSION;
public static final String _PRODUCT_STR = N8060_PFX + FX_SEPARATOR
public static final String PRODUCT_STR = N8060_PFX + FX_SEPARATOR
+ PRODUCT;
public static final String _REVISION_STR = N8060_PFX + FX_SEPARATOR
public static final String REVISION_STR = N8060_PFX + FX_SEPARATOR
+ REVISION;
public static final String _EDITION_STR = N8060_PFX + FX_SEPARATOR
public static final String EDITION_STR = N8060_PFX + FX_SEPARATOR
+ EDITION;
public static final String _RIM_LINK_HASH_STR = RIM_PFX + FX_SEPARATOR
public static final String RIM_LINK_HASH_STR = RIM_PFX + FX_SEPARATOR
+ RIM_LINK_HASH;
public static final String _BINDING_SPEC_STR = RIM_PFX + FX_SEPARATOR
public static final String BINDING_SPEC_STR = RIM_PFX + FX_SEPARATOR
+ BINDING_SPEC;
public static final String _BINDING_SPEC_VERSION_STR = RIM_PFX + FX_SEPARATOR
public static final String BINDING_SPEC_VERSION_STR = RIM_PFX + FX_SEPARATOR
+ BINDING_SPEC_VERSION;
public static final String _PLATFORM_MANUFACTURER_STR = RIM_PFX + FX_SEPARATOR
public static final String PLATFORM_MANUFACTURER_FULL_STR = RIM_PFX + FX_SEPARATOR
+ PLATFORM_MANUFACTURER_STR;
public static final String _PLATFORM_MANUFACTURER_ID_STR = RIM_PFX + FX_SEPARATOR
public static final String PLATFORM_MANUFACTURER_ID_STR = RIM_PFX + FX_SEPARATOR
+ PLATFORM_MANUFACTURER_ID;
public static final String _PLATFORM_MODEL_STR = RIM_PFX + FX_SEPARATOR
public static final String PLATFORM_MODEL_STR = RIM_PFX + FX_SEPARATOR
+ PLATFORM_MODEL;
public static final String _PLATFORM_VERSION_STR = RIM_PFX + FX_SEPARATOR
public static final String PLATFORM_VERSION_STR = RIM_PFX + FX_SEPARATOR
+ PLATFORM_VERSION;
public static final String _PAYLOAD_TYPE_STR = RIM_PFX + FX_SEPARATOR
public static final String PAYLOAD_TYPE_STR = RIM_PFX + FX_SEPARATOR
+ PAYLOAD_TYPE;
public static final String _PC_URI_LOCAL_STR = RIM_PFX + FX_SEPARATOR
public static final String PC_URI_LOCAL_STR = RIM_PFX + FX_SEPARATOR
+ PC_URI_LOCAL;
public static final String _PC_URI_GLOBAL_STR = RIM_PFX + FX_SEPARATOR
public static final String PC_URI_GLOBAL_STR = RIM_PFX + FX_SEPARATOR
+ PC_URI_GLOBAL;
public static final QName _SHA256_HASH = new QName(
public static final QName SHA_256_HASH = new QName(
"http://www.w3.org/2001/04/xmlenc#sha256", HASH, "SHA256");
public static final QName _COLLOQUIAL_VERSION = new QName(
public static final QName QNAME_COLLOQUIAL_VERSION = new QName(
NIST_NS, COLLOQUIAL_VERSION, N8060_PFX);
public static final QName _EDITION = new QName(
public static final QName QNAME_EDITION = new QName(
NIST_NS, EDITION, N8060_PFX);
public static final QName _PRODUCT = new QName(
public static final QName QNAME_PRODUCT = new QName(
NIST_NS, PRODUCT, N8060_PFX);
public static final QName _REVISION = new QName(
public static final QName QNAME_REVISION = new QName(
NIST_NS, REVISION, N8060_PFX);
public static final QName _PAYLOAD_TYPE = new QName(
public static final QName QNAME_PAYLOAD_TYPE = new QName(
TCG_NS, PAYLOAD_TYPE, RIM_PFX);
public static final QName _PLATFORM_MANUFACTURER = new QName(
public static final QName QNAME_PLATFORM_MANUFACTURER = new QName(
TCG_NS, PLATFORM_MANUFACTURER_STR, RIM_PFX);
public static final QName _PLATFORM_MANUFACTURER_ID = new QName(
public static final QName QNAME_PLATFORM_MANUFACTURER_ID = new QName(
TCG_NS, PLATFORM_MANUFACTURER_ID, RIM_PFX);
public static final QName _PLATFORM_MODEL = new QName(
public static final QName QNAME_PLATFORM_MODEL = new QName(
TCG_NS, PLATFORM_MODEL, RIM_PFX);
public static final QName _PLATFORM_VERSION = new QName(
public static final QName QNAME_PLATFORM_VERSION = new QName(
TCG_NS, PLATFORM_VERSION, RIM_PFX);
public static final QName _FIRMWARE_MANUFACTURER_STR = new QName(
public static final QName QNAME_FIRMWARE_MANUFACTURER_STR = new QName(
TCG_NS, FIRMWARE_MANUFACTURER_STR, RIM_PFX);
public static final QName _FIRMWARE_MANUFACTURER_ID = new QName(
public static final QName QNAME_FIRMWARE_MANUFACTURER_ID = new QName(
TCG_NS, FIRMWARE_MANUFACTURER_ID, RIM_PFX);
public static final QName _FIRMWARE_MODEL = new QName(
public static final QName QNAME_FIRMWARE_MODEL = new QName(
TCG_NS, FIRMWARE_MODEL, RIM_PFX);
public static final QName _FIRMWARE_VERSION = new QName(
public static final QName QNAME_FIRMWARE_VERSION = new QName(
TCG_NS, FIRMWARE_VERSION, RIM_PFX);
public static final QName _BINDING_SPEC = new QName(
public static final QName QNAME_BINDING_SPEC = new QName(
TCG_NS, BINDING_SPEC, RIM_PFX);
public static final QName _BINDING_SPEC_VERSION = new QName(
public static final QName QNAME_BINDING_SPEC_VERSION = new QName(
TCG_NS, BINDING_SPEC_VERSION, RIM_PFX);
public static final QName _PC_URI_LOCAL = new QName(
public static final QName QNAME_PC_URI_LOCAL = new QName(
TCG_NS, PC_URI_LOCAL, RIM_PFX);
public static final QName _PC_URI_GLOBAL = new QName(
public static final QName QNAME_PC_URI_GLOBAL = new QName(
TCG_NS, PC_URI_GLOBAL, RIM_PFX);
public static final QName _RIM_LINK_HASH = new QName(
public static final QName QNAME_RIM_LINK_HASH = new QName(
TCG_NS, RIM_LINK_HASH, RIM_PFX);
public static final QName _SUPPORT_RIM_TYPE = new QName(
public static final QName QNAME_SUPPORT_RIM_TYPE = new QName(
TCG_NS, SUPPORT_RIM_TYPE, RIM_PFX);
public static final QName _SUPPORT_RIM_FORMAT = new QName(
public static final QName QNAME_SUPPORT_RIM_FORMAT = new QName(
TCG_NS, SUPPORT_RIM_FORMAT, RIM_PFX);
public static final QName _SUPPORT_RIM_URI_GLOBAL = new QName(
public static final QName QNAME_SUPPORT_RIM_URI_GLOBAL = new QName(
TCG_NS, SUPPORT_RIM_URI_GLOBAL, RIM_PFX);
public static final QName _N8060_ENVVARPREFIX = new QName(
public static final QName N8060_ENVVARPREFIX = new QName(
NIST_NS, "envVarPrefix", N8060_PFX);
public static final QName _N8060_ENVVARSUFFIX = new QName(
public static final QName N8060_ENVVARSUFFIX = new QName(
NIST_NS, "envVarSuffix", N8060_PFX);
public static final QName _N8060_PATHSEPARATOR = new QName(
public static final QName N8060_PATHSEPARATOR = new QName(
NIST_NS, "pathSeparator", N8060_PFX);
public static final String CA_ISSUERS = "1.3.6.1.5.5.7.48.2";

View File

@ -12,8 +12,7 @@ public class TPMBaselineGeneratorException extends Exception {
* Creates a new <code>CreateTPMBaselineException</code> that has the
* message <code>msg</code>.
*
* @param msg
* exception message
* @param msg exception message
*/
TPMBaselineGeneratorException(final String msg) {
super(msg);
@ -23,8 +22,7 @@ public class TPMBaselineGeneratorException extends Exception {
* Creates a new <code>CreateTPMBaselineException</code> that wraps the
* given <code>Throwable</code>.
*
* @param t
* root cause
* @param t root cause
*/
TPMBaselineGeneratorException(final Throwable t) {
super(t);
@ -34,10 +32,8 @@ public class TPMBaselineGeneratorException extends Exception {
* Creates a new <code>CreateTPMBaselineException</code> that has the
* message <code>msg</code> and wraps the root cause.
*
* @param msg
* exception message
* @param t
* root cause
* @param msg exception message
* @param t root cause
*/
TPMBaselineGeneratorException(final String msg, final Throwable t) {
super(msg, t);

View File

@ -25,56 +25,104 @@ import java.util.LinkedHashMap;
*/
public final class TCGEventLog {
/** Logger. */
private static final Logger LOGGER = LogManager.getLogger(TCGEventLog.class);
/** Name of the hash algorithm used to process the Event Log, default is SHA256. */
@Getter
private String eventLogHashAlgorithm = "TPM_ALG_SHA256";
/** Parsed event log array. */
private static final int SIG_OFFSET = 32;
/** TEV_NO_ACTION signature size. */
private static final int SIG_SIZE = 16;
/** Initial value for SHA 256 values.*/
/**
* Initial value for SHA 256 values.
*/
public static final String INIT_SHA256_LIST = "00000000000000000000000000"
+ "00000000000000000000000000000000000000";
/** Initial value for SHA 256 values.*/
/**
* Initial value for SHA 256 values.
*/
public static final String LOCALITY4_SHA256_LIST = "ffffffffffffffffffffffffff"
+ "ffffffffffffffffffffffffffffffffffffff";
/** Initial value for SHA 1 values. */
/**
* Initial value for SHA 1 values.
*/
public static final String INIT_SHA1_LIST = "0000000000000000000000000000000000000000";
/** Initial value for SHA 1 values. */
/**
* Initial value for SHA 1 values.
*/
public static final String LOCALITY4_SHA1_LIST = "ffffffffffffffffffffffffffffffffffffffff";
/** PFP defined EV_NO_ACTION identifier. */
/**
* PFP defined EV_NO_ACTION identifier.
*/
public static final int NO_ACTION_EVENT = 0x00000003;
/** String value of SHA1 hash.*/
/**
* String value of SHA1 hash.
*/
public static final String HASH_STRING = "SHA1";
/** String value of SHA256 hash. */
/**
* String value of SHA256 hash.
*/
public static final String HASH256_STRING = "SHA-256";
/** Each PCR bank holds 24 registers. */
/**
* Each PCR bank holds 24 registers.
*/
public static final int PCR_COUNT = 24;
/** Locality 4 starts at PCR 17. */
/**
* Locality 4 starts at PCR 17.
*/
public static final int PCR_LOCALITY4_MIN = 17;
/** Locality 4 Ends at PCR 23. */
/**
* Locality 4 Ends at PCR 23.
*/
public static final int PCR_LOCALITY4_MAX = 23;
/** 2 dimensional array holding the PCR values. */
private byte[][] pcrList;
/** List of parsed events within the log. */
private LinkedHashMap<Integer, TpmPcrEvent> eventList = new LinkedHashMap<>();
/** Length of PCR. Indicates which hash algorithm is used. */
private int pcrLength;
/** Name of hash algorithm. */
private String hashType;
/** Initial PCR Value to use. */
private String initValue;
/** Initial PcR Value to use for locality 4. */
private String initLocalityFourValue;
/** Content Output Flag use. */
/**
* Logger.
*/
private static final Logger LOGGER = LogManager.getLogger(TCGEventLog.class);
/**
* Parsed event log array.
*/
private static final int SIG_OFFSET = 32;
/**
* TEV_NO_ACTION signature size.
*/
private static final int SIG_SIZE = 16;
/**
* Name of the hash algorithm used to process the Event Log, default is SHA256.
*/
@Getter
private String eventLogHashAlgorithm = "TPM_ALG_SHA256";
/**
* 2 dimensional array holding the PCR values.
*/
private final byte[][] pcrList;
/**
* List of parsed events within the log.
*/
private final LinkedHashMap<Integer, TpmPcrEvent> eventList = new LinkedHashMap<>();
/**
* Length of PCR. Indicates which hash algorithm is used.
*/
private final int pcrLength;
/**
* Name of hash algorithm.
*/
private final String hashType;
/**
* Initial PCR Value to use.
*/
private final String initValue;
/**
* Initial PcR Value to use for locality 4.
*/
private final String initLocalityFourValue;
/**
* Content Output Flag use.
*/
private boolean bContent = false;
/** Event Output Flag use. */
/**
* Event Output Flag use.
*/
private boolean bHexEvent = false;
/** Event Output Flag use. */
/**
* Event Output Flag use.
*/
private boolean bEvent = false;
/** Event Output Flag use. */
/**
* Event Output Flag use.
*/
@Getter
private boolean bCryptoAgile = false;
/**
@ -111,29 +159,31 @@ public final class TCGEventLog {
/**
* Simple constructor for Event Log.
*
* @param rawlog data for the event log file.
* @throws java.security.NoSuchAlgorithmException if an unknown algorithm is encountered.
* @throws java.security.NoSuchAlgorithmException if an unknown algorithm is encountered.
* @throws java.security.cert.CertificateException if a certificate in the log cannot be parsed.
* @throws java.io.IOException IO Stream if event cannot be parsed.
* @throws java.io.IOException IO Stream if event cannot be parsed.
*/
public TCGEventLog(final byte[] rawlog)
throws CertificateException, NoSuchAlgorithmException, IOException {
throws CertificateException, NoSuchAlgorithmException, IOException {
this(rawlog, false, false, false);
}
/**
* Default constructor for just the rawlog that'll set up SHA1 Log.
* @param rawlog data for the event log file.
* @param bEventFlag if true provides human readable event descriptions.
* @param bContentFlag if true provides hex output for Content in the description.
*
* @param rawlog data for the event log file.
* @param bEventFlag if true provides human readable event descriptions.
* @param bContentFlag if true provides hex output for Content in the description.
* @param bHexEventFlag if true provides hex event structure in the description.
* @throws java.security.NoSuchAlgorithmException if an unknown algorithm is encountered.
* @throws java.security.NoSuchAlgorithmException if an unknown algorithm is encountered.
* @throws java.security.cert.CertificateException if a certificate in the log cannot be parsed.
* @throws java.io.IOException IO Stream if event cannot be parsed.
* @throws java.io.IOException IO Stream if event cannot be parsed.
*/
public TCGEventLog(final byte[] rawlog, final boolean bEventFlag,
final boolean bContentFlag, final boolean bHexEventFlag)
throws CertificateException, NoSuchAlgorithmException, IOException {
throws CertificateException, NoSuchAlgorithmException, IOException {
bCryptoAgile = isLogCrytoAgile(rawlog);
if (bCryptoAgile) {
@ -194,18 +244,18 @@ public final class TCGEventLog {
* This method puts blank values in the pcrList.
*/
private void initPcrList() {
try {
for (int i = 0; i < PCR_COUNT; i++) {
System.arraycopy(Hex.decodeHex(initValue.toCharArray()),
try {
for (int i = 0; i < PCR_COUNT; i++) {
System.arraycopy(Hex.decodeHex(initValue.toCharArray()),
0, pcrList[i], 0, pcrLength);
}
for (int i = PCR_LOCALITY4_MIN; i < PCR_LOCALITY4_MAX; i++) {
System.arraycopy(Hex.decodeHex(initLocalityFourValue.toCharArray()),
0, pcrList[i], 0, pcrLength);
}
} catch (DecoderException deEx) {
LOGGER.error(deEx);
}
for (int i = PCR_LOCALITY4_MIN; i < PCR_LOCALITY4_MAX; i++) {
System.arraycopy(Hex.decodeHex(initLocalityFourValue.toCharArray()),
0, pcrList[i], 0, pcrLength);
}
} catch (DecoderException deEx) {
LOGGER.error(deEx);
}
}
// /**
@ -298,6 +348,7 @@ public final class TCGEventLog {
/**
* Returns a list of event found in the Event Log.
*
* @return an arraylist of event.
*/
public Collection<TpmPcrEvent> getEventList() {
@ -307,6 +358,7 @@ public final class TCGEventLog {
/**
* Returns a specific element of the Event Log that corresponds to the requested
* event number.
*
* @param eventNumber specific event to find in the list.
* @return TPM Event in the position of the list
*/
@ -326,6 +378,7 @@ public final class TCGEventLog {
/**
* Human readable string representing the contents of the Event Log.
*
* @return Description of the log.
*/
public String toString() {
@ -334,14 +387,15 @@ public final class TCGEventLog {
sb.append(event.toString(bEvent, bHexEvent, bContent));
}
sb.append("Event Log processing completed.\n");
return sb.toString();
return sb.toString();
}
/**
* Human readable string representing the contents of the Event Log.
* @param event flag to set
*
* @param event flag to set
* @param hexEvent flag to set
* @param content flag to set
* @param content flag to set
* @return Description of the log.
*/
public String toString(final boolean event,
@ -357,10 +411,11 @@ public final class TCGEventLog {
/**
* Returns the TCG Algorithm Registry defined ID for the Digest Algorithm
* used in the event log.
*
* @return TCG Defined Algorithm name
*/
public int getEventLogHashAlgorithmID() {
return TcgTpmtHa.tcgAlgStringToId(eventLogHashAlgorithm);
return TcgTpmtHa.tcgAlgStringToId(eventLogHashAlgorithm);
}
/**

View File

@ -17,66 +17,80 @@ import java.math.BigInteger;
* } TPMT_HA;
*/
public class TcgTpmtHa {
/**
* TCG ID for SHA1.
*/
public static final int TPM_ALG_SHA1 = 0x04;
/**
* TCG ID for SHA1.
*/
public static final int TPM_ALG_SHA256 = 0x0B;
/**
* TCG ID for SHA 384.
*/
public static final int TPM_ALG_SHA384 = 0x0C;
/**
* TCG ID for SHA512.
*/
public static final int TPM_ALG_SHA_512 = 0x0D;
/**
* TCG ID for Null algorithm.
*/
public static final int TPM_ALG_NULL = 0x10;
/**
* TCG ID for SHA1.
*/
public static final int TPM_ALG_SHA1_LENGTH = 20;
/**
* TCG ID for SHA1.
*/
public static final int TPM_ALG_SHA256_LENGTH = 32;
/**
* TCG ID for SHA 384.
*/
public static final int TPM_ALG_SHA384_LENGTH = 48;
/**
* TCG ID for SHA512.
*/
public static final int TPM_ALG_SHA512_LENGTH = 64;
/**
* TCG ID for Null algorithm.
*/
public static final int TPM_ALG_NULL_LENGTH = 0;
/**
* TCG Defined Algorithm Identifiers.
*/
@Getter
private int hashAlgId = 0;
/**
* Length of the hash.
*/
@Getter
private int hashLength = 0;
/**
* Human readable name of the hash algorithm.
* Human-readable name of the hash algorithm.
*/
@Getter
private String hashName = "";
/**
* Hash data.
*/
@Getter(value = AccessLevel.PROTECTED)
private byte[] digest = null;
/**
* TCG ID for SHA1.
*/
public static final int TPM_ALG_SHA1 = 0x04;
/**
* TCG ID for SHA1.
*/
public static final int TPM_ALG_SHA256 = 0x0B;
/**
* TCG ID for SHA 384.
*/
public static final int TPM_ALG_SHA384 = 0x0C;
/**
* TCG ID for SHA512.
*/
public static final int TPM_ALG_SHA_512 = 0x0D;
/**
* TCG ID for Null algorithm.
*/
public static final int TPM_ALG_NULL = 0x10;
/**
* TCG ID for SHA1.
*/
public static final int TPM_ALG_SHA1_LENGTH = 20;
/**
* TCG ID for SHA1.
*/
public static final int TPM_ALG_SHA256_LENGTH = 32;
/**
* TCG ID for SHA 384.
*/
public static final int TPM_ALG_SHA384_LENGTH = 48;
/**
* TCG ID for SHA512.
*/
public static final int TPM_ALG_SHA512_LENGTH = 64;
/**
* TCG ID for Null algorithm.
*/
public static final int TPM_ALG_NULL_LENGTH = 0;
/**
* buffer to hold the structure.
*/
@ -102,6 +116,61 @@ public class TcgTpmtHa {
System.arraycopy(digest, 0, buffer, algID.length, digest.length);
}
/**
* Returns the hash name via a lookup.
* Lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document.
* Only hash algorithms found in Table 7 are used.
*
* @param algId int to convert to string
* @return name of the algorithm
*/
public static String tcgAlgIdToString(final int algId) {
return switch (algId) {
case TPM_ALG_SHA1 -> "TPM_ALG_SHA1";
case TPM_ALG_SHA256 -> "TPM_ALG_SHA256";
case TPM_ALG_SHA384 -> "TPM_ALG_SHA384";
case TPM_ALG_SHA_512 -> "TPM_ALG_SHA512";
case TPM_ALG_NULL -> "TPM_ALG_NULL";
default -> "Unknown or invalid Hash";
};
}
/**
* Returns the TCG defined ID via a lookup o the TCG Defined Algorithm String.
* Lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document.
* Only hash algorithms found in Table 7 are used.
*
* @param algorithm String to convert to an id
* @return id of hash algorithm
*/
public static int tcgAlgStringToId(final String algorithm) {
return switch (algorithm) {
case "TPM_ALG_SHA1" -> TPM_ALG_SHA1;
case "TPM_ALG_SHA256" -> TPM_ALG_SHA256;
case "TPM_ALG_SHA384" -> TPM_ALG_SHA384;
case "TPM_ALG_SHA512" -> TPM_ALG_SHA_512;
default -> TPM_ALG_NULL;
};
}
/**
* Sets the length of a given TPM ALG Identifier.
* (lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document)
* Only hash algorithms found in Table 7 are used.
*
* @param algId TCG defined Algorithm identifier
* @return length of hash data in bytes
*/
public static int tcgAlgLength(final int algId) {
return switch (algId) {
case TPM_ALG_SHA1 -> TPM_ALG_SHA1_LENGTH;
case TPM_ALG_SHA256 -> TPM_ALG_SHA256_LENGTH;
case TPM_ALG_SHA384 -> TPM_ALG_SHA384_LENGTH;
case TPM_ALG_SHA_512 -> TPM_ALG_SHA512_LENGTH;
default -> TPM_ALG_NULL_LENGTH;
};
}
/**
* Returns the contents of the TPMT_HA structure buffer.
*
@ -120,96 +189,4 @@ public class TcgTpmtHa {
public String toString() {
return String.format("%s hash = %s", hashName, HexUtils.byteArrayToHexString(digest));
}
/**
* Returns the hash name via a lookup.
* Lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document.
* Only hash algorithms found in Table 7 are used.
*
* @param algId int to convert to string
* @return name of the algorithm
*/
public static String tcgAlgIdToString(final int algId) {
String alg;
switch (algId) {
case TPM_ALG_SHA1:
alg = "TPM_ALG_SHA1";
break;
case TPM_ALG_SHA256:
alg = "TPM_ALG_SHA256";
break;
case TPM_ALG_SHA384:
alg = "TPM_ALG_SHA384";
break;
case TPM_ALG_SHA_512:
alg = "TPM_ALG_SHA512";
break;
case TPM_ALG_NULL:
alg = "TPM_ALG_NULL";
break;
default:
alg = "Unknown or invalid Hash";
}
return alg;
}
/**
* Returns the TCG defined ID via a lookup o the TCG Defined Algorithm String.
* Lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document.
* Only hash algorithms found in Table 7 are used.
*
* @param algorithm String to convert to an id
* @return id of hash algorithm
*/
public static int tcgAlgStringToId(final String algorithm) {
int alg;
switch (algorithm) {
case "TPM_ALG_SHA1":
alg = TPM_ALG_SHA1;
break;
case "TPM_ALG_SHA256":
alg = TPM_ALG_SHA256;
break;
case "TPM_ALG_SHA384":
alg = TPM_ALG_SHA384;
break;
case "TPM_ALG_SHA512":
alg = TPM_ALG_SHA_512;
break;
case "TPM_ALG_NULL":
default:
alg = TPM_ALG_NULL;
}
return alg;
}
/**
* Sets the length of a given TPM ALG Identifier.
* (lookup based upon section 6.3 for the TPM-Rev-2.0-Part-2-Structures.pdf document)
* Only hash algorithms found in Table 7 are used.
*
* @param algId TCG defined Algorithm identifier
* @return length of hash data in bytes
*/
public static int tcgAlgLength(final int algId) {
int length;
switch (algId) {
case TPM_ALG_SHA1:
length = TPM_ALG_SHA1_LENGTH;
break;
case TPM_ALG_SHA256:
length = TPM_ALG_SHA256_LENGTH;
break;
case TPM_ALG_SHA384:
length = TPM_ALG_SHA384_LENGTH;
break;
case TPM_ALG_SHA_512:
length = TPM_ALG_SHA512_LENGTH;
break;
case TPM_ALG_NULL:
default:
length = TPM_ALG_NULL_LENGTH;
}
return length;
}
}

View File

@ -3,17 +3,17 @@ package hirs.utils.tpm.eventlog;
import hirs.utils.HexUtils;
import hirs.utils.tpm.eventlog.events.EvCompactHash;
import hirs.utils.tpm.eventlog.events.EvConstants;
import hirs.utils.tpm.eventlog.events.EvEfiBootServicesApp;
import hirs.utils.tpm.eventlog.events.EvEfiGptPartition;
import hirs.utils.tpm.eventlog.events.EvEfiHandoffTable;
import hirs.utils.tpm.eventlog.events.EvEfiSpdmDeviceSecurityEvent;
import hirs.utils.tpm.eventlog.events.EvEventTag;
import hirs.utils.tpm.eventlog.events.EvIPL;
import hirs.utils.tpm.eventlog.events.EvNoAction;
import hirs.utils.tpm.eventlog.events.EvPostCode;
import hirs.utils.tpm.eventlog.events.EvSCrtmContents;
import hirs.utils.tpm.eventlog.events.EvSCrtmVersion;
import hirs.utils.tpm.eventlog.uefi.UefiConstants;
import hirs.utils.tpm.eventlog.events.EvEfiBootServicesApp;
import hirs.utils.tpm.eventlog.events.EvPostCode;
import hirs.utils.tpm.eventlog.uefi.UefiFirmware;
import hirs.utils.tpm.eventlog.uefi.UefiVariable;
import lombok.AccessLevel;
@ -61,60 +61,77 @@ public class TpmPcrEvent {
* Log format. SHA1=1, Crytpo agile=2.
* this can be refactored out
*/
@Getter @Setter(value = AccessLevel.PROTECTED)
@Getter
@Setter(value = AccessLevel.PROTECTED)
private int logFormat = -1;
/**
* PCR index.
*/
@Getter
private int pcrIndex = -1;
/**
* Event Type (long).
*/
@Getter
private long eventType = 0;
/**
* Event digest.
*/
private byte[] digest = null;
/**
* Event data (no content).
*/
private byte[] event;
/**
* Event content data.
*/
private byte[] eventContent;
/**
* TCG Event Log spec version.
*/
@Getter
private String specVersion = "Unknown";
/**
* TCG Event Log errata version.
*/
@Getter
private String specErrataVersion = "Unknown";
/**
* Description for toString support.
*/
private String description = "";
/**
* Length (in bytes) of a pcr.
*/
@Setter @Getter
@Getter
@Setter
private int digestLength = 0;
/**
* Event hash for SHA1 event logs.
*/
private byte[] eventDataSha1hash;
/**
* Event hash for Crypto Agile events.
*/
private byte[] eventDataSha256hash;
@Setter @Getter
@Getter
@Setter
private int eventNumber;
@Setter @Getter
@Getter
@Setter
private boolean error = false;
/**
@ -147,403 +164,6 @@ public class TpmPcrEvent {
}
/**
* Sets the digest from a TCG_PCR_EVENT digest field.
* This can be SHA1 for older event structures or any algorithm for newer structure.
*
* @param data cryptographic hash
* @param length length of the cryptographic hash
*/
protected void setEventDigest(final byte[] data, final int length) {
digest = new byte[length];
System.arraycopy(data, 0, digest, 0, length);
}
/**
* Retrieves the digest from a TCG Event.
* This can be SHA1 for older event structures or any algorithm for newer structure.
*
* @return the digest data for the event
*/
public byte[] getEventDigest() {
byte[] digestCopy = new byte[digestLength];
System.arraycopy(digest, 0, digestCopy, 0, this.digestLength);
return digestCopy;
}
/**
* Returns a hex representation of the event digest.
* @return hex string
*/
public String getEventDigestStr() {
return Hex.encodeHexString(this.digest);
}
/**
* Sets the event PCR index value from a TCG Event.
*
* @param eventIndex TCG Event PCR Index as defined in the PFP
*/
protected void setPcrIndex(final byte[] eventIndex) {
pcrIndex = HexUtils.leReverseInt(eventIndex);
}
/**
* Sets the EventType.
*
* @param type byte array holding the PFP defined log event type
*/
protected void setEventType(final byte[] type) {
eventType = new BigInteger(1, HexUtils.leReverseByte(type)).longValue();
}
/**
* Returns a formatted string of the type for the event.
* @return a string formatted to be human readable
*/
public String getEventTypeStr() {
return String.format("0x%s %s", Long.toHexString(eventType), eventString((int) eventType));
}
/**
* Returns a formatted string of the type for the event minus the byte code.
* @return a string formatted to be human readable
*/
public String getEventTypeString() {
return eventString((int) eventType);
}
/**
* Sets the event data after processing.
*
* @param eventData The PFP defined event content
*/
protected void setEventData(final byte[] eventData) {
event = new byte[eventData.length];
System.arraycopy(eventData, 0, event, 0, eventData.length);
}
/**
* Gets the Event Data (no event content) for the event.
* event log format.
*
* @return byte array holding the event structure.
*/
public byte[] getEvent() {
return Arrays.copyOf(event, event.length);
}
/**
* Sets the event content after processing.
*
* @param eventData The PFP defined event content
*/
protected void setEventContent(final byte[] eventData) {
eventContent = new byte[eventData.length];
//EvPostCode evPostCode = new EvPostCode(eventContent);
System.arraycopy(eventData, 0, eventContent, 0, eventData.length);
}
/**
* Gets the event Content Data (not the entire event structure).
*
* @return byte array holding the events content field
*/
public byte[] getEventContent() {
return Arrays.copyOf(eventContent, eventContent.length);
}
/**
* A getter that parses the content based on the type and returns the proper string
* value for the content.
* @return an appended string of human readable data
*/
public String getEventContentStr() {
StringBuilder sb = new StringBuilder();
switch ((int) this.eventType) {
case EvConstants.EV_PREBOOT_CERT:
sb.append(" EV_PREBOOT_CERT");
break;
case EvConstants.EV_POST_CODE:
sb.append(new EvPostCode(eventContent).toString());
break;
case EvConstants.EV_UNUSED:
break;
case EvConstants.EV_NO_ACTION:
EvNoAction noAction = null;
try {
noAction = new EvNoAction(eventContent);
sb.append(noAction.toString());
if (noAction.isSpecIDEvent()) {
specVersion = noAction.getSpecVersion();
specErrataVersion = noAction.getSpecErrataVersion();
}
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx.toString());
}
break;
case EvConstants.EV_SEPARATOR:
if (EvPostCode.isAscii(eventContent)
&& !this.isBlank(eventContent)) {
sb.append(String.format("Separator event content = %s",
new String(eventContent, StandardCharsets.UTF_8)));
}
break;
case EvConstants.EV_EVENT_TAG:
sb.append(new EvEventTag(eventContent).toString());
break;
case EvConstants.EV_S_CRTM_CONTENTS:
sb.append(new EvSCrtmContents(eventContent).toString());
break;
case EvConstants.EV_S_CRTM_VERSION:
try {
sb.append(new EvSCrtmVersion(eventContent).toString());
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx.toString());
}
break;
case EvConstants.EV_CPU_MICROCODE:
case EvConstants.EV_PLATFORM_CONFIG_FLAGS:
case EvConstants.EV_TABLE_OF_DEVICES:
break;
case EvConstants.EV_COMPACT_HASH:
try {
sb.append(new EvCompactHash(eventContent).toString());
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx.toString());
}
break;
case EvConstants.EV_IPL:
sb.append(new EvIPL(eventContent).toString());
break;
case EvConstants.EV_IPL_PARTITION_DATA:
case EvConstants.EV_NONHOST_CODE:
case EvConstants.EV_NONHOST_CONFIG:
case EvConstants.EV_NONHOST_INFO:
case EvConstants.EV_EV_OMIT_BOOT_DEVICES_EVENTS:
case EvConstants.EV_EFI_EVENT_BASE:
break;
case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG:
case EvConstants.EV_EFI_VARIABLE_BOOT:
case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
case EvConstants.EV_EFI_SPDM_DEVICE_POLICY:
case EvConstants.EV_EFI_SPDM_DEVICE_AUTHORITY:
try {
sb.append(new UefiVariable(eventContent).toString());
} catch (CertificateException cEx) {
log.error(cEx);
sb.append(cEx.toString());
} catch (NoSuchAlgorithmException noSaEx) {
log.error(noSaEx);
sb.append(noSaEx.toString());
} catch (IOException ioEx) {
log.error(ioEx);
sb.append(ioEx.toString());
}
break;
case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION:
case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER: // same as EV_EFI_BOOT_SERVICES_APP
try {
sb.append(new EvEfiBootServicesApp(eventContent).toString());
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx.toString());
}
break;
case EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER:
break;
case EvConstants.EV_EFI_GPT_EVENT:
try {
sb.append(new EvEfiGptPartition(eventContent).toString());
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx.toString());
}
break;
case EvConstants.EV_EFI_ACTION:
case EvConstants.EV_ACTION:
sb.append(new String(eventContent, StandardCharsets.UTF_8));
break;
case EvConstants.EV_EFI_PLATFORM_FIRMWARE_BLOB:
sb.append(new UefiFirmware(eventContent).toString());
break;
case EvConstants.EV_EFI_HANDOFF_TABLES:
sb.append(new EvEfiHandoffTable(eventContent).toString());
break;
case EvConstants.EV_EFI_HCRTM_EVENT:
break;
case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB:
case EvConstants.EV_EFI_SPDM_FIRMWARE_CONFIG:
sb.append(new EvEfiSpdmDeviceSecurityEvent(eventContent).toString());
break;
default:
sb.append("Unknown Event found\n");
}
return cleanTextContent(sb.toString());
}
/**
* Parses the event content and creates a human readable description of each event.
*
* @param eventData the byte array holding the event data.
* @param content the byte array holding the event content.
* @param eventPosition event position within the event log.
* @param hashName name of the hash algorithm used by the event log
* @return String description of the event.
* @throws CertificateException if the event contains an event that cannot be processed.
* @throws NoSuchAlgorithmException if an event contains an unsupported algorithm.
* @throws java.io.IOException if the event cannot be parsed.
*/
public String processEvent(final byte[] eventData, final byte[] content,
final int eventPosition, final String hashName)
throws CertificateException, NoSuchAlgorithmException, IOException {
int eventID = (int) eventType;
this.eventNumber = eventPosition;
description += "Event# " + eventPosition + ": ";
description += "Index PCR[" + getPcrIndex() + "]\n";
description += "Event Type: 0x" + Long.toHexString(eventType) + " " + eventString(eventID);
description += "\n";
if (hashName.compareToIgnoreCase("TPM_ALG_SHA1") == 0) { // Digest
description += "digest (SHA-1): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA256") == 0) { // Digest
description += "digest (SHA256): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA384") == 0) { // Digest
description += "digest (SHA384): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA512") == 0) { // Digest
description += "digest (SHA512): " + Hex.encodeHexString(this.digest);
} else {
description += "Unsupported Hash Algorithm encountered";
}
if (eventID != UefiConstants.SIZE_4) {
description += "\n";
}
// Calculate both the SHA1 and SHA256 on the event since this will equal the digest
// field of about half the log messages.
MessageDigest md1 = MessageDigest.getInstance("SHA-1");
md1.update(eventData);
eventDataSha1hash = md1.digest();
MessageDigest md2 = MessageDigest.getInstance("SHA-256");
md2.update(eventData);
eventDataSha256hash = md2.digest();
switch (eventID) {
case EvConstants.EV_PREBOOT_CERT:
description += " EV_PREBOOT_CERT" + "\n";
break;
case EvConstants.EV_POST_CODE:
EvPostCode postCode = new EvPostCode(content);
description += "Event Content:\n" + postCode.toString();
break;
case EvConstants.EV_UNUSED:
break;
case EvConstants.EV_NO_ACTION:
EvNoAction noAction = new EvNoAction(content);
description += "Event Content:\n" + noAction.toString();
if (noAction.isSpecIDEvent()) {
specVersion = noAction.getSpecVersion();
specErrataVersion = noAction.getSpecErrataVersion();
}
pciidsFileStatus = noAction.getPciidsFileStatus();
break;
case EvConstants.EV_SEPARATOR:
if (EvPostCode.isAscii(content)) {
String separatorEventData = new String(content, StandardCharsets.UTF_8);
if (!this.isBlank(content)) {
description += "Separator event content = " + separatorEventData;
}
}
break;
case EvConstants.EV_ACTION:
description += "Event Content:\n"
+ new String(content, StandardCharsets.UTF_8);
break;
case EvConstants.EV_EVENT_TAG:
EvEventTag eventTag = new EvEventTag(content);
description += eventTag.toString();
break;
case EvConstants.EV_S_CRTM_CONTENTS:
EvSCrtmContents sCrtmContents = new EvSCrtmContents(content);
description += "Event Content:\n " + sCrtmContents.toString();
break;
case EvConstants.EV_S_CRTM_VERSION:
EvSCrtmVersion sCrtmVersion = new EvSCrtmVersion(content);
description += "Event Content:\n" + sCrtmVersion.toString();
break;
case EvConstants.EV_CPU_MICROCODE:
break;
case EvConstants.EV_PLATFORM_CONFIG_FLAGS:
break;
case EvConstants.EV_TABLE_OF_DEVICES:
break;
case EvConstants.EV_COMPACT_HASH:
EvCompactHash compactHash = new EvCompactHash(content);
description += "Event Content:\n" + compactHash.toString();
break;
case EvConstants.EV_IPL:
EvIPL ipl = new EvIPL(content);
description += "Event Content:\n" + ipl.toString();
break;
case EvConstants.EV_IPL_PARTITION_DATA:
break;
case EvConstants.EV_NONHOST_CODE:
break;
case EvConstants.EV_NONHOST_CONFIG:
break;
case EvConstants.EV_NONHOST_INFO:
break;
case EvConstants.EV_EV_OMIT_BOOT_DEVICES_EVENTS:
break;
case EvConstants.EV_EFI_EVENT_BASE:
break;
case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG:
case EvConstants.EV_EFI_VARIABLE_BOOT:
case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
case EvConstants.EV_EFI_SPDM_DEVICE_POLICY:
case EvConstants.EV_EFI_SPDM_DEVICE_AUTHORITY:
UefiVariable efiVar = new UefiVariable(content);
description += "Event Content:\n" + efiVar.toString();
vendorTableFileStatus = efiVar.getVendorTableFileStatus();
break;
case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION:
case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER:
EvEfiBootServicesApp bootServices = new EvEfiBootServicesApp(content);
description += "Event Content:\n" + bootServices.toString();
break;
case EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER:
break;
case EvConstants.EV_EFI_GPT_EVENT:
description += "Event Content:\n" + new EvEfiGptPartition(content).toString();
break;
case EvConstants.EV_EFI_ACTION:
description += new String(content, StandardCharsets.UTF_8);
break;
case EvConstants.EV_EFI_PLATFORM_FIRMWARE_BLOB:
description += "Event Content:\n"
+ new UefiFirmware(content).toString();
break;
case EvConstants.EV_EFI_HANDOFF_TABLES:
EvEfiHandoffTable efiTable = new EvEfiHandoffTable(content);
description += "Event Content:\n" + efiTable.toString();
break;
case EvConstants.EV_EFI_HCRTM_EVENT:
break;
case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB:
case EvConstants.EV_EFI_SPDM_FIRMWARE_CONFIG:
EvEfiSpdmDeviceSecurityEvent efiSpdmDse = new EvEfiSpdmDeviceSecurityEvent(content);
description += "Event Content:\n" + efiSpdmDse.toString();
pciidsFileStatus = efiSpdmDse.getPciidsFileStatus();
break;
default:
description += " Unknown Event found" + "\n";
}
return description;
}
/**
* Converts the Event ID into a String As defined in the TCG PC Client FW Profile.
* Event IDs have values larger than an integer,so a Long is used hold the value.
@ -628,6 +248,374 @@ public class TpmPcrEvent {
}
}
/**
* Sets the digest from a TCG_PCR_EVENT digest field.
* This can be SHA1 for older event structures or any algorithm for newer structure.
*
* @param data cryptographic hash
* @param length length of the cryptographic hash
*/
protected void setEventDigest(final byte[] data, final int length) {
digest = new byte[length];
System.arraycopy(data, 0, digest, 0, length);
}
/**
* Retrieves the digest from a TCG Event.
* This can be SHA1 for older event structures or any algorithm for newer structure.
*
* @return the digest data for the event
*/
public byte[] getEventDigest() {
byte[] digestCopy = new byte[digestLength];
System.arraycopy(digest, 0, digestCopy, 0, this.digestLength);
return digestCopy;
}
/**
* Returns a hex representation of the event digest.
*
* @return hex string
*/
public String getEventDigestStr() {
return Hex.encodeHexString(this.digest);
}
/**
* Sets the event PCR index value from a TCG Event.
*
* @param eventIndex TCG Event PCR Index as defined in the PFP
*/
protected void setPcrIndex(final byte[] eventIndex) {
pcrIndex = HexUtils.leReverseInt(eventIndex);
}
/**
* Sets the EventType.
*
* @param type byte array holding the PFP defined log event type
*/
protected void setEventType(final byte[] type) {
eventType = new BigInteger(1, HexUtils.leReverseByte(type)).longValue();
}
/**
* Returns a formatted string of the type for the event.
*
* @return a string formatted to be human readable
*/
public String getEventTypeStr() {
return String.format("0x%s %s", Long.toHexString(eventType), eventString((int) eventType));
}
/**
* Returns a formatted string of the type for the event minus the byte code.
*
* @return a string formatted to be human readable
*/
public String getEventTypeString() {
return eventString((int) eventType);
}
/**
* Sets the event data after processing.
*
* @param eventData The PFP defined event content
*/
protected void setEventData(final byte[] eventData) {
event = new byte[eventData.length];
System.arraycopy(eventData, 0, event, 0, eventData.length);
}
/**
* Gets the Event Data (no event content) for the event.
* event log format.
*
* @return byte array holding the event structure.
*/
public byte[] getEvent() {
return Arrays.copyOf(event, event.length);
}
/**
* Gets the event Content Data (not the entire event structure).
*
* @return byte array holding the events content field
*/
public byte[] getEventContent() {
return Arrays.copyOf(eventContent, eventContent.length);
}
/**
* Sets the event content after processing.
*
* @param eventData The PFP defined event content
*/
protected void setEventContent(final byte[] eventData) {
eventContent = new byte[eventData.length];
//EvPostCode evPostCode = new EvPostCode(eventContent);
System.arraycopy(eventData, 0, eventContent, 0, eventData.length);
}
/**
* A getter that parses the content based on the type and returns the proper string
* value for the content.
*
* @return an appended string of human readable data
*/
public String getEventContentStr() {
StringBuilder sb = new StringBuilder();
switch ((int) this.eventType) {
case EvConstants.EV_PREBOOT_CERT:
sb.append(" EV_PREBOOT_CERT");
break;
case EvConstants.EV_POST_CODE:
sb.append(new EvPostCode(eventContent));
break;
case EvConstants.EV_UNUSED, EvConstants.EV_IPL_PARTITION_DATA, EvConstants.EV_NONHOST_CODE,
EvConstants.EV_NONHOST_CONFIG, EvConstants.EV_NONHOST_INFO,
EvConstants.EV_EV_OMIT_BOOT_DEVICES_EVENTS, EvConstants.EV_EFI_EVENT_BASE,
EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER, EvConstants.EV_CPU_MICROCODE,
EvConstants.EV_PLATFORM_CONFIG_FLAGS, EvConstants.EV_TABLE_OF_DEVICES,
EvConstants.EV_EFI_HCRTM_EVENT:
break;
case EvConstants.EV_NO_ACTION:
EvNoAction noAction = null;
try {
noAction = new EvNoAction(eventContent);
sb.append(noAction);
if (noAction.isSpecIDEvent()) {
specVersion = noAction.getSpecVersion();
specErrataVersion = noAction.getSpecErrataVersion();
}
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx);
}
break;
case EvConstants.EV_SEPARATOR:
if (EvPostCode.isAscii(eventContent)
&& !this.isBlank(eventContent)) {
sb.append(String.format("Separator event content = %s",
new String(eventContent, StandardCharsets.UTF_8)));
}
break;
case EvConstants.EV_EVENT_TAG:
sb.append(new EvEventTag(eventContent));
break;
case EvConstants.EV_S_CRTM_CONTENTS:
sb.append(new EvSCrtmContents(eventContent));
break;
case EvConstants.EV_S_CRTM_VERSION:
try {
sb.append(new EvSCrtmVersion(eventContent));
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx);
}
break;
case EvConstants.EV_COMPACT_HASH:
try {
sb.append(new EvCompactHash(eventContent));
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx);
}
break;
case EvConstants.EV_IPL:
sb.append(new EvIPL(eventContent));
break;
case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG:
case EvConstants.EV_EFI_VARIABLE_BOOT:
case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
case EvConstants.EV_EFI_SPDM_DEVICE_POLICY:
case EvConstants.EV_EFI_SPDM_DEVICE_AUTHORITY:
try {
sb.append(new UefiVariable(eventContent));
} catch (CertificateException | NoSuchAlgorithmException | IOException exception) {
log.error(exception);
sb.append(exception);
}
break;
case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION:
case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER: // same as EV_EFI_BOOT_SERVICES_APP
try {
sb.append(new EvEfiBootServicesApp(eventContent));
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx);
}
break;
case EvConstants.EV_EFI_GPT_EVENT:
try {
sb.append(new EvEfiGptPartition(eventContent));
} catch (UnsupportedEncodingException ueEx) {
log.error(ueEx);
sb.append(ueEx);
}
break;
case EvConstants.EV_EFI_ACTION:
case EvConstants.EV_ACTION:
sb.append(new String(eventContent, StandardCharsets.UTF_8));
break;
case EvConstants.EV_EFI_PLATFORM_FIRMWARE_BLOB:
sb.append(new UefiFirmware(eventContent));
break;
case EvConstants.EV_EFI_HANDOFF_TABLES:
sb.append(new EvEfiHandoffTable(eventContent));
break;
case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB:
case EvConstants.EV_EFI_SPDM_FIRMWARE_CONFIG:
sb.append(new EvEfiSpdmDeviceSecurityEvent(eventContent));
break;
default:
sb.append("Unknown Event found\n");
}
return cleanTextContent(sb.toString());
}
/**
* Parses the event content and creates a human readable description of each event.
*
* @param eventData the byte array holding the event data.
* @param content the byte array holding the event content.
* @param eventPosition event position within the event log.
* @param hashName name of the hash algorithm used by the event log
* @return String description of the event.
* @throws CertificateException if the event contains an event that cannot be processed.
* @throws NoSuchAlgorithmException if an event contains an unsupported algorithm.
* @throws java.io.IOException if the event cannot be parsed.
*/
public String processEvent(final byte[] eventData, final byte[] content,
final int eventPosition, final String hashName)
throws CertificateException, NoSuchAlgorithmException, IOException {
int eventID = (int) eventType;
this.eventNumber = eventPosition;
description += "Event# " + eventPosition + ": ";
description += "Index PCR[" + getPcrIndex() + "]\n";
description += "Event Type: 0x" + Long.toHexString(eventType) + " " + eventString(eventID);
description += "\n";
if (hashName.compareToIgnoreCase("TPM_ALG_SHA1") == 0) { // Digest
description += "digest (SHA-1): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA256") == 0) { // Digest
description += "digest (SHA256): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA384") == 0) { // Digest
description += "digest (SHA384): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA512") == 0) { // Digest
description += "digest (SHA512): " + Hex.encodeHexString(this.digest);
} else {
description += "Unsupported Hash Algorithm encountered";
}
if (eventID != UefiConstants.SIZE_4) {
description += "\n";
}
// Calculate both the SHA1 and SHA256 on the event since this will equal the digest
// field of about half the log messages.
MessageDigest md1 = MessageDigest.getInstance("SHA-1");
md1.update(eventData);
eventDataSha1hash = md1.digest();
MessageDigest md2 = MessageDigest.getInstance("SHA-256");
md2.update(eventData);
eventDataSha256hash = md2.digest();
switch (eventID) {
case EvConstants.EV_PREBOOT_CERT:
description += " EV_PREBOOT_CERT" + "\n";
break;
case EvConstants.EV_POST_CODE:
EvPostCode postCode = new EvPostCode(content);
description += "Event Content:\n" + postCode;
break;
case EvConstants.EV_UNUSED, EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER,
EvConstants.EV_EFI_HCRTM_EVENT, EvConstants.EV_EFI_EVENT_BASE,
EvConstants.EV_EV_OMIT_BOOT_DEVICES_EVENTS, EvConstants.EV_NONHOST_INFO,
EvConstants.EV_NONHOST_CONFIG, EvConstants.EV_NONHOST_CODE,
EvConstants.EV_IPL_PARTITION_DATA, EvConstants.EV_PLATFORM_CONFIG_FLAGS,
EvConstants.EV_CPU_MICROCODE, EvConstants.EV_TABLE_OF_DEVICES:
break;
case EvConstants.EV_NO_ACTION:
EvNoAction noAction = new EvNoAction(content);
description += "Event Content:\n" + noAction;
if (noAction.isSpecIDEvent()) {
specVersion = noAction.getSpecVersion();
specErrataVersion = noAction.getSpecErrataVersion();
}
pciidsFileStatus = noAction.getPciidsFileStatus();
break;
case EvConstants.EV_SEPARATOR:
if (EvPostCode.isAscii(content)) {
String separatorEventData = new String(content, StandardCharsets.UTF_8);
if (!this.isBlank(content)) {
description += "Separator event content = " + separatorEventData;
}
}
break;
case EvConstants.EV_ACTION:
description += "Event Content:\n"
+ new String(content, StandardCharsets.UTF_8);
break;
case EvConstants.EV_EVENT_TAG:
EvEventTag eventTag = new EvEventTag(content);
description += eventTag.toString();
break;
case EvConstants.EV_S_CRTM_CONTENTS:
EvSCrtmContents sCrtmContents = new EvSCrtmContents(content);
description += "Event Content:\n " + sCrtmContents;
break;
case EvConstants.EV_S_CRTM_VERSION:
EvSCrtmVersion sCrtmVersion = new EvSCrtmVersion(content);
description += "Event Content:\n" + sCrtmVersion;
break;
case EvConstants.EV_COMPACT_HASH:
EvCompactHash compactHash = new EvCompactHash(content);
description += "Event Content:\n" + compactHash;
break;
case EvConstants.EV_IPL:
EvIPL ipl = new EvIPL(content);
description += "Event Content:\n" + ipl;
break;
case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG:
case EvConstants.EV_EFI_VARIABLE_BOOT:
case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
case EvConstants.EV_EFI_SPDM_DEVICE_POLICY:
case EvConstants.EV_EFI_SPDM_DEVICE_AUTHORITY:
UefiVariable efiVar = new UefiVariable(content);
description += "Event Content:\n" + efiVar;
vendorTableFileStatus = efiVar.getVendorTableFileStatus();
break;
case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION:
case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER:
EvEfiBootServicesApp bootServices = new EvEfiBootServicesApp(content);
description += "Event Content:\n" + bootServices;
break;
case EvConstants.EV_EFI_GPT_EVENT:
description += "Event Content:\n" + new EvEfiGptPartition(content);
break;
case EvConstants.EV_EFI_ACTION:
description += new String(content, StandardCharsets.UTF_8);
break;
case EvConstants.EV_EFI_PLATFORM_FIRMWARE_BLOB:
description += "Event Content:\n"
+ new UefiFirmware(content);
break;
case EvConstants.EV_EFI_HANDOFF_TABLES:
EvEfiHandoffTable efiTable = new EvEfiHandoffTable(content);
description += "Event Content:\n" + efiTable;
break;
case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB:
case EvConstants.EV_EFI_SPDM_FIRMWARE_CONFIG:
EvEfiSpdmDeviceSecurityEvent efiSpdmDse = new EvEfiSpdmDeviceSecurityEvent(content);
description += "Event Content:\n" + efiSpdmDse;
pciidsFileStatus = efiSpdmDse.getPciidsFileStatus();
break;
default:
description += " Unknown Event found" + "\n";
}
return description;
}
/**
* Human readable output of a check of input against the current event hash.
*
@ -656,6 +644,7 @@ public class TpmPcrEvent {
/**
* This method takes in an event and compares the hashes to verify that they match.
*
* @param tpmPcrEvent an event to match.
* @return true if the event # matches and the hash is correct.
*/
@ -720,11 +709,12 @@ public class TpmPcrEvent {
sb.append("Event content (Hex) (" + evContent.length + " bytes): "
+ Hex.encodeHexString(evContent));
}
return sb.toString() + "\n";
return sb + "\n";
}
/**
* Remove bad visual value text.
*
* @param text content to operate over.
* @return cleared string
*/

View File

@ -33,8 +33,8 @@ public class TpmPcrEvent1 extends TpmPcrEvent {
*
* @param is ByteArrayInputStream holding the TCG Log event.
* @param eventNumber event position within the event log.
* @throws java.io.IOException if an error occurs in parsing the event.
* @throws java.security.NoSuchAlgorithmException if an undefined algorithm is encountered.
* @throws java.io.IOException if an error occurs in parsing the event.
* @throws java.security.NoSuchAlgorithmException if an undefined algorithm is encountered.
* @throws java.security.cert.CertificateException If a certificate within an event can't be processed.
*/
public TpmPcrEvent1(final ByteArrayInputStream is, final int eventNumber)

View File

@ -61,15 +61,15 @@ public class TpmPcrEvent2 extends TpmPcrEvent {
/**
* list of digests.
*/
private ArrayList<TcgTpmtHa> hashList = new ArrayList<>();
private final ArrayList<TcgTpmtHa> hashList = new ArrayList<>();
/**
* Constructor.
*
* @param is ByteArrayInputStream holding the TCG Log event
* @param eventNumber event position within the event log.
* @throws java.io.IOException if an error occurs in parsing the event
* @throws java.security.NoSuchAlgorithmException if an undefined algorithm is encountered.
* @throws java.io.IOException if an error occurs in parsing the event
* @throws java.security.NoSuchAlgorithmException if an undefined algorithm is encountered.
* @throws java.security.cert.CertificateException If a certificate within an event can't be processed.
*/
public TpmPcrEvent2(final ByteArrayInputStream is, final int eventNumber)

View File

@ -17,7 +17,7 @@ import lombok.Setter;
* . which implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2, respectively.
* Field 2:
* . The Version field also indicates whether the Device Security Event is ..DATA or ..DATA2.
*
* <p>
* DEVICE SECURITY EVENT structures defined by PFP v1.06 Rev 52:
* <p>
* typedef struct tdDEVICE_SECURITY_EVENT_DATA {
@ -39,18 +39,17 @@ import lombok.Setter;
* }
* <p>
*/
@Getter
public abstract class DeviceSecurityEvent {
/**
* DeviceSecurityEventDataContext Object.
*/
@Getter
private DeviceSecurityEventDataPciContext dsedPciContext = null;
/**
* Device type.
*/
@Getter
@Setter
private int deviceType = -1;
@ -58,7 +57,6 @@ public abstract class DeviceSecurityEvent {
* Human-readable description of the data within the
* DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT. DEVICE can be either PCI or USB.
*/
@Getter
private String deviceContextInfo = "";
/**
@ -70,12 +68,10 @@ public abstract class DeviceSecurityEvent {
* Status will only change IF this is an event that uses this file,
* and if that event causes a different status.
*/
@Getter
private String pciidsFileStatus = UefiConstants.FILESTATUS_FROM_FILESYSTEM;
/**
* DeviceSecurityEventData Default Constructor.
*
*/
public DeviceSecurityEvent() {
@ -85,7 +81,6 @@ public abstract class DeviceSecurityEvent {
* Parse the Device Context structure, can be PCI or USB based on device type field.
*
* @param dsedDeviceContextBytes byte array holding the DeviceSecurityEventData.
*
*/
public void instantiateDeviceContext(final byte[] dsedDeviceContextBytes) {

View File

@ -15,19 +15,9 @@ import lombok.Getter;
* } DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT;
* <p>
*/
@Getter
public abstract class DeviceSecurityEventDataDeviceContext {
/**
* PCI Version.
*/
@Getter
private int version = 0;
/**
* PCI Length.
*/
@Getter
private int length = 0;
/**
* Device Security Event Data Device Type = no device type.
*/
@ -40,6 +30,14 @@ public abstract class DeviceSecurityEventDataDeviceContext {
* Device Security Event Data Device Type = DEVICE_TYPE_USB.
*/
public static final int DEVICE_TYPE_USB = 2;
/**
* PCI Version.
*/
private int version = 0;
/**
* PCI Length.
*/
private int length = 0;
/**
* DeviceSecurityEventDataDeviceContext Constructor.

View File

@ -24,7 +24,6 @@ public abstract class DeviceSecurityEventDataSubHeader {
/**
* DeviceSecurityEventDataSubHeader Default Constructor.
*
*/
public DeviceSecurityEventDataSubHeader() {
}
@ -37,13 +36,10 @@ public abstract class DeviceSecurityEventDataSubHeader {
* @return name of the device type
*/
public static String subheaderTypeToString(final int subheaderTypeInt) {
switch (subheaderTypeInt) {
case SUBHEADERTYPE_MEAS_BLOCK:
return "SPDM Measurement Block";
case SUBHEADERTYPE_CERT_CHAIN:
return "SPDM Cert Chain";
default:
return "Unknown or invalid Subheader Type of value " + subheaderTypeInt;
}
return switch (subheaderTypeInt) {
case SUBHEADERTYPE_MEAS_BLOCK -> "SPDM Measurement Block";
case SUBHEADERTYPE_CERT_CHAIN -> "SPDM Cert Chain";
default -> "Unknown or invalid Subheader Type of value " + subheaderTypeInt;
};
}
}

View File

@ -175,6 +175,7 @@ public final class EvConstants {
* EFI SPDM Device Authority Event ID.
*/
public static final int EV_EFI_SPDM_DEVICE_AUTHORITY = 0x800000E4;
/**
* Default private constructor so checkstyles doesn't complain.
*/

View File

@ -50,25 +50,25 @@ import java.util.List;
*/
public class EvEfiGptPartition {
/**
* Header Size.
* Partition Length.
*/
private int headerSize = 0;
private static final int PARTITION_ENTRY_LENGTH = UefiConstants.SIZE_128;
/**
* Header bytes.
*/
private byte[] header = new byte[UefiConstants.SIZE_8];
private final byte[] header = new byte[UefiConstants.SIZE_8];
/**
* Number of partitions in this event.
*/
private int numberOfPartitions;
/**
* Partition Length.
*/
private int partitonEntryLength = UefiConstants.SIZE_128;
private final int numberOfPartitions;
/**
* List of Partitions.
*/
private List<UefiPartition> partitionList;
private final List<UefiPartition> partitionList;
/**
* Header Size.
*/
private int headerSize = 0;
/**
* GPT Partition Event Type constructor.
@ -89,7 +89,7 @@ public class EvEfiGptPartition {
byte[] partitions = new byte[UefiConstants.SIZE_8];
System.arraycopy(eventDataBytes, headerSize, partitions, 0, UefiConstants.SIZE_8);
numberOfPartitions = getIntFromBytes(partitions);
int partitionLength = numberOfPartitions * partitonEntryLength;
int partitionLength = numberOfPartitions * PARTITION_ENTRY_LENGTH;
byte[] partitionEntries = new byte[partitionLength];
System.arraycopy(eventDataBytes, headerSize + UefiConstants.SIZE_8, partitionEntries,
0, partitionLength);
@ -100,7 +100,7 @@ public class EvEfiGptPartition {
/**
* Processes an individual GPT partition entry.
*
* @param partitions byte array holding partition data.
* @param partitions byte array holding partition data.
* @param numOfPartitions number of partitions included in the data.
* @throws java.io.UnsupportedEncodingException if partition data fails to parse.
*/
@ -108,16 +108,16 @@ public class EvEfiGptPartition {
throws UnsupportedEncodingException {
byte[] partitionData = new byte[UefiConstants.SIZE_128];
for (int i = 0; i < numOfPartitions; i++) {
System.arraycopy(partitions, i * partitonEntryLength, partitionData, 0,
partitonEntryLength);
System.arraycopy(partitions, i * PARTITION_ENTRY_LENGTH, partitionData, 0,
PARTITION_ENTRY_LENGTH);
partitionList.add(new UefiPartition(partitionData));
}
}
/**
* Provides a human readable string describing the GPT Partition information.
* Provides a human-readable string describing the GPT Partition information.
*
* @return a human readable string holding the partition information.
* @return a human-readable string holding the partition information.
*/
public String toString() {
String headerStr = HexUtils.byteArrayToHexString(header);

View File

@ -31,20 +31,19 @@ import java.util.ArrayList;
* standard that define the particular table.
*/
public class EvEfiHandoffTable {
/**
* List of Vendor GUIDs.
*/
private final ArrayList<UefiGuid> vendorGuids = new ArrayList<>();
/**
* List of Vendors.
*/
private final ArrayList<byte[]> vendorTables = new ArrayList<>();
/**
* Number of Tables.
*/
@Getter
private int numberOfTables = 0;
/**
* List of Vendor GUIDs.
*/
private ArrayList<UefiGuid> vendorGuids = new ArrayList<>();
/**
* List of Vendors.
*/
private ArrayList<byte[]> vendorTables = new ArrayList<>();
private Path vendorPathString;
/**
@ -71,7 +70,7 @@ public class EvEfiHandoffTable {
/**
* EvEFIHandoffTable constructor.
*
* @param tpmEventData byte array holding the Handoff table data.
* @param tpmEventData byte array holding the Handoff table data.
* @param vendorPathString the string for the vendor file
*/
public EvEfiHandoffTable(final byte[] tpmEventData, final Path vendorPathString) {
@ -122,7 +121,7 @@ public class EvEfiHandoffTable {
}
/**
* Returns a human readable description of the hand off tables.
* Returns a human-readable description of the hand off tables.
*
* @return a human readable description.
*/

View File

@ -4,7 +4,7 @@ import java.nio.charset.StandardCharsets;
/**
* Processes event type EV_IPL which is deprecated in the current spec,
* but defined in older version of the specification(1.0.0) as contain
* but defined in older version of the specification(1.0.0) as contain
* "informative information about the IPL code" (ascii strings).
*/
public class EvIPL {
@ -12,32 +12,35 @@ public class EvIPL {
private String description = "";
/**
*IPL Event Constructor.
* IPL Event Constructor.
*
* @param event byte array holding the IPL Event data.
*/
public EvIPL(final byte[] event) {
event(event);
}
/**
* Processes IPL event.
* @param event byte array holding the IPL Event data.
* @return a description of the IPl event.
*/
/**
* Processes IPL event.
*
* @param event byte array holding the IPL Event data.
* @return a description of the IPl event.
*/
public String event(final byte[] event) {
if (event == null) {
description = "Invalid IPL event data";
} else {
description = " \"" + new String(event, StandardCharsets.UTF_8) + "\"";
} else {
description = " \"" + new String(event, StandardCharsets.UTF_8) + "\"";
}
return description;
}
}
/**
* Returns a human readable description of the IPL Event.
* Returns a human-readable description of the IPL Event.
*
* @return human readable description.
*/
public String toString() {
return description;
return description;
}
}

View File

@ -7,30 +7,39 @@ import java.nio.charset.StandardCharsets;
/**
* Class for processing EV_POST_CODE event types
*
* <p>
* typedef struct tdUEFI_PLATFORM_FIRMWARE_BLOB {
* UEFI_PHYSICAL_ADDRESS BlobBase; // Same as UINT64 for most systems
* UINT64 BlobLength;
* } UEFI_PLATFORM_FIRMWARE_BLOB;
*
* UEFI_PHYSICAL_ADDRESS BlobBase; // Same as UINT64 for most systems
* UINT64 BlobLength;
* } UEFI_PLATFORM_FIRMWARE_BLOB;
* <p>
* However Table 9 of the PC Client Platform firmware profile states that even content is a string
* For POST code, the event data SHOULD be POST CODE.
* For embedded SMM code, the event data SHOULD be SMM CODE.
* For ACPI flash data, the event data SHOULD be ACPI DATA.
* For BIS code, the event data SHOULD be BIS CODE.
* For embedded option ROMs, the event data SHOULD be Embedded UEFI Driver.
* For POST code, the event data SHOULD be POST CODE.
* For embedded SMM code, the event data SHOULD be SMM CODE.
* For ACPI flash data, the event data SHOULD be ACPI DATA.
* For BIS code, the event data SHOULD be BIS CODE.
* For embedded option ROMs, the event data SHOULD be Embedded UEFI Driver.
*/
public class EvPostCode {
/** Event Description. */
/**
* Event Description.
*/
private String codeInfo = "";
/** String type flag. */
/**
* String type flag.
*/
private boolean bisString = false;
/** Firmware object. */
/**
* Firmware object.
*/
@Getter
private UefiFirmware firmwareBlob = null;
/**
* EcPostCode constructor.
*
* @param postCode byte array holding the post code content.
*/
public EvPostCode(final byte[] postCode) {
@ -43,27 +52,9 @@ public class EvPostCode {
}
}
/**
* Flag set to true if Post Code is a string.
* @return true if Post Code is a string.
*/
public boolean isString() {
return bisString;
}
/**
* Returns a human readable string of the Post Code information.
* @return human readable string.
*/
public String toString() {
if (bisString) {
return codeInfo;
}
return firmwareBlob.toString();
}
/**
* Determines if the byte array is a string.
*
* @param postCode byte array input.
* @return true if byte array is a string.
*/
@ -73,6 +64,27 @@ public class EvPostCode {
return false;
}
}
return true;
return true;
}
/**
* Flag set to true if Post Code is a string.
*
* @return true if Post Code is a string.
*/
public boolean isString() {
return bisString;
}
/**
* Returns a human-readable string of the Post Code information.
*
* @return human readable string.
*/
public String toString() {
if (bisString) {
return codeInfo;
}
return firmwareBlob.toString();
}
}

View File

@ -9,32 +9,33 @@ public class EvSCrtmContents {
private String description = "";
/**
/**
* Constructor that takes in the event data and waits to be called.
*
* @param event byte array holding the event content data.
*/
public EvSCrtmContents(final byte[] event) {
scrtmContents(event);
}
/**
* Checks if event data is null and if not it converts to a String.
* @param event byte array holding the event data.
* @return String contents contained within the event.
*/
public String scrtmContents(final byte[] event) {
/**
* Checks if event data is null and if not it converts to a String.
*
* @param event byte array holding the event data.
*/
public void scrtmContents(final byte[] event) {
if (event == null) {
description = "invalid content event data";
} else {
description = new String(event, StandardCharsets.UTF_8);
}
return description;
}
this.description = "invalid content event data";
} else {
this.description = new String(event, StandardCharsets.UTF_8);
}
}
/**
* Human readable string contained within the CRTM Contents event.
* @return Human readable string.
*/
/**
* Human-readable string contained within the CRTM Contents event.
*
* @return Human readable string.
*/
public String toString() {
return description;
}

View File

@ -8,7 +8,7 @@ import java.nio.charset.StandardCharsets;
* Class to process the NV_INDEX_DYNAMIC_EVENT_LOG_DATA per PFP.
* Per PFP, the first 16 bytes of the structure are a String based identifier (Signature),
* which are a NULL-terminated ASCII string "NvIndexDynamic".
*
* <p>
* HEADERS defined by PFP v1.06 Rev 52.
* Certain fields are common to both ..HEADER and ..HEADER2, and are noted below the structures.
* <p>

View File

@ -11,17 +11,17 @@ import java.io.IOException;
* <p>
* Measurement block format, defined by SPDM v1.03, Sect 10.11.1, Table 53:
* Measurement block format {
* Index 1 byte;
* MeasurementSpec 1 byte;
* MeasurementSize 2 bytes;
* Measurement <MeasurementSize> bytes;
* Index 1 byte;
* MeasurementSpec 1 byte;
* MeasurementSize 2 bytes;
* Measurement <MeasurementSize> bytes;
* }
* <p>
* Index: index of the measurement block, as there can be more than one
* MeasurementSpec: bit mask; the measurement specification that the requested Measurement follows
* See "MeasurementSpecificationSel" in Table 21. See Tables 29, 53, 54
* Bit 0: DMTFmeasSpec, per Table 54
* Bit 1-7: Reserved
* See "MeasurementSpecificationSel" in Table 21. See Tables 29, 53, 54
* Bit 0: DMTFmeasSpec, per Table 54
* Bit 1-7: Reserved
* Measurement: the digest
*/
public class SpdmMeasurementBlock {
@ -39,7 +39,7 @@ public class SpdmMeasurementBlock {
/**
* SPDM Measurement.
*/
private SpdmMeasurement spdmMeasurement;
private final SpdmMeasurement spdmMeasurement;
/**
* SpdmMeasurementBlock Constructor.
@ -76,7 +76,7 @@ public class SpdmMeasurementBlock {
String spdmMeasBlockInfo = "";
spdmMeasBlockInfo += " Index = " + index + "\n";
spdmMeasBlockInfo += " MeasurementSpec = " + measurementSpec + "\n";
spdmMeasBlockInfo += " MeasurementSpec = " + measurementSpec + "\n";
spdmMeasBlockInfo += spdmMeasurement.toString();
return spdmMeasBlockInfo;

View File

@ -282,6 +282,7 @@ public final class UefiConstants {
* file status, where file is not accessible (either not found, or no access permission).
*/
public static final String FILESTATUS_NOT_ACCESSIBLE = "fileNotAccessible";
/**
* Default private constructor so checkstyles doesn't complain.
*/

View File

@ -72,6 +72,22 @@ public class UefiDevicePath {
length = HexUtils.leReverseInt(lengthBytes);
}
/**
* Converts from a char array to byte array.
* Removes the upper byte (typically set to 0) of each char.
*
* @param data Character array.
* @return byte array.
*/
public static byte[] convertChar16tobyteArray(final byte[] data) {
byte[] hexdata = new byte[data.length];
int j = 0;
for (int i = 0; i < data.length; i = i + UefiConstants.SIZE_2) {
hexdata[j++] = data[i];
}
return hexdata;
}
/**
* Returns the UEFI device subtype.
*
@ -118,8 +134,8 @@ public class UefiDevicePath {
* Current types processed include Hardware Device Path, ACPI Device Path,
* Messaging Device Path, and Media Device Path.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return human-readable string representing the UEFI device path
* @throws java.io.UnsupportedEncodingException
*/
@ -127,7 +143,7 @@ public class UefiDevicePath {
String devInfo = " ";
int devPath = path[offset];
byte unknownSubType = path[offset + UefiConstants.OFFSET_1];
switch (path[0 + offset]) {
switch (path[offset]) {
case UefiConstants.DEV_HW:
type = "Hardware Device Path";
if (devPath == UefiConstants.DEVPATH_HARWARE) {
@ -182,8 +198,8 @@ public class UefiDevicePath {
/**
* processes the ACPI UEFI device subtype.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return acpi device info
*/
private String acpiSubType(final byte[] path, final int offset) {
@ -205,8 +221,8 @@ public class UefiDevicePath {
/**
* Processes the ACPI short subtype.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return short acpi info.
*/
private String acpiShortSubType(final byte[] path, final int offset) {
@ -226,8 +242,8 @@ public class UefiDevicePath {
/**
* Processes the PCI subType.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return pci device info.
*/
private String pciSubType(final byte[] path, final int offset) {
@ -243,8 +259,8 @@ public class UefiDevicePath {
/**
* processes the SATA subtype.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return SATA drive info.
*/
private String sataSubType(final byte[] path, final int offset) {
@ -264,8 +280,8 @@ public class UefiDevicePath {
/**
* Processes the hard drive subtype.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return hard drive info.
*/
private String hardDriveSubType(final byte[] path, final int offset) {
@ -311,8 +327,8 @@ public class UefiDevicePath {
/**
* Process the File path subtype.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return file path info.
*/
private String filePathSubType(final byte[] path, final int offset) {
@ -336,8 +352,8 @@ public class UefiDevicePath {
* Vendor-assigned GUID that defines the data that follows.
* Vendor-defined variable size data.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return vendor device info.
*/
private String vendorSubType(final byte[] path, final int offset) {
@ -351,7 +367,7 @@ public class UefiDevicePath {
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData,
0, UefiConstants.SIZE_16);
UefiGuid guid = new UefiGuid(guidData);
subType += guid.toString() + " ";
subType += guid + " ";
if (subTypeLength - UefiConstants.SIZE_16 > 0) {
byte[] vendorData = new byte[subTypeLength - UefiConstants.SIZE_16];
System.arraycopy(path, UefiConstants.OFFSET_20
@ -368,8 +384,8 @@ public class UefiDevicePath {
* Returns USB device info.
* UEFI Specification, Version 2.8.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return USB device info.
*/
private String usbSubType(final byte[] path, final int offset) {
@ -395,8 +411,8 @@ public class UefiDevicePath {
* See Links to UEFI Related Documents
* (http://uefi.org/uefi under the headings NVM Express Specification.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return NVM device info.
*/
private String nvmSubType(final byte[] path, final int offset) {
@ -420,8 +436,8 @@ public class UefiDevicePath {
* Only processes the Device type.
* Status bootHandler pointer, and description String pointer are ignored.
*
* @param path byte array holding the device path.
* @param offset
* @param path byte array holding the device path.
* @param offset offset
* @return String that represents the UEFI defined BIOS Device Type.
*/
private String biosDevicePath(final byte[] path, final int offset) {
@ -468,8 +484,8 @@ public class UefiDevicePath {
* PIWG Firmware File Section 10.3.5.6:
* Contents are defined in the UEFI PI Specification.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return String that represents the PIWG Firmware Volume Path
*/
private String piwgFirmVolFile(final byte[] path, final int offset) {
@ -489,8 +505,8 @@ public class UefiDevicePath {
* PIWG Firmware Volume Section 10.3.5.7:
* Contents are defined in the UEFI PI Specification.
*
* @param path
* @param offset
* @param path path
* @param offset offset
* @return String that represents the PIWG Firmware Volume Path
*/
private String piwgFirmVolPath(final byte[] path, final int offset) {
@ -512,20 +528,4 @@ public class UefiDevicePath {
public String toString() {
return devPathInfo;
}
/**
* Converts from a char array to byte array.
* Removes the upper byte (typically set to 0) of each char.
*
* @param data Character array.
* @return byte array.
*/
public static byte[] convertChar16tobyteArray(final byte[] data) {
byte[] hexdata = new byte[data.length];
int j = 0;
for (int i = 0; i < data.length; i = i + UefiConstants.SIZE_2) {
hexdata[j++] = data[i];
}
return hexdata;
}
}

View File

@ -45,11 +45,11 @@ public class UefiGuid {
/**
* guid byte array.
*/
private byte[] guid;
private final byte[] guid;
/**
* UUID object.
*/
private UUID uuid;
private final UUID uuid;
/**
* UefiGUID constructor.
@ -63,7 +63,7 @@ public class UefiGuid {
/**
* UefiGUID constructor.
*
* @param guidBytes byte array holding a valid guid.
* @param guidBytes byte array holding a valid guid.
* @param vendorPathString string path for vendor
*/
public UefiGuid(final byte[] guidBytes, final Path vendorPathString) {
@ -88,6 +88,7 @@ public class UefiGuid {
* Converts a GUID with a byte array to a RFC-1422 UUID object.
* Assumes a MS format and converts to Big Endian format used by most others , including Linux
* Matched uuids found in /sys/firmware/efi/efivars on Centos 7.
*
* @param guid byte array holding the guid data.
* @return UUID processed from the passed in guid
*/
@ -120,6 +121,22 @@ public class UefiGuid {
return UefiConstants.SIZE_16;
}
/**
* Returns a string of the entity that the UUID represents.
* Does not contain a vendor lookup on the UUID.
*
* @param guid byte array holding the guid data.
* @return true if the UUID has a valid structure.
*/
public static boolean isValidUUID(final byte[] guid) {
boolean valid = false;
UUID tmpUuid = processGuid(guid);
if (tmpUuid.toString().length() != 0) {
valid = true;
}
return valid;
}
/**
* Checks whether the handle to the file needed to look up the UUID is valid. If empty,
* this likely means the file was not accessible to due to existence or permissions.
@ -179,22 +196,6 @@ public class UefiGuid {
return uuid.toString();
}
/**
* Returns a string of the entity that the UUID represents.
* Does not contain a vendor lookup on the UUID.
*
* @param guid byte array holding the guid data.
* @return true if the UUID has a valid structure.
*/
public static boolean isValidUUID(final byte[] guid) {
boolean valid = false;
UUID tmpUuid = processGuid(guid);
if (tmpUuid.toString().length() != 0) {
valid = true;
}
return valid;
}
/**
* Checks to see if the uuid is the test or Empty UUID ("00000000-0000-0000-0000-000000000000").
*

View File

@ -11,14 +11,14 @@ import java.security.cert.CertificateException;
/**
* Class for processing either
* 1) the contents of a Secure Boot PK, KEK, DB or DBX contents,
* used for EFIVariables associated with Secure Boot,
* as defined by Section 32.4.1 Signature Database from the UEFI 2.8 specification
* 2) the contents of an SPDM devdb,
* used for SPDM Device Policy or Device Authority, whose data is an EFIVariable
* EFIVariable data for SPDM Device Policy: UefiSignatureList
* EFIVariable data for SPDM Device: UefiSignatureData only
* as defined by PFP v1.06 Rev52, Section 10.4
* 1) the contents of a Secure Boot PK, KEK, DB or DBX contents,
* used for EFIVariables associated with Secure Boot,
* as defined by Section 32.4.1 Signature Database from the UEFI 2.8 specification
* 2) the contents of an SPDM devdb,
* used for SPDM Device Policy or Device Authority, whose data is an EFIVariable
* EFIVariable data for SPDM Device Policy: UefiSignatureList
* EFIVariable data for SPDM Device: UefiSignatureData only
* as defined by PFP v1.06 Rev52, Section 10.4
* <p>
* typedef struct _EFI_SIGNATURE_DATA {
* EFI_GUID SignatureOwner;
@ -33,7 +33,7 @@ public class UefiSignatureData {
/**
* UEFI Certificate GUID.
*/
private byte[] guid = new byte[UefiConstants.SIZE_16];
private final byte[] guid = new byte[UefiConstants.SIZE_16];
/**
* UEFI Signature data.
*/
@ -61,7 +61,7 @@ public class UefiSignatureData {
/**
* UEFI Certificate SHA256 hash.
*/
private byte[] binaryHash = new byte[UefiConstants.SIZE_32];
private final byte[] binaryHash = new byte[UefiConstants.SIZE_32];
/**
* UEFI Signature data status.
*/

View File

@ -13,17 +13,17 @@ import static hirs.utils.tpm.eventlog.uefi.UefiConstants.FILESTATUS_NOT_ACCESSIB
/**
* Class for processing either
* 1) the contents of a Secure Boot PK, KEK, DB or DBX contents,
* used for EFIVariables associated with Secure Boot,
* as defined by Section 32.4.1 Signature Database from the UEFI 2.8 specification
* 2) the contents of an SPDM devdb,
* used for SPDM Device Policy, whose data is an EFIVariable
* as defined by PFP v1.06 Rev52, Section 10.4
* 1) the contents of a Secure Boot PK, KEK, DB or DBX contents,
* used for EFIVariables associated with Secure Boot,
* as defined by Section 32.4.1 Signature Database from the UEFI 2.8 specification
* 2) the contents of an SPDM devdb,
* used for SPDM Device Policy, whose data is an EFIVariable
* as defined by PFP v1.06 Rev52, Section 10.4
* <p>
* An EFI Signature List is actually a list of Certificates used to verify a Signature.
* This is mainly found in PCR[7] UEFI variables for either the
* Secure Boot PK, KEK, Db and DBx variables
* or the SPDM devdb variable (under EV_EFI_SPDM_DEVICE_POLICY).
* Secure Boot PK, KEK, Db and DBx variables
* or the SPDM devdb variable (under EV_EFI_SPDM_DEVICE_POLICY).
* <p>
* typedef struct _EFI_SIGNATURE_LIST {
* EFI_GUID SignatureType;
@ -33,20 +33,20 @@ import static hirs.utils.tpm.eventlog.uefi.UefiConstants.FILESTATUS_NOT_ACCESSIB
* // UINT8 SignatureHeader[SignatureHeaderSize];
* // EFI_SIGNATURE_DATA Signatures[...][SignatureSize];
* } EFI_SIGNATURE_LIST;
*
* <p>
* SignatureListHeader (contents common to any Signature Type)
* - SignatureType
* - SignatureListSize
* - SignatureHeaderSize
* - SignatureSize
* - SignatureType
* - SignatureListSize
* - SignatureHeaderSize
* - SignatureSize
* SignatureHeader (contents depend on the SignatureType)
* - The format of this header is specified by the SignatureType (SHA256, X509).
* - The format of this header is specified by the SignatureType (SHA256, X509).
* Signatures[][] is an array of signatures.
* - Each signature is SignatureSize bytes in length.
* - The format of the signature is defined by SignatureType (SHA256, X509).
*
* / |-------------------------| ------- SignatureType
* / | Signature List Header | SignatureListSize
* - Each signature is SignatureSize bytes in length.
* - The format of the signature is defined by SignatureType (SHA256, X509).
* <p>
* / |-------------------------| ------- SignatureType
* / | Signature List Header | SignatureListSize
* |---------------------| / |-------------------------|\ SignatureHeaderSize
* | Signature List #0 | / | Signature Header | \ _____ SignatureSize
* | | / |-------------------------|
@ -57,13 +57,16 @@ import static hirs.utils.tpm.eventlog.uefi.UefiConstants.FILESTATUS_NOT_ACCESSIB
* | | | Signature #2 | (1 cert or hash)
* | | |-------------------------|
* |---------------------| | ... |
* \ | |
* \ |-------------------------|
* \ | Signature #n |
* \ |-------------------------|
*
* \ | |
* \ |-------------------------|
* \ | Signature #n |
* \ |-------------------------|
*/
public class UefiSignatureList {
/**
* Array List of Signature found in the list.
*/
private final ArrayList<UefiSignatureData> sigList = new ArrayList<>();
/**
* Size of the signature list.
*/
@ -94,18 +97,16 @@ public class UefiSignatureList {
* Current status of Signature List data.
*/
private String dataInvalidStatus = "Signature List data validity is undetermined yet";
/**
* Array List of Signature found in the list.
*/
private ArrayList<UefiSignatureData> sigList = new ArrayList<UefiSignatureData>();
/**
* Input Stream for processing.
*/
private ByteArrayInputStream efiSigDataIS = null;
/**
* Type of signature.
*/
private UefiGuid signatureType = null;
/**
* Track status of vendor-table.json.
*/
@ -213,16 +214,11 @@ public class UefiSignatureList {
* @return true if the GUID is a valid GUID for Signature List Type, false if not.
*/
public boolean isValidSigListGUID(final UefiGuid guid) {
switch (guid.getVendorTableReference()) {
case "EFI_CERT_SHA256_GUID":
case "EFI_CERT_X509_SHA256":
case "EFI_CERT_X509_SHA384":
case "EFI_CERT_X509_SHA512":
case "EFI_CERT_X509_GUID":
return true;
default:
return false;
}
return switch (guid.getVendorTableReference()) {
case "EFI_CERT_SHA256_GUID", "EFI_CERT_X509_SHA256", "EFI_CERT_X509_SHA384",
"EFI_CERT_X509_SHA512", "EFI_CERT_X509_GUID" -> true;
default -> false;
};
}
/**

View File

@ -35,7 +35,7 @@ public class UefiVariable {
/**
* List of Signature lists.
*/
private List<UefiSignatureList> certSuperList;
private final List<UefiSignatureList> certSuperList;
/**
* Name of the UEFI variable.
*/
@ -87,11 +87,11 @@ public class UefiVariable {
*
* @param variableData byte array holding the UEFI Variable.
* @throws java.security.cert.CertificateException If there a problem
* parsing the X509 certificate.
* parsing the X509 certificate.
* @throws java.security.NoSuchAlgorithmException if there's a problem
* hashing the certificate.
* hashing the certificate.
* @throws java.io.IOException If there's a problem
* parsing the signature data.
* parsing the signature data.
*/
public UefiVariable(final byte[] variableData)
throws CertificateException, NoSuchAlgorithmException, IOException {
@ -136,10 +136,10 @@ public class UefiVariable {
case "devdb":
processSigList(uefiVariableData);
break; // Update when test patterns exist
// PFP v1.06 Rev 52, Sec 3.3.4.8
// EV_EFI_SPDM_DEVICE_POLICY: EFI_SIGNATURE_LIST
// EV_EFI_SPDM_DEVICE_AUTHORITY: EFI_SIGNATURE_DATA
// for now, differentiate them by using devdc for ..DEVICE_AUTHORITY
// PFP v1.06 Rev 52, Sec 3.3.4.8
// EV_EFI_SPDM_DEVICE_POLICY: EFI_SIGNATURE_LIST
// EV_EFI_SPDM_DEVICE_AUTHORITY: EFI_SIGNATURE_DATA
// for now, differentiate them by using devdc for ..DEVICE_AUTHORITY
case "devdc":
processSigDataX509(uefiVariableData);
break;
@ -161,11 +161,11 @@ public class UefiVariable {
*
* @param data the bye array holding one or more Signature Lists.
* @throws java.security.cert.CertificateException If there's a problem
* parsing the X509 certificate.
* parsing the X509 certificate.
* @throws java.security.NoSuchAlgorithmException if there's a problem
* hashing the certificate.
* hashing the certificate.
* @throws java.io.IOException If there's a problem
* parsing the signature data.
* parsing the signature data.
*/
private void processSigList(final byte[] data)
throws CertificateException, NoSuchAlgorithmException, IOException {
@ -186,7 +186,7 @@ public class UefiVariable {
// (ie. if the new file status is not-accessible or from-code, then want to update)
if ((vendorTableFileStatus != FILESTATUS_NOT_ACCESSIBLE)
&& (list.getVendorTableFileStatus() != FILESTATUS_FROM_FILESYSTEM)) {
vendorTableFileStatus = list.getVendorTableFileStatus();
vendorTableFileStatus = list.getVendorTableFileStatus();
}
// efiVariableSigListContents += list.toString();
@ -275,7 +275,7 @@ public class UefiVariable {
case "dbx":
case "devdb": // SPDM_DEVICE_POLICY and SPDM_DEVICE_AUTHORITY
case "devdc": // for now use devdb and devdc respectively
// (update when more test patterns exist)
// (update when more test patterns exist)
break;
case "Boot00":
efiVariable.append(bootv.toString());
@ -289,7 +289,7 @@ public class UefiVariable {
default:
if (!tmpName.isEmpty()) {
efiVariable.append(String.format(" Data not provided for "
+ "UEFI variable named %s ", tmpName));
+ "UEFI variable named %s ", tmpName));
} else {
efiVariable.append(" Data not provided ");
}

View File

@ -1,6 +1,7 @@
package hirs.utils.tpm.eventlog.uefi;
import jakarta.xml.bind.DatatypeConverter;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.security.MessageDigest;

View File

@ -14,6 +14,8 @@ import jakarta.xml.bind.annotation.XmlAnyAttribute;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import javax.xml.namespace.QName;
import java.util.HashMap;
@ -21,8 +23,7 @@ import java.util.Map;
/**
*
* Attributes common to all Elements in this schema
* Attributes common to all Elements in this schema
*
*
* <p>Java class for BaseElement complex type.
@ -39,67 +40,38 @@ import java.util.Map;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BaseElement", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
@XmlSeeAlso({
SoftwareIdentity.class,
Entity.class,
Link.class,
Meta.class,
ResourceCollection.class
SoftwareIdentity.class,
Entity.class,
Link.class,
Meta.class,
ResourceCollection.class
})
public class BaseElement {
@XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace")
protected String lang;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
*
* Allow xml:lang attribute on any element.
*
*
* @return
* possible object is
* {@link String }
*
*/
public String getLang() {
return lang;
}
/**
* Sets the value of the lang property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLang(String value) {
this.lang = value;
}
/**
* -- GETTER --
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* <p>
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
@XmlAnyAttribute
private final Map<QName, String> otherAttributes = new HashMap<>();
/**
* -- GETTER --
* Allow xml:lang attribute on any element.
*/
@Setter
@XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace")
protected String lang;
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAnyElement;
@ -17,6 +15,11 @@ import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlMixed;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
@ -36,18 +39,19 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CanonicalizationMethodType", propOrder = {
"content"
"content"
})
public class CanonicalizationMethodType {
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
@Getter
@Setter
@XmlAttribute(name = "Algorithm", required = true)
@XmlSchemaType(name = "anyURI")
protected String algorithm;
@ -72,8 +76,6 @@ public class CanonicalizationMethodType {
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link String }
*
*
*/
public List<Object> getContent() {
if (content == null) {
@ -81,29 +83,4 @@ public class CanonicalizationMethodType {
}
return this.content;
}
/**
* Gets the value of the algorithm property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAlgorithm() {
return algorithm;
}
/**
* Sets the value of the algorithm property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlgorithm(String value) {
this.algorithm = value;
}
}

View File

@ -12,6 +12,8 @@ import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
/**
@ -40,188 +42,38 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DSAKeyValueType", propOrder = {
"p",
"q",
"g",
"y",
"j",
"seed",
"pgenCounter"
"p",
"q",
"g",
"y",
"j",
"seed",
"pgenCounter"
})
public class DSAKeyValueType {
@XmlElement(name = "P")
protected byte[] p;
@XmlElement(name = "Q")
protected byte[] q;
@XmlElement(name = "G")
protected byte[] g;
@XmlElement(name = "Y", required = true)
protected byte[] y;
@XmlElement(name = "J")
protected byte[] j;
@XmlElement(name = "Seed")
protected byte[] seed;
@XmlElement(name = "PgenCounter")
protected byte[] pgenCounter;
/**
* Gets the value of the p property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getP() {
return p;
}
/**
* Sets the value of the p property.
*
* @param value
* allowed object is
* byte[]
*/
public void setP(byte[] value) {
this.p = value;
}
/**
* Gets the value of the q property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getQ() {
return q;
}
/**
* Sets the value of the q property.
*
* @param value
* allowed object is
* byte[]
*/
public void setQ(byte[] value) {
this.q = value;
}
/**
* Gets the value of the g property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getG() {
return g;
}
/**
* Sets the value of the g property.
*
* @param value
* allowed object is
* byte[]
*/
public void setG(byte[] value) {
this.g = value;
}
/**
* Gets the value of the y property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getY() {
return y;
}
/**
* Sets the value of the y property.
*
* @param value
* allowed object is
* byte[]
*/
public void setY(byte[] value) {
this.y = value;
}
/**
* Gets the value of the j property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getJ() {
return j;
}
/**
* Sets the value of the j property.
*
* @param value
* allowed object is
* byte[]
*/
public void setJ(byte[] value) {
this.j = value;
}
/**
* Gets the value of the seed property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getSeed() {
return seed;
}
/**
* Sets the value of the seed property.
*
* @param value
* allowed object is
* byte[]
*/
public void setSeed(byte[] value) {
this.seed = value;
}
/**
* Gets the value of the pgenCounter property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getPgenCounter() {
return pgenCounter;
}
/**
* Sets the value of the pgenCounter property.
*
* @param value
* allowed object is
* byte[]
*/
public void setPgenCounter(byte[] value) {
this.pgenCounter = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAnyElement;
@ -17,8 +15,13 @@ import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlMixed;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for DigestMethodType complex type.
@ -37,18 +40,19 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DigestMethodType", propOrder = {
"content"
"content"
})
public class DigestMethodType {
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
@Getter
@Setter
@XmlAttribute(name = "Algorithm", required = true)
@XmlSchemaType(name = "anyURI")
protected String algorithm;
@ -74,38 +78,11 @@ public class DigestMethodType {
* {@link Object }
* {@link Element }
* {@link String }
*
*
*/
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
content = new ArrayList<>();
}
return this.content;
}
/**
* Gets the value of the algorithm property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAlgorithm() {
return algorithm;
}
/**
* Sets the value of the algorithm property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlgorithm(String value) {
this.algorithm = value;
}
}

View File

@ -8,14 +8,15 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlElements;
import jakarta.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for Directory complex type.
@ -35,20 +36,17 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Directory", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", propOrder = {
"directoryOrFile"
"directoryOrFile"
})
public class Directory
extends FilesystemItem
{
extends FilesystemItem {
@XmlElements({
@XmlElement(name = "Directory", type = Directory.class),
@XmlElement(name = "File", type = File.class)
@XmlElement(name = "Directory", type = Directory.class),
@XmlElement(name = "File", type = File.class)
})
protected List<FilesystemItem> directoryOrFile;
@ -72,12 +70,10 @@ public class Directory
* Objects of the following type(s) are allowed in the list
* {@link Directory }
* {@link File }
*
*
*/
public List<FilesystemItem> getDirectoryOrFile() {
if (directoryOrFile == null) {
directoryOrFile = new ArrayList<FilesystemItem>();
directoryOrFile = new ArrayList<>();
}
return this.directoryOrFile;
}

View File

@ -8,14 +8,17 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
@ -39,27 +42,33 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Entity", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", propOrder = {
"meta"
"meta"
})
public class Entity
extends BaseElement
{
extends BaseElement {
@XmlElement(name = "Meta")
protected List<Meta> meta;
@Getter
@Setter
@XmlAttribute(name = "name", required = true)
protected String name;
@Setter
@XmlAttribute(name = "regid")
@XmlSchemaType(name = "anyURI")
protected String regid;
@XmlAttribute(name = "role", required = true)
@XmlSchemaType(name = "NMTOKENS")
protected List<String> role;
@Getter
@Setter
@XmlAttribute(name = "thumbprint")
protected String thumbprint;
@ -82,8 +91,6 @@ public class Entity
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Meta }
*
*
*/
public List<Meta> getMeta() {
if (meta == null) {
@ -92,37 +99,11 @@ public class Entity
return this.meta;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the regid property.
*
* @return
* possible object is
* {@link String }
*
* @return possible object is
* {@link String }
*/
public String getRegid() {
if (regid == null) {
@ -132,18 +113,6 @@ public class Entity
}
}
/**
* Sets the value of the regid property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRegid(String value) {
this.regid = value;
}
/**
* Gets the value of the role property.
*
@ -163,38 +132,11 @@ public class Entity
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/
public List<String> getRole() {
if (role == null) {
role = new ArrayList<String>();
role = new ArrayList<>();
}
return this.role;
}
/**
* Gets the value of the thumbprint property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getThumbprint() {
return thumbprint;
}
/**
* Sets the value of the thumbprint property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setThumbprint(String value) {
this.thumbprint = value;
}
}

View File

@ -13,6 +13,9 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import javax.xml.datatype.XMLGregorianCalendar;
@ -32,67 +35,18 @@ import javax.xml.datatype.XMLGregorianCalendar;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Evidence", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
public class Evidence
extends ResourceCollection
{
extends ResourceCollection {
@XmlAttribute(name = "date")
@XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar date;
@XmlAttribute(name = "deviceId")
protected String deviceId;
/**
* Gets the value of the date property.
*
* @return
* possible object is
* {@link XMLGregorianCalendar }
*
*/
public XMLGregorianCalendar getDate() {
return date;
}
/**
* Sets the value of the date property.
*
* @param value
* allowed object is
* {@link XMLGregorianCalendar }
*
*/
public void setDate(XMLGregorianCalendar value) {
this.date = value;
}
/**
* Gets the value of the deviceId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDeviceId() {
return deviceId;
}
/**
* Sets the value of the deviceId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDeviceId(String value) {
this.deviceId = value;
}
}

View File

@ -8,11 +8,14 @@
package hirs.utils.xjc;
import java.math.BigInteger;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import java.math.BigInteger;
/**
@ -31,66 +34,17 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "File", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
public class File
extends FilesystemItem
{
extends FilesystemItem {
@XmlAttribute(name = "size")
protected BigInteger size;
@XmlAttribute(name = "version")
protected String version;
/**
* Gets the value of the size property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getSize() {
return size;
}
/**
* Sets the value of the size property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setSize(BigInteger value) {
this.size = value;
}
/**
* Gets the value of the version property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVersion() {
return version;
}
/**
* Sets the value of the version property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVersion(String value) {
this.version = value;
}
}

View File

@ -13,6 +13,8 @@ import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
/**
@ -33,122 +35,27 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FilesystemItem", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
@XmlSeeAlso({
File.class,
Directory.class
File.class,
Directory.class
})
public class FilesystemItem
extends Meta
{
extends Meta {
@XmlAttribute(name = "key")
protected Boolean key;
@XmlAttribute(name = "location")
protected String location;
@XmlAttribute(name = "name", required = true)
protected String name;
@XmlAttribute(name = "root")
protected String root;
/**
* Gets the value of the key property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isKey() {
return key;
}
/**
* Sets the value of the key property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setKey(Boolean value) {
this.key = value;
}
/**
* Gets the value of the location property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocation() {
return location;
}
/**
* Sets the value of the location property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocation(String value) {
this.location = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the root property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRoot() {
return root;
}
/**
* Sets the value of the root property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRoot(String value) {
this.root = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
@ -23,8 +21,13 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.Getter;
import lombok.Setter;
import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for KeyInfoType complex type.
@ -50,27 +53,28 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "KeyInfoType", propOrder = {
"content"
"content"
})
public class KeyInfoType {
@XmlElementRefs({
@XmlElementRef(name = "KeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "X509Data", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "KeyName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "PGPData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "MgmtData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "SPKIData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "RetrievalMethod", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false)
@XmlElementRef(name = "KeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "X509Data", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "KeyName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "PGPData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "MgmtData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "SPKIData", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "RetrievalMethod", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false)
})
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
@Getter
@Setter
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@ -105,38 +109,11 @@ public class KeyInfoType {
* {@link Element }
* {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >}
* {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >}
*
*
*/
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
content = new ArrayList<>();
}
return this.content;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
@ -20,6 +18,9 @@ import jakarta.xml.bind.annotation.XmlMixed;
import jakarta.xml.bind.annotation.XmlType;
import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for KeyValueType complex type.
@ -39,18 +40,16 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "KeyValueType", propOrder = {
"content"
"content"
})
public class KeyValueType {
@XmlElementRefs({
@XmlElementRef(name = "RSAKeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "DSAKeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false)
@XmlElementRef(name = "RSAKeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "DSAKeyValue", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false)
})
@XmlMixed
@XmlAnyElement(lax = true)
@ -79,12 +78,10 @@ public class KeyValueType {
* {@link String }
* {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >}
* {@link Object }
*
*
*/
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
content = new ArrayList<>();
}
return this.content;
}

View File

@ -15,6 +15,8 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.Getter;
import lombok.Setter;
/**
@ -38,199 +40,35 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Link", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
public class Link
extends BaseElement
{
extends BaseElement {
@XmlAttribute(name = "artifact")
protected String artifact;
@XmlAttribute(name = "href", required = true)
@XmlSchemaType(name = "anyURI")
protected String href;
@XmlAttribute(name = "media")
protected String media;
@XmlAttribute(name = "ownership")
protected Ownership ownership;
@XmlAttribute(name = "rel", required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "NMTOKEN")
protected String rel;
@XmlAttribute(name = "type")
protected String type;
@XmlAttribute(name = "use")
protected Use use;
/**
* Gets the value of the artifact property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getArtifact() {
return artifact;
}
/**
* Sets the value of the artifact property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setArtifact(String value) {
this.artifact = value;
}
/**
* Gets the value of the href property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHref() {
return href;
}
/**
* Sets the value of the href property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHref(String value) {
this.href = value;
}
/**
* Gets the value of the media property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMedia() {
return media;
}
/**
* Sets the value of the media property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMedia(String value) {
this.media = value;
}
/**
* Gets the value of the ownership property.
*
* @return
* possible object is
* {@link Ownership }
*
*/
public Ownership getOwnership() {
return ownership;
}
/**
* Sets the value of the ownership property.
*
* @param value
* allowed object is
* {@link Ownership }
*
*/
public void setOwnership(Ownership value) {
this.ownership = value;
}
/**
* Gets the value of the rel property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRel() {
return rel;
}
/**
* Sets the value of the rel property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRel(String value) {
this.rel = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
/**
* Gets the value of the use property.
*
* @return
* possible object is
* {@link Use }
*
*/
public Use getUse() {
return use;
}
/**
* Sets the value of the use property.
*
* @param value
* allowed object is
* {@link Use }
*
*/
public void setUse(Use value) {
this.use = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
@ -19,6 +17,11 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
@ -38,17 +41,18 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ManifestType", propOrder = {
"reference"
"reference"
})
public class ManifestType {
@XmlElement(name = "Reference", required = true)
protected List<ReferenceType> reference;
@Getter
@Setter
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@ -74,38 +78,11 @@ public class ManifestType {
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/
public List<ReferenceType> getReference() {
if (reference == null) {
reference = new ArrayList<ReferenceType>();
reference = new ArrayList<>();
}
return this.reference;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}

View File

@ -28,20 +28,17 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Meta", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
@XmlSeeAlso({
SoftwareMeta.class,
Resource.class,
Process.class,
FilesystemItem.class
SoftwareMeta.class,
Resource.class,
Process.class,
FilesystemItem.class
})
public class Meta
extends BaseElement
{
extends BaseElement {
}

View File

@ -8,11 +8,12 @@
package hirs.utils.xjc;
import java.math.BigInteger;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlElementDecl;
import jakarta.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
import java.math.BigInteger;
/**
@ -27,64 +28,94 @@ import javax.xml.namespace.QName;
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _SPKIData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SPKIData");
private final static QName _KeyInfo_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyInfo");
private final static QName _SignatureValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureValue");
private final static QName _SignatureValue_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureValue");
private final static QName _KeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyValue");
private final static QName _Transforms_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Transforms");
private final static QName _DigestMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DigestMethod");
private final static QName _Transforms_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "Transforms");
private final static QName _DigestMethod_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "DigestMethod");
private final static QName _X509Data_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Data");
private final static QName _SignatureProperty_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperty");
private final static QName _SignatureProperty_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperty");
private final static QName _KeyName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "KeyName");
private final static QName _RSAKeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "RSAKeyValue");
private final static QName _SoftwareIdentity_QNAME = new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "SoftwareIdentity");
private final static QName _Signature_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Signature");
private final static QName _RSAKeyValue_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "RSAKeyValue");
private final static QName _SoftwareIdentity_QNAME =
new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "SoftwareIdentity");
private final static QName _Signature_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "Signature");
private final static QName _MgmtData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "MgmtData");
private final static QName _SignatureMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureMethod");
private final static QName _SignatureMethod_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureMethod");
private final static QName _Object_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Object");
private final static QName _SignatureProperties_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperties");
private final static QName _Transform_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Transform");
private final static QName _SignatureProperties_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "SignatureProperties");
private final static QName _Transform_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "Transform");
private final static QName _PGPData_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPData");
private final static QName _Reference_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Reference");
private final static QName _RetrievalMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "RetrievalMethod");
private final static QName _DSAKeyValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DSAKeyValue");
private final static QName _DigestValue_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "DigestValue");
private final static QName _CanonicalizationMethod_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "CanonicalizationMethod");
private final static QName _SignedInfo_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SignedInfo");
private final static QName _Reference_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "Reference");
private final static QName _RetrievalMethod_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "RetrievalMethod");
private final static QName _DSAKeyValue_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "DSAKeyValue");
private final static QName _DigestValue_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "DigestValue");
private final static QName _CanonicalizationMethod_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "CanonicalizationMethod");
private final static QName _SignedInfo_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "SignedInfo");
private final static QName _Manifest_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Manifest");
private final static QName _TransformTypeXPath_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "XPath");
private final static QName _X509DataTypeX509IssuerSerial_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509IssuerSerial");
private final static QName _X509DataTypeX509CRL_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509CRL");
private final static QName _X509DataTypeX509SubjectName_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SubjectName");
private final static QName _X509DataTypeX509SKI_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509SKI");
private final static QName _X509DataTypeX509Certificate_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "X509Certificate");
private final static QName _SoftwareIdentityLink_QNAME = new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Link");
private final static QName _SoftwareIdentityEvidence_QNAME = new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Evidence");
private final static QName _SoftwareIdentityPayload_QNAME = new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Payload");
private final static QName _PayloadDirectory_QNAME = new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Directory");
private final static QName _DirectoryFile_QNAME = new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "File");
private final static QName _SoftwareIdentityEntity_QNAME = new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Entity");
private final static QName _SoftwareIdentityMeta_QNAME = new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Meta");
private final static QName _SignatureMethodTypeHMACOutputLength_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "HMACOutputLength");
private final static QName _SPKIDataTypeSPKISexp_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "SPKISexp");
private final static QName _PGPDataTypePGPKeyID_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyID");
private final static QName _PGPDataTypePGPKeyPacket_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyPacket");
private final static QName _TransformTypeXPath_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "XPath");
private final static QName _X509DataTypeX509IssuerSerial_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "X509IssuerSerial");
private final static QName _X509DataTypeX509CRL_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "X509CRL");
private final static QName _X509DataTypeX509SubjectName_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "X509SubjectName");
private final static QName _X509DataTypeX509SKI_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "X509SKI");
private final static QName _X509DataTypeX509Certificate_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "X509Certificate");
private final static QName _SoftwareIdentityLink_QNAME =
new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Link");
private final static QName _SoftwareIdentityEvidence_QNAME =
new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Evidence");
private final static QName _SoftwareIdentityPayload_QNAME =
new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Payload");
private final static QName _PayloadDirectory_QNAME =
new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Directory");
private final static QName _DirectoryFile_QNAME =
new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "File");
private final static QName _SoftwareIdentityEntity_QNAME =
new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Entity");
private final static QName _SoftwareIdentityMeta_QNAME =
new QName("http://standards.iso.org/iso/19770/-2/2015/schema.xsd", "Meta");
private final static QName _SignatureMethodTypeHMACOutputLength_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "HMACOutputLength");
private final static QName _SPKIDataTypeSPKISexp_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "SPKISexp");
private final static QName _PGPDataTypePGPKeyID_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyID");
private final static QName _PGPDataTypePGPKeyPacket_QNAME =
new QName("http://www.w3.org/2000/09/xmldsig#", "PGPKeyPacket");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: main.java.hirs.utils.xjc
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link SoftwareIdentity }
*
*/
public SoftwareIdentity createSoftwareIdentity() {
return new SoftwareIdentity();
@ -92,7 +123,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link SoftwareMeta }
*
*/
public SoftwareMeta createSoftwareMeta() {
return new SoftwareMeta();
@ -100,7 +130,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link Entity }
*
*/
public Entity createEntity() {
return new Entity();
@ -108,7 +137,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link Meta }
*
*/
public Meta createMeta() {
return new Meta();
@ -116,7 +144,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link FilesystemItem }
*
*/
public FilesystemItem createFilesystemItem() {
return new FilesystemItem();
@ -124,7 +151,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link Resource }
*
*/
public Resource createResource() {
return new Resource();
@ -132,7 +158,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link Process }
*
*/
public Process createProcess() {
return new Process();
@ -140,7 +165,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link BaseElement }
*
*/
public BaseElement createBaseElement() {
return new BaseElement();
@ -148,7 +172,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link Evidence }
*
*/
public Evidence createEvidence() {
return new Evidence();
@ -156,7 +179,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link File }
*
*/
public File createFile() {
return new File();
@ -164,7 +186,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link Link }
*
*/
public Link createLink() {
return new Link();
@ -172,7 +193,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link Directory }
*
*/
public Directory createDirectory() {
return new Directory();
@ -180,7 +200,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link ResourceCollection }
*
*/
public ResourceCollection createResourceCollection() {
return new ResourceCollection();
@ -188,7 +207,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link PGPDataType }
*
*/
public PGPDataType createPGPDataType() {
return new PGPDataType();
@ -196,7 +214,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link KeyValueType }
*
*/
public KeyValueType createKeyValueType() {
return new KeyValueType();
@ -204,7 +221,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link DSAKeyValueType }
*
*/
public DSAKeyValueType createDSAKeyValueType() {
return new DSAKeyValueType();
@ -212,7 +228,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link ReferenceType }
*
*/
public ReferenceType createReferenceType() {
return new ReferenceType();
@ -220,7 +235,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link RetrievalMethodType }
*
*/
public RetrievalMethodType createRetrievalMethodType() {
return new RetrievalMethodType();
@ -228,7 +242,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link TransformsType }
*
*/
public TransformsType createTransformsType() {
return new TransformsType();
@ -236,7 +249,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link CanonicalizationMethodType }
*
*/
public CanonicalizationMethodType createCanonicalizationMethodType() {
return new CanonicalizationMethodType();
@ -244,7 +256,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link DigestMethodType }
*
*/
public DigestMethodType createDigestMethodType() {
return new DigestMethodType();
@ -252,7 +263,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link ManifestType }
*
*/
public ManifestType createManifestType() {
return new ManifestType();
@ -260,7 +270,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link SignaturePropertyType }
*
*/
public SignaturePropertyType createSignaturePropertyType() {
return new SignaturePropertyType();
@ -268,7 +277,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link X509DataType }
*
*/
public X509DataType createX509DataType() {
return new X509DataType();
@ -276,7 +284,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link SignedInfoType }
*
*/
public SignedInfoType createSignedInfoType() {
return new SignedInfoType();
@ -284,7 +291,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link RSAKeyValueType }
*
*/
public RSAKeyValueType createRSAKeyValueType() {
return new RSAKeyValueType();
@ -292,7 +298,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link SPKIDataType }
*
*/
public SPKIDataType createSPKIDataType() {
return new SPKIDataType();
@ -300,7 +305,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link SignatureValueType }
*
*/
public SignatureValueType createSignatureValueType() {
return new SignatureValueType();
@ -308,7 +312,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link KeyInfoType }
*
*/
public KeyInfoType createKeyInfoType() {
return new KeyInfoType();
@ -316,7 +319,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link SignatureType }
*
*/
public SignatureType createSignatureType() {
return new SignatureType();
@ -324,7 +326,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link SignaturePropertiesType }
*
*/
public SignaturePropertiesType createSignaturePropertiesType() {
return new SignaturePropertiesType();
@ -332,7 +333,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link SignatureMethodType }
*
*/
public SignatureMethodType createSignatureMethodType() {
return new SignatureMethodType();
@ -340,7 +340,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link ObjectType }
*
*/
public ObjectType createObjectType() {
return new ObjectType();
@ -348,7 +347,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link TransformType }
*
*/
public TransformType createTransformType() {
return new TransformType();
@ -356,7 +354,6 @@ public class ObjectFactory {
/**
* Create an instance of {@link X509IssuerSerialType }
*
*/
public X509IssuerSerialType createX509IssuerSerialType() {
return new X509IssuerSerialType();
@ -364,380 +361,360 @@ public class ObjectFactory {
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKIData")
public JAXBElement<SPKIDataType> createSPKIData(SPKIDataType value) {
return new JAXBElement<SPKIDataType>(_SPKIData_QNAME, SPKIDataType.class, null, value);
return new JAXBElement<>(_SPKIData_QNAME, SPKIDataType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link KeyInfoType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyInfo")
public JAXBElement<KeyInfoType> createKeyInfo(KeyInfoType value) {
return new JAXBElement<KeyInfoType>(_KeyInfo_QNAME, KeyInfoType.class, null, value);
return new JAXBElement<>(_KeyInfo_QNAME, KeyInfoType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SignatureValueType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureValue")
public JAXBElement<SignatureValueType> createSignatureValue(SignatureValueType value) {
return new JAXBElement<SignatureValueType>(_SignatureValue_QNAME, SignatureValueType.class, null, value);
return new JAXBElement<>(_SignatureValue_QNAME, SignatureValueType.class, null,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link KeyValueType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyValue")
public JAXBElement<KeyValueType> createKeyValue(KeyValueType value) {
return new JAXBElement<KeyValueType>(_KeyValue_QNAME, KeyValueType.class, null, value);
return new JAXBElement<>(_KeyValue_QNAME, KeyValueType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link TransformsType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transforms")
public JAXBElement<TransformsType> createTransforms(TransformsType value) {
return new JAXBElement<TransformsType>(_Transforms_QNAME, TransformsType.class, null, value);
return new JAXBElement<>(_Transforms_QNAME, TransformsType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link DigestMethodType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DigestMethod")
public JAXBElement<DigestMethodType> createDigestMethod(DigestMethodType value) {
return new JAXBElement<DigestMethodType>(_DigestMethod_QNAME, DigestMethodType.class, null, value);
return new JAXBElement<>(_DigestMethod_QNAME, DigestMethodType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link X509DataType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Data")
public JAXBElement<X509DataType> createX509Data(X509DataType value) {
return new JAXBElement<X509DataType>(_X509Data_QNAME, X509DataType.class, null, value);
return new JAXBElement<>(_X509Data_QNAME, X509DataType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SignaturePropertyType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperty")
public JAXBElement<SignaturePropertyType> createSignatureProperty(SignaturePropertyType value) {
return new JAXBElement<SignaturePropertyType>(_SignatureProperty_QNAME, SignaturePropertyType.class, null, value);
return new JAXBElement<>(_SignatureProperty_QNAME, SignaturePropertyType.class,
null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyName")
public JAXBElement<String> createKeyName(String value) {
return new JAXBElement<String>(_KeyName_QNAME, String.class, null, value);
return new JAXBElement<>(_KeyName_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link RSAKeyValueType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "RSAKeyValue")
public JAXBElement<RSAKeyValueType> createRSAKeyValue(RSAKeyValueType value) {
return new JAXBElement<RSAKeyValueType>(_RSAKeyValue_QNAME, RSAKeyValueType.class, null, value);
return new JAXBElement<>(_RSAKeyValue_QNAME, RSAKeyValueType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SoftwareIdentity }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", name = "SoftwareIdentity")
public JAXBElement<SoftwareIdentity> createSoftwareIdentity(SoftwareIdentity value) {
return new JAXBElement<SoftwareIdentity>(_SoftwareIdentity_QNAME, SoftwareIdentity.class, null, value);
return new JAXBElement<>(_SoftwareIdentity_QNAME, SoftwareIdentity.class, null,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SignatureType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Signature")
public JAXBElement<SignatureType> createSignature(SignatureType value) {
return new JAXBElement<SignatureType>(_Signature_QNAME, SignatureType.class, null, value);
return new JAXBElement<>(_Signature_QNAME, SignatureType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "MgmtData")
public JAXBElement<String> createMgmtData(String value) {
return new JAXBElement<String>(_MgmtData_QNAME, String.class, null, value);
return new JAXBElement<>(_MgmtData_QNAME, String.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SignatureMethodType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureMethod")
public JAXBElement<SignatureMethodType> createSignatureMethod(SignatureMethodType value) {
return new JAXBElement<SignatureMethodType>(_SignatureMethod_QNAME, SignatureMethodType.class, null, value);
return new JAXBElement<>(_SignatureMethod_QNAME, SignatureMethodType.class, null,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ObjectType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Object")
public JAXBElement<ObjectType> createObject(ObjectType value) {
return new JAXBElement<ObjectType>(_Object_QNAME, ObjectType.class, null, value);
return new JAXBElement<>(_Object_QNAME, ObjectType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SignaturePropertiesType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureProperties")
public JAXBElement<SignaturePropertiesType> createSignatureProperties(SignaturePropertiesType value) {
return new JAXBElement<SignaturePropertiesType>(_SignatureProperties_QNAME, SignaturePropertiesType.class, null, value);
return new JAXBElement<>(_SignatureProperties_QNAME,
SignaturePropertiesType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link TransformType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transform")
public JAXBElement<TransformType> createTransform(TransformType value) {
return new JAXBElement<TransformType>(_Transform_QNAME, TransformType.class, null, value);
return new JAXBElement<>(_Transform_QNAME, TransformType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link PGPDataType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPData")
public JAXBElement<PGPDataType> createPGPData(PGPDataType value) {
return new JAXBElement<PGPDataType>(_PGPData_QNAME, PGPDataType.class, null, value);
return new JAXBElement<>(_PGPData_QNAME, PGPDataType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ReferenceType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Reference")
public JAXBElement<ReferenceType> createReference(ReferenceType value) {
return new JAXBElement<ReferenceType>(_Reference_QNAME, ReferenceType.class, null, value);
return new JAXBElement<>(_Reference_QNAME, ReferenceType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "RetrievalMethod")
public JAXBElement<RetrievalMethodType> createRetrievalMethod(RetrievalMethodType value) {
return new JAXBElement<RetrievalMethodType>(_RetrievalMethod_QNAME, RetrievalMethodType.class, null, value);
return new JAXBElement<>(_RetrievalMethod_QNAME, RetrievalMethodType.class, null,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DSAKeyValue")
public JAXBElement<DSAKeyValueType> createDSAKeyValue(DSAKeyValueType value) {
return new JAXBElement<DSAKeyValueType>(_DSAKeyValue_QNAME, DSAKeyValueType.class, null, value);
return new JAXBElement<>(_DSAKeyValue_QNAME, DSAKeyValueType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "DigestValue")
public JAXBElement<byte[]> createDigestValue(byte[] value) {
return new JAXBElement<byte[]>(_DigestValue_QNAME, byte[].class, null, ((byte[]) value));
return new JAXBElement<>(_DigestValue_QNAME, byte[].class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link CanonicalizationMethodType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "CanonicalizationMethod")
public JAXBElement<CanonicalizationMethodType> createCanonicalizationMethod(CanonicalizationMethodType value) {
return new JAXBElement<CanonicalizationMethodType>(_CanonicalizationMethod_QNAME, CanonicalizationMethodType.class, null, value);
public JAXBElement<CanonicalizationMethodType> createCanonicalizationMethod(
CanonicalizationMethodType value) {
return new JAXBElement<>(_CanonicalizationMethod_QNAME,
CanonicalizationMethodType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SignedInfoType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignedInfo")
public JAXBElement<SignedInfoType> createSignedInfo(SignedInfoType value) {
return new JAXBElement<SignedInfoType>(_SignedInfo_QNAME, SignedInfoType.class, null, value);
return new JAXBElement<>(_SignedInfo_QNAME, SignedInfoType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ManifestType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Manifest")
public JAXBElement<ManifestType> createManifest(ManifestType value) {
return new JAXBElement<ManifestType>(_Manifest_QNAME, ManifestType.class, null, value);
return new JAXBElement<>(_Manifest_QNAME, ManifestType.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "XPath", scope = TransformType.class)
public JAXBElement<String> createTransformTypeXPath(String value) {
return new JAXBElement<String>(_TransformTypeXPath_QNAME, String.class, TransformType.class, value);
return new JAXBElement<>(_TransformTypeXPath_QNAME, String.class, TransformType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link X509IssuerSerialType }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509IssuerSerial", scope = X509DataType.class)
public JAXBElement<X509IssuerSerialType> createX509DataTypeX509IssuerSerial(X509IssuerSerialType value) {
return new JAXBElement<X509IssuerSerialType>(_X509DataTypeX509IssuerSerial_QNAME, X509IssuerSerialType.class, X509DataType.class, value);
return new JAXBElement<>(_X509DataTypeX509IssuerSerial_QNAME,
X509IssuerSerialType.class, X509DataType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509CRL", scope = X509DataType.class)
public JAXBElement<byte[]> createX509DataTypeX509CRL(byte[] value) {
return new JAXBElement<byte[]>(_X509DataTypeX509CRL_QNAME, byte[].class, X509DataType.class, ((byte[]) value));
return new JAXBElement<>(_X509DataTypeX509CRL_QNAME, byte[].class, X509DataType.class,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509SubjectName", scope = X509DataType.class)
public JAXBElement<String> createX509DataTypeX509SubjectName(String value) {
return new JAXBElement<String>(_X509DataTypeX509SubjectName_QNAME, String.class, X509DataType.class, value);
return new JAXBElement<>(_X509DataTypeX509SubjectName_QNAME, String.class, X509DataType.class,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509SKI", scope = X509DataType.class)
public JAXBElement<byte[]> createX509DataTypeX509SKI(byte[] value) {
return new JAXBElement<byte[]>(_X509DataTypeX509SKI_QNAME, byte[].class, X509DataType.class, ((byte[]) value));
return new JAXBElement<>(_X509DataTypeX509SKI_QNAME, byte[].class, X509DataType.class,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509Certificate", scope = X509DataType.class)
public JAXBElement<byte[]> createX509DataTypeX509Certificate(byte[] value) {
return new JAXBElement<byte[]>(_X509DataTypeX509Certificate_QNAME, byte[].class, X509DataType.class, ((byte[]) value));
return new JAXBElement<>(_X509DataTypeX509Certificate_QNAME, byte[].class, X509DataType.class,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Link }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", name = "Link", scope = SoftwareIdentity.class)
public JAXBElement<Link> createSoftwareIdentityLink(Link value) {
return new JAXBElement<Link>(_SoftwareIdentityLink_QNAME, Link.class, SoftwareIdentity.class, value);
return new JAXBElement<>(_SoftwareIdentityLink_QNAME, Link.class, SoftwareIdentity.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Evidence }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", name = "Evidence", scope = SoftwareIdentity.class)
public JAXBElement<Evidence> createSoftwareIdentityEvidence(Evidence value) {
return new JAXBElement<Evidence>(_SoftwareIdentityEvidence_QNAME, Evidence.class, SoftwareIdentity.class, value);
return new JAXBElement<>(_SoftwareIdentityEvidence_QNAME, Evidence.class,
SoftwareIdentity.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ResourceCollection }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", name = "Payload", scope = SoftwareIdentity.class)
public JAXBElement<ResourceCollection> createSoftwareIdentityPayload(ResourceCollection value) {
return new JAXBElement<ResourceCollection>(_SoftwareIdentityPayload_QNAME, ResourceCollection.class, SoftwareIdentity.class, value);
return new JAXBElement<>(_SoftwareIdentityPayload_QNAME, ResourceCollection.class,
SoftwareIdentity.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FilesystemItem }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", name = "Directory", scope = ResourceCollection.class)
public JAXBElement<FilesystemItem> createPayloadDirectory(FilesystemItem value) {
return new JAXBElement<FilesystemItem>(_PayloadDirectory_QNAME, FilesystemItem.class, ResourceCollection.class, value);
return new JAXBElement<>(_PayloadDirectory_QNAME, FilesystemItem.class,
ResourceCollection.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link FilesystemItem }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", name = "File", scope = ResourceCollection.class)
public JAXBElement<FilesystemItem> createDirectoryFile(FilesystemItem value) {
return new JAXBElement<FilesystemItem>(_DirectoryFile_QNAME, FilesystemItem.class, ResourceCollection.class, value);
return new JAXBElement<>(_DirectoryFile_QNAME, FilesystemItem.class,
ResourceCollection.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link Entity }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", name = "Entity", scope = SoftwareIdentity.class)
public JAXBElement<Entity> createSoftwareIdentityEntity(Entity value) {
return new JAXBElement<Entity>(_SoftwareIdentityEntity_QNAME, Entity.class, SoftwareIdentity.class, value);
return new JAXBElement<>(_SoftwareIdentityEntity_QNAME, Entity.class, SoftwareIdentity.class,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link SoftwareMeta }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", name = "Meta", scope = SoftwareIdentity.class)
public JAXBElement<SoftwareMeta> createSoftwareIdentityMeta(SoftwareMeta value) {
return new JAXBElement<SoftwareMeta>(_SoftwareIdentityMeta_QNAME, SoftwareMeta.class, SoftwareIdentity.class, value);
return new JAXBElement<>(_SoftwareIdentityMeta_QNAME, SoftwareMeta.class,
SoftwareIdentity.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link BigInteger }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "HMACOutputLength", scope = SignatureMethodType.class)
public JAXBElement<BigInteger> createSignatureMethodTypeHMACOutputLength(BigInteger value) {
return new JAXBElement<BigInteger>(_SignatureMethodTypeHMACOutputLength_QNAME, BigInteger.class, SignatureMethodType.class, value);
return new JAXBElement<>(_SignatureMethodTypeHMACOutputLength_QNAME, BigInteger.class,
SignatureMethodType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKISexp", scope = SPKIDataType.class)
public JAXBElement<byte[]> createSPKIDataTypeSPKISexp(byte[] value) {
return new JAXBElement<byte[]>(_SPKIDataTypeSPKISexp_QNAME, byte[].class, SPKIDataType.class, ((byte[]) value));
return new JAXBElement<>(_SPKIDataTypeSPKISexp_QNAME, byte[].class, SPKIDataType.class,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyID", scope = PGPDataType.class)
public JAXBElement<byte[]> createPGPDataTypePGPKeyID(byte[] value) {
return new JAXBElement<byte[]>(_PGPDataTypePGPKeyID_QNAME, byte[].class, PGPDataType.class, ((byte[]) value));
return new JAXBElement<>(_PGPDataTypePGPKeyID_QNAME, byte[].class, PGPDataType.class,
value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link byte[]}{@code >}}
*
*/
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "PGPKeyPacket", scope = PGPDataType.class)
public JAXBElement<byte[]> createPGPDataTypePGPKeyPacket(byte[] value) {
return new JAXBElement<byte[]>(_PGPDataTypePGPKeyPacket_QNAME, byte[].class, PGPDataType.class, ((byte[]) value));
return new JAXBElement<>(_PGPDataTypePGPKeyPacket_QNAME, byte[].class, PGPDataType.class,
value);
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAnyElement;
@ -20,8 +18,14 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for ObjectType complex type.
@ -42,25 +46,30 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ObjectType", propOrder = {
"content"
"content"
})
public class ObjectType {
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
@XmlAttribute(name = "MimeType")
protected String mimeType;
@XmlAttribute(name = "Encoding")
@XmlSchemaType(name = "anyURI")
protected String encoding;
@ -86,86 +95,11 @@ public class ObjectType {
* {@link Object }
* {@link Element }
* {@link String }
*
*
*/
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
content = new ArrayList<>();
}
return this.content;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the mimeType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMimeType() {
return mimeType;
}
/**
* Sets the value of the mimeType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMimeType(String value) {
this.mimeType = value;
}
/**
* Gets the value of the encoding property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEncoding() {
return encoding;
}
/**
* Sets the value of the encoding property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEncoding(String value) {
this.encoding = value;
}
}

View File

@ -27,7 +27,6 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/restriction>
* &lt;/simpleType>
* </pre>
*
*/
@XmlType(name = "Ownership", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
@XmlEnum
@ -35,31 +34,22 @@ public enum Ownership {
/**
*
* Determines the relative strength of ownership of the target
* piece of software.
*
*
* Determines the relative strength of ownership of the target
* piece of software.
*/
@XmlEnumValue("abandon")
ABANDON("abandon"),
/**
*
* If this is uninstalled, then the [Link]'d software should be removed
* too.
*
*
* If this is uninstalled, then the [Link]'d software should be removed
* too.
*/
@XmlEnumValue("private")
PRIVATE("private"),
/**
*
* If this is uninstalled, then the [Link]'d software should be removed
* if nobody else is sharing it
*
*
* If this is uninstalled, then the [Link]'d software should be removed
* if nobody else is sharing it
*/
@XmlEnumValue("shared")
SHARED("shared");
@ -69,12 +59,8 @@ public enum Ownership {
value = v;
}
public String value() {
return value;
}
public static Ownership fromValue(String v) {
for (Ownership c: Ownership.values()) {
for (Ownership c : Ownership.values()) {
if (c.value.equals(v)) {
return c;
}
@ -82,4 +68,8 @@ public enum Ownership {
throw new IllegalArgumentException(v);
}
public String value() {
return value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
@ -19,6 +17,9 @@ import jakarta.xml.bind.annotation.XmlElementRefs;
import jakarta.xml.bind.annotation.XmlType;
import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for PGPDataType complex type.
@ -44,18 +45,16 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PGPDataType", propOrder = {
"content"
"content"
})
public class PGPDataType {
@XmlElementRefs({
@XmlElementRef(name = "PGPKeyPacket", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "PGPKeyID", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false)
@XmlElementRef(name = "PGPKeyPacket", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false),
@XmlElementRef(name = "PGPKeyID", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false)
})
@XmlAnyElement(lax = true)
protected List<Object> content;
@ -92,8 +91,6 @@ public class PGPDataType {
* {@link JAXBElement }{@code <}{@link byte[]}{@code >}
* {@link Element }
* {@link Object }
*
*
*/
public List<Object> getContent() {
if (content == null) {

View File

@ -8,11 +8,14 @@
package hirs.utils.xjc;
import java.math.BigInteger;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import java.math.BigInteger;
/**
@ -31,66 +34,16 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Process", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
public class Process
extends Meta
{
extends Meta {
@XmlAttribute(name = "name", required = true)
protected String name;
@XmlAttribute(name = "pid")
protected BigInteger pid;
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the pid property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getPid() {
return pid;
}
/**
* Sets the value of the pid property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setPid(BigInteger value) {
this.pid = value;
}
}

View File

@ -12,6 +12,8 @@ import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
/**
@ -31,63 +33,19 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RSAKeyValueType", propOrder = {
"modulus",
"exponent"
"modulus",
"exponent"
})
public class RSAKeyValueType {
@XmlElement(name = "Modulus", required = true)
protected byte[] modulus;
@XmlElement(name = "Exponent", required = true)
protected byte[] exponent;
/**
* Gets the value of the modulus property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getModulus() {
return modulus;
}
/**
* Sets the value of the modulus property.
*
* @param value
* allowed object is
* byte[]
*/
public void setModulus(byte[] value) {
this.modulus = value;
}
/**
* Gets the value of the exponent property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getExponent() {
return exponent;
}
/**
* Sets the value of the exponent property.
*
* @param value
* allowed object is
* byte[]
*/
public void setExponent(byte[] value) {
this.exponent = value;
}
}

View File

@ -17,6 +17,8 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.Getter;
import lombok.Setter;
/**
@ -40,175 +42,37 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ReferenceType", propOrder = {
"transforms",
"digestMethod",
"digestValue"
"transforms",
"digestMethod",
"digestValue"
})
public class ReferenceType {
@XmlElement(name = "Transforms")
protected TransformsType transforms;
@XmlElement(name = "DigestMethod", required = true)
protected DigestMethodType digestMethod;
@XmlElement(name = "DigestValue", required = true)
protected byte[] digestValue;
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
@XmlAttribute(name = "URI")
@XmlSchemaType(name = "anyURI")
protected String uri;
@XmlAttribute(name = "Type")
@XmlSchemaType(name = "anyURI")
protected String type;
/**
* Gets the value of the transforms property.
*
* @return
* possible object is
* {@link TransformsType }
*
*/
public TransformsType getTransforms() {
return transforms;
}
/**
* Sets the value of the transforms property.
*
* @param value
* allowed object is
* {@link TransformsType }
*
*/
public void setTransforms(TransformsType value) {
this.transforms = value;
}
/**
* Gets the value of the digestMethod property.
*
* @return
* possible object is
* {@link DigestMethodType }
*
*/
public DigestMethodType getDigestMethod() {
return digestMethod;
}
/**
* Sets the value of the digestMethod property.
*
* @param value
* allowed object is
* {@link DigestMethodType }
*
*/
public void setDigestMethod(DigestMethodType value) {
this.digestMethod = value;
}
/**
* Gets the value of the digestValue property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getDigestValue() {
return digestValue;
}
/**
* Sets the value of the digestValue property.
*
* @param value
* allowed object is
* byte[]
*/
public void setDigestValue(byte[] value) {
this.digestValue = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the uri property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getURI() {
return uri;
}
/**
* Sets the value of the uri property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setURI(String value) {
this.uri = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
}

View File

@ -12,6 +12,8 @@ import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
/**
@ -29,40 +31,13 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Resource", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
public class Resource
extends Meta
{
extends Meta {
@XmlAttribute(name = "type", required = true)
protected String type;
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
@ -17,6 +15,9 @@ import jakarta.xml.bind.annotation.XmlElements;
import jakarta.xml.bind.annotation.XmlSeeAlso;
import jakarta.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for ResourceCollection complex type.
@ -38,25 +39,22 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResourceCollection", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", propOrder = {
"directoryOrFileOrProcess"
"directoryOrFileOrProcess"
})
@XmlSeeAlso({
Evidence.class
Evidence.class
})
public class ResourceCollection
extends BaseElement
{
extends BaseElement {
@XmlElements({
@XmlElement(name = "Directory", type = Directory.class),
@XmlElement(name = "File", type = File.class),
@XmlElement(name = "Process", type = Process.class),
@XmlElement(name = "Resource", type = Resource.class)
@XmlElement(name = "Directory", type = Directory.class),
@XmlElement(name = "File", type = File.class),
@XmlElement(name = "Process", type = Process.class),
@XmlElement(name = "Resource", type = Resource.class)
})
protected List<Meta> directoryOrFileOrProcess;
@ -82,8 +80,6 @@ public class ResourceCollection
* {@link File }
* {@link Process }
* {@link Resource }
*
*
*/
public List<Meta> getDirectoryOrFileOrProcess() {
if (directoryOrFileOrProcess == null) {

View File

@ -14,6 +14,8 @@ import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
/**
@ -34,94 +36,23 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RetrievalMethodType", propOrder = {
"transforms"
"transforms"
})
public class RetrievalMethodType {
@XmlElement(name = "Transforms")
protected TransformsType transforms;
@XmlAttribute(name = "URI")
@XmlSchemaType(name = "anyURI")
protected String uri;
@XmlAttribute(name = "Type")
@XmlSchemaType(name = "anyURI")
protected String type;
/**
* Gets the value of the transforms property.
*
* @return
* possible object is
* {@link TransformsType }
*
*/
public TransformsType getTransforms() {
return transforms;
}
/**
* Sets the value of the transforms property.
*
* @param value
* allowed object is
* {@link TransformsType }
*
*/
public void setTransforms(TransformsType value) {
this.transforms = value;
}
/**
* Gets the value of the uri property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getURI() {
return uri;
}
/**
* Sets the value of the uri property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setURI(String value) {
this.uri = value;
}
/**
* Gets the value of the type property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getType() {
return type;
}
/**
* Sets the value of the type property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setType(String value) {
this.type = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
@ -18,6 +16,9 @@ import jakarta.xml.bind.annotation.XmlElementRef;
import jakarta.xml.bind.annotation.XmlType;
import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for SPKIDataType complex type.
@ -36,12 +37,10 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SPKIDataType", propOrder = {
"spkiSexpAndAny"
"spkiSexpAndAny"
})
public class SPKIDataType {
@ -70,8 +69,6 @@ public class SPKIDataType {
* {@link JAXBElement }{@code <}{@link byte[]}{@code >}
* {@link Object }
* {@link Element }
*
*
*/
public List<Object> getSPKISexpAndAny() {
if (spkiSexpAndAny == null) {

View File

@ -8,9 +8,6 @@
package hirs.utils.xjc;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
@ -20,6 +17,12 @@ import jakarta.xml.bind.annotation.XmlElementRef;
import jakarta.xml.bind.annotation.XmlMixed;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
/**
@ -40,12 +43,10 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SignatureMethodType", propOrder = {
"content"
"content"
})
public class SignatureMethodType {
@ -53,6 +54,9 @@ public class SignatureMethodType {
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
@Getter
@Setter
@XmlAttribute(name = "Algorithm", required = true)
@XmlSchemaType(name = "anyURI")
protected String algorithm;
@ -78,8 +82,6 @@ public class SignatureMethodType {
* {@link JAXBElement }{@code <}{@link BigInteger }{@code >}
* {@link Object }
* {@link String }
*
*
*/
public List<Object> getContent() {
if (content == null) {
@ -87,29 +89,4 @@ public class SignatureMethodType {
}
return this.content;
}
/**
* Gets the value of the algorithm property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAlgorithm() {
return algorithm;
}
/**
* Sets the value of the algorithm property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlgorithm(String value) {
this.algorithm = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
@ -19,6 +17,11 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
@ -38,17 +41,18 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SignaturePropertiesType", propOrder = {
"signatureProperty"
"signatureProperty"
})
public class SignaturePropertiesType {
@XmlElement(name = "SignatureProperty", required = true)
protected List<SignaturePropertyType> signatureProperty;
@Getter
@Setter
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@ -74,8 +78,6 @@ public class SignaturePropertiesType {
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SignaturePropertyType }
*
*
*/
public List<SignaturePropertyType> getSignatureProperty() {
if (signatureProperty == null) {
@ -83,29 +85,4 @@ public class SignaturePropertiesType {
}
return this.signatureProperty;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAnyElement;
@ -20,8 +18,14 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for SignaturePropertyType complex type.
@ -41,21 +45,25 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SignaturePropertyType", propOrder = {
"content"
"content"
})
public class SignaturePropertyType {
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
@XmlAttribute(name = "Target", required = true)
@XmlSchemaType(name = "anyURI")
protected String target;
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@ -83,62 +91,11 @@ public class SignaturePropertyType {
* {@link Object }
* {@link Element }
* {@link String }
*
*
*/
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
content = new ArrayList<>();
}
return this.content;
}
/**
* Gets the value of the target property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getTarget() {
return target;
}
/**
* Sets the value of the target property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTarget(String value) {
this.target = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
@ -19,6 +17,12 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
@ -41,104 +45,38 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SignatureType", propOrder = {
"signedInfo",
"signatureValue",
"keyInfo",
"object"
"signedInfo",
"signatureValue",
"keyInfo",
"object"
})
public class SignatureType {
@XmlElement(name = "SignedInfo", required = true)
protected SignedInfoType signedInfo;
@XmlElement(name = "SignatureValue", required = true)
protected SignatureValueType signatureValue;
@XmlElement(name = "KeyInfo")
protected KeyInfoType keyInfo;
@Setter(AccessLevel.NONE)
@Getter(AccessLevel.NONE)
@XmlElement(name = "Object")
protected List<ObjectType> object;
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
/**
* Gets the value of the signedInfo property.
*
* @return
* possible object is
* {@link SignedInfoType }
*
*/
public SignedInfoType getSignedInfo() {
return signedInfo;
}
/**
* Sets the value of the signedInfo property.
*
* @param value
* allowed object is
* {@link SignedInfoType }
*
*/
public void setSignedInfo(SignedInfoType value) {
this.signedInfo = value;
}
/**
* Gets the value of the signatureValue property.
*
* @return
* possible object is
* {@link SignatureValueType }
*
*/
public SignatureValueType getSignatureValue() {
return signatureValue;
}
/**
* Sets the value of the signatureValue property.
*
* @param value
* allowed object is
* {@link SignatureValueType }
*
*/
public void setSignatureValue(SignatureValueType value) {
this.signatureValue = value;
}
/**
* Gets the value of the keyInfo property.
*
* @return
* possible object is
* {@link KeyInfoType }
*
*/
public KeyInfoType getKeyInfo() {
return keyInfo;
}
/**
* Sets the value of the keyInfo property.
*
* @param value
* allowed object is
* {@link KeyInfoType }
*
*/
public void setKeyInfo(KeyInfoType value) {
this.keyInfo = value;
}
/**
* Gets the value of the object property.
*
@ -158,38 +96,11 @@ public class SignatureType {
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ObjectType }
*
*
*/
public List<ObjectType> getObject() {
if (object == null) {
object = new ArrayList<ObjectType>();
object = new ArrayList<>();
}
return this.object;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}

View File

@ -17,6 +17,8 @@ import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.XmlValue;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.Getter;
import lombok.Setter;
/**
@ -33,67 +35,20 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
* &lt;/simpleContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SignatureValueType", propOrder = {
"value"
"value"
})
public class SignatureValueType {
@XmlValue
protected byte[] value;
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
/**
* Gets the value of the value property.
*
* @return
* possible object is
* byte[]
*/
public byte[] getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* byte[]
*/
public void setValue(byte[] value) {
this.value = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
@ -19,6 +17,12 @@ import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
/**
@ -40,77 +44,34 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SignedInfoType", propOrder = {
"canonicalizationMethod",
"signatureMethod",
"reference"
"canonicalizationMethod",
"signatureMethod",
"reference"
})
public class SignedInfoType {
@XmlElement(name = "CanonicalizationMethod", required = true)
protected CanonicalizationMethodType canonicalizationMethod;
@XmlElement(name = "SignatureMethod", required = true)
protected SignatureMethodType signatureMethod;
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
@XmlElement(name = "Reference", required = true)
protected List<ReferenceType> reference;
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
/**
* Gets the value of the canonicalizationMethod property.
*
* @return
* possible object is
* {@link CanonicalizationMethodType }
*
*/
public CanonicalizationMethodType getCanonicalizationMethod() {
return canonicalizationMethod;
}
/**
* Sets the value of the canonicalizationMethod property.
*
* @param value
* allowed object is
* {@link CanonicalizationMethodType }
*
*/
public void setCanonicalizationMethod(CanonicalizationMethodType value) {
this.canonicalizationMethod = value;
}
/**
* Gets the value of the signatureMethod property.
*
* @return
* possible object is
* {@link SignatureMethodType }
*
*/
public SignatureMethodType getSignatureMethod() {
return signatureMethod;
}
/**
* Sets the value of the signatureMethod property.
*
* @param value
* allowed object is
* {@link SignatureMethodType }
*
*/
public void setSignatureMethod(SignatureMethodType value) {
this.signatureMethod = value;
}
/**
* Gets the value of the reference property.
*
@ -130,38 +91,11 @@ public class SignedInfoType {
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/
public List<ReferenceType> getReference() {
if (reference == null) {
reference = new ArrayList<ReferenceType>();
reference = new ArrayList<>();
}
return this.reference;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}

View File

@ -8,9 +8,6 @@
package hirs.utils.xjc;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
@ -24,6 +21,10 @@ import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.w3c.dom.Element;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for SoftwareIdentity complex type.
@ -56,23 +57,20 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SoftwareIdentity", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", propOrder = {
"entityOrEvidenceOrLink"
"entityOrEvidenceOrLink"
})
public class SoftwareIdentity
extends BaseElement
{
extends BaseElement {
@XmlElementRefs({
@XmlElementRef(name = "Meta", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false),
@XmlElementRef(name = "Link", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false),
@XmlElementRef(name = "Entity", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false),
@XmlElementRef(name = "Payload", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false),
@XmlElementRef(name = "Evidence", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false)
@XmlElementRef(name = "Meta", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false),
@XmlElementRef(name = "Link", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false),
@XmlElementRef(name = "Entity", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false),
@XmlElementRef(name = "Payload", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false),
@XmlElementRef(name = "Evidence", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd", type = JAXBElement.class, required = false)
})
@XmlAnyElement(lax = true)
protected List<Object> entityOrEvidenceOrLink;
@ -122,8 +120,6 @@ public class SoftwareIdentity
* {@link JAXBElement }{@code <}{@link ResourceCollection }{@code >}
* {@link Element }
* {@link JAXBElement }{@code <}{@link Evidence }{@code >}
*
*
*/
public List<Object> getEntityOrEvidenceOrLink() {
if (entityOrEvidenceOrLink == null) {
@ -135,10 +131,8 @@ public class SoftwareIdentity
/**
* Gets the value of the corpus property.
*
* @return
* possible object is
* {@link Boolean }
*
* @return possible object is
* {@link Boolean }
*/
public boolean isCorpus() {
if (corpus == null) {
@ -151,10 +145,8 @@ public class SoftwareIdentity
/**
* Sets the value of the corpus property.
*
* @param value
* allowed object is
* {@link Boolean }
*
* @param value allowed object is
* {@link Boolean }
*/
public void setCorpus(Boolean value) {
this.corpus = value;
@ -163,10 +155,8 @@ public class SoftwareIdentity
/**
* Gets the value of the patch property.
*
* @return
* possible object is
* {@link Boolean }
*
* @return possible object is
* {@link Boolean }
*/
public boolean isPatch() {
if (patch == null) {
@ -179,10 +169,8 @@ public class SoftwareIdentity
/**
* Sets the value of the patch property.
*
* @param value
* allowed object is
* {@link Boolean }
*
* @param value allowed object is
* {@link Boolean }
*/
public void setPatch(Boolean value) {
this.patch = value;
@ -191,10 +179,8 @@ public class SoftwareIdentity
/**
* Gets the value of the media property.
*
* @return
* possible object is
* {@link String }
*
* @return possible object is
* {@link String }
*/
public String getMedia() {
return media;
@ -203,10 +189,8 @@ public class SoftwareIdentity
/**
* Sets the value of the media property.
*
* @param value
* allowed object is
* {@link String }
*
* @param value allowed object is
* {@link String }
*/
public void setMedia(String value) {
this.media = value;
@ -215,10 +199,8 @@ public class SoftwareIdentity
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
* @return possible object is
* {@link String }
*/
public String getName() {
return name;
@ -227,10 +209,8 @@ public class SoftwareIdentity
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
* @param value allowed object is
* {@link String }
*/
public void setName(String value) {
this.name = value;
@ -239,10 +219,8 @@ public class SoftwareIdentity
/**
* Gets the value of the supplemental property.
*
* @return
* possible object is
* {@link Boolean }
*
* @return possible object is
* {@link Boolean }
*/
public boolean isSupplemental() {
if (supplemental == null) {
@ -255,10 +233,8 @@ public class SoftwareIdentity
/**
* Sets the value of the supplemental property.
*
* @param value
* allowed object is
* {@link Boolean }
*
* @param value allowed object is
* {@link Boolean }
*/
public void setSupplemental(Boolean value) {
this.supplemental = value;
@ -267,10 +243,8 @@ public class SoftwareIdentity
/**
* Gets the value of the tagId property.
*
* @return
* possible object is
* {@link String }
*
* @return possible object is
* {@link String }
*/
public String getTagId() {
return tagId;
@ -279,10 +253,8 @@ public class SoftwareIdentity
/**
* Sets the value of the tagId property.
*
* @param value
* allowed object is
* {@link String }
*
* @param value allowed object is
* {@link String }
*/
public void setTagId(String value) {
this.tagId = value;
@ -291,10 +263,8 @@ public class SoftwareIdentity
/**
* Gets the value of the tagVersion property.
*
* @return
* possible object is
* {@link BigInteger }
*
* @return possible object is
* {@link BigInteger }
*/
public BigInteger getTagVersion() {
if (tagVersion == null) {
@ -307,10 +277,8 @@ public class SoftwareIdentity
/**
* Sets the value of the tagVersion property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
* @param value allowed object is
* {@link BigInteger }
*/
public void setTagVersion(BigInteger value) {
this.tagVersion = value;
@ -319,10 +287,8 @@ public class SoftwareIdentity
/**
* Gets the value of the version property.
*
* @return
* possible object is
* {@link String }
*
* @return possible object is
* {@link String }
*/
public String getVersion() {
if (version == null) {
@ -335,10 +301,8 @@ public class SoftwareIdentity
/**
* Sets the value of the version property.
*
* @param value
* allowed object is
* {@link String }
*
* @param value allowed object is
* {@link String }
*/
public void setVersion(String value) {
this.version = value;
@ -347,10 +311,8 @@ public class SoftwareIdentity
/**
* Gets the value of the versionScheme property.
*
* @return
* possible object is
* {@link String }
*
* @return possible object is
* {@link String }
*/
public String getVersionScheme() {
if (versionScheme == null) {
@ -363,10 +325,8 @@ public class SoftwareIdentity
/**
* Sets the value of the versionScheme property.
*
* @param value
* allowed object is
* {@link String }
*
* @param value allowed object is
* {@link String }
*/
public void setVersionScheme(String value) {
this.versionScheme = value;

View File

@ -12,6 +12,8 @@ import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
/**
@ -43,404 +45,55 @@ import jakarta.xml.bind.annotation.XmlType;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SoftwareMeta", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd")
public class SoftwareMeta
extends Meta
{
extends Meta {
@XmlAttribute(name = "activationStatus")
protected String activationStatus;
@XmlAttribute(name = "channelType")
protected String channelType;
@XmlAttribute(name = "colloquialVersion")
protected String colloquialVersion;
@XmlAttribute(name = "description")
protected String description;
@XmlAttribute(name = "edition")
protected String edition;
@XmlAttribute(name = "entitlementDataRequired")
protected Boolean entitlementDataRequired;
@XmlAttribute(name = "entitlementKey")
protected String entitlementKey;
@XmlAttribute(name = "generator")
protected String generator;
@XmlAttribute(name = "persistentId")
protected String persistentId;
@XmlAttribute(name = "product")
protected String product;
@XmlAttribute(name = "productFamily")
protected String productFamily;
@XmlAttribute(name = "revision")
protected String revision;
@XmlAttribute(name = "summary")
protected String summary;
@XmlAttribute(name = "unspscCode")
protected String unspscCode;
@XmlAttribute(name = "unspscVersion")
protected String unspscVersion;
/**
* Gets the value of the activationStatus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getActivationStatus() {
return activationStatus;
}
/**
* Sets the value of the activationStatus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setActivationStatus(String value) {
this.activationStatus = value;
}
/**
* Gets the value of the channelType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getChannelType() {
return channelType;
}
/**
* Sets the value of the channelType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setChannelType(String value) {
this.channelType = value;
}
/**
* Gets the value of the colloquialVersion property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getColloquialVersion() {
return colloquialVersion;
}
/**
* Sets the value of the colloquialVersion property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setColloquialVersion(String value) {
this.colloquialVersion = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the edition property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEdition() {
return edition;
}
/**
* Sets the value of the edition property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEdition(String value) {
this.edition = value;
}
/**
* Gets the value of the entitlementDataRequired property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isEntitlementDataRequired() {
return entitlementDataRequired;
}
/**
* Sets the value of the entitlementDataRequired property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setEntitlementDataRequired(Boolean value) {
this.entitlementDataRequired = value;
}
/**
* Gets the value of the entitlementKey property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEntitlementKey() {
return entitlementKey;
}
/**
* Sets the value of the entitlementKey property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEntitlementKey(String value) {
this.entitlementKey = value;
}
/**
* Gets the value of the generator property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGenerator() {
return generator;
}
/**
* Sets the value of the generator property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGenerator(String value) {
this.generator = value;
}
/**
* Gets the value of the persistentId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPersistentId() {
return persistentId;
}
/**
* Sets the value of the persistentId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPersistentId(String value) {
this.persistentId = value;
}
/**
* Gets the value of the product property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProduct() {
return product;
}
/**
* Sets the value of the product property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setProduct(String value) {
this.product = value;
}
/**
* Gets the value of the productFamily property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getProductFamily() {
return productFamily;
}
/**
* Sets the value of the productFamily property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setProductFamily(String value) {
this.productFamily = value;
}
/**
* Gets the value of the revision property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRevision() {
return revision;
}
/**
* Sets the value of the revision property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRevision(String value) {
this.revision = value;
}
/**
* Gets the value of the summary property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSummary() {
return summary;
}
/**
* Sets the value of the summary property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSummary(String value) {
this.summary = value;
}
/**
* Gets the value of the unspscCode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUnspscCode() {
return unspscCode;
}
/**
* Sets the value of the unspscCode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUnspscCode(String value) {
this.unspscCode = value;
}
/**
* Gets the value of the unspscVersion property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUnspscVersion() {
return unspscVersion;
}
/**
* Sets the value of the unspscVersion property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUnspscVersion(String value) {
this.unspscVersion = value;
}
}

View File

@ -8,8 +8,6 @@
package hirs.utils.xjc;
import java.util.ArrayList;
import java.util.List;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
@ -19,8 +17,13 @@ import jakarta.xml.bind.annotation.XmlElementRef;
import jakarta.xml.bind.annotation.XmlMixed;
import jakarta.xml.bind.annotation.XmlSchemaType;
import jakarta.xml.bind.annotation.XmlType;
import lombok.Getter;
import lombok.Setter;
import org.w3c.dom.Element;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for TransformType complex type.
@ -40,12 +43,10 @@ import org.w3c.dom.Element;
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TransformType", propOrder = {
"content"
"content"
})
public class TransformType {
@ -53,6 +54,9 @@ public class TransformType {
@XmlMixed
@XmlAnyElement(lax = true)
protected List<Object> content;
@Getter
@Setter
@XmlAttribute(name = "Algorithm", required = true)
@XmlSchemaType(name = "anyURI")
protected String algorithm;
@ -79,8 +83,6 @@ public class TransformType {
* {@link String }
* {@link JAXBElement }{@code <}{@link String }{@code >}
* {@link Object }
*
*
*/
public List<Object> getContent() {
if (content == null) {
@ -88,29 +90,4 @@ public class TransformType {
}
return this.content;
}
/**
* Gets the value of the algorithm property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAlgorithm() {
return algorithm;
}
/**
* Sets the value of the algorithm property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlgorithm(String value) {
this.algorithm = value;
}
}

Some files were not shown because too many files have changed in this diff Show More