diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java index bf16cfd3..b06af3df 100644 --- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java +++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java @@ -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 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) diff --git a/HIRS_Utils/build.gradle b/HIRS_Utils/build.gradle index c9135b87..4a2dad4f 100644 --- a/HIRS_Utils/build.gradle +++ b/HIRS_Utils/build.gradle @@ -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 { diff --git a/HIRS_Utils/config/spotbugs/spotbugs-exclude.xml b/HIRS_Utils/config/spotbugs/spotbugs-exclude.xml index 7a56fa00..3009f344 100644 --- a/HIRS_Utils/config/spotbugs/spotbugs-exclude.xml +++ b/HIRS_Utils/config/spotbugs/spotbugs-exclude.xml @@ -2,14 +2,14 @@ - + - + - + diff --git a/HIRS_Utils/src/main/java/hirs/utils/PciIds.java b/HIRS_Utils/src/main/java/hirs/utils/PciIds.java index a5c394ae..b475aafd 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/PciIds.java +++ b/HIRS_Utils/src/main/java/hirs/utils/PciIds.java @@ -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 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 3-element list with the class code * . 1st element: human-readable description of Class * . 2nd element: human-readable description of Subclass diff --git a/HIRS_Utils/src/main/java/hirs/utils/StringValidator.java b/HIRS_Utils/src/main/java/hirs/utils/StringValidator.java index decd9b27..ef2be1fb 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/StringValidator.java +++ b/HIRS_Utils/src/main/java/hirs/utils/StringValidator.java @@ -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. diff --git a/HIRS_Utils/src/main/java/hirs/utils/digest/Digest.java b/HIRS_Utils/src/main/java/hirs/utils/digest/Digest.java index b09eb5d8..5f094020 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/digest/Digest.java +++ b/HIRS_Utils/src/main/java/hirs/utils/digest/Digest.java @@ -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 Digest. * * @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 Digest 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)); - } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/digest/DigestComparisonResultType.java b/HIRS_Utils/src/main/java/hirs/utils/digest/DigestComparisonResultType.java index ebe1be5f..0194ca3e 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/digest/DigestComparisonResultType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/digest/DigestComparisonResultType.java @@ -3,7 +3,6 @@ package hirs.utils.digest; /** * Enumeration identifying the different outcomes of a comparison between * two {@link Digest} objects. - * */ public enum DigestComparisonResultType { /** diff --git a/HIRS_Utils/src/main/java/hirs/utils/digest/OptionalDigest.java b/HIRS_Utils/src/main/java/hirs/utils/digest/OptionalDigest.java index b0152ea7..38f0ac32 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/digest/OptionalDigest.java +++ b/HIRS_Utils/src/main/java/hirs/utils/digest/OptionalDigest.java @@ -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 OptionalDigest. * * @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)); - } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/enums/DeviceInfoEnums.java b/HIRS_Utils/src/main/java/hirs/utils/enums/DeviceInfoEnums.java index 067f7137..418fb059 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/enums/DeviceInfoEnums.java +++ b/HIRS_Utils/src/main/java/hirs/utils/enums/DeviceInfoEnums.java @@ -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. */ diff --git a/HIRS_Utils/src/main/java/hirs/utils/exception/PolicyManagerException.java b/HIRS_Utils/src/main/java/hirs/utils/exception/PolicyManagerException.java index 48bcb742..ae7a234e 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/exception/PolicyManagerException.java +++ b/HIRS_Utils/src/main/java/hirs/utils/exception/PolicyManagerException.java @@ -12,8 +12,7 @@ public class PolicyManagerException extends RuntimeException { * Creates a new PolicyManagerException that has the message * msg. * - * @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 PolicyManagerException that wraps the given * Throwable. * - * @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 PolicyManagerException that has the message * msg 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); diff --git a/HIRS_Utils/src/main/java/hirs/utils/rim/ReferenceManifestValidator.java b/HIRS_Utils/src/main/java/hirs/utils/rim/ReferenceManifestValidator.java index c84a70ec..16b4aeb0 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/rim/ReferenceManifestValidator.java +++ b/HIRS_Utils/src/main/java/hirs/utils/rim/ReferenceManifestValidator.java @@ -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) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/swid/SwidTagConstants.java b/HIRS_Utils/src/main/java/hirs/utils/swid/SwidTagConstants.java index af58a8bc..f47f5621 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/swid/SwidTagConstants.java +++ b/HIRS_Utils/src/main/java/hirs/utils/swid/SwidTagConstants.java @@ -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"; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/TPMBaselineGeneratorException.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/TPMBaselineGeneratorException.java index d33759ed..89485bea 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/TPMBaselineGeneratorException.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/TPMBaselineGeneratorException.java @@ -12,8 +12,7 @@ public class TPMBaselineGeneratorException extends Exception { * Creates a new CreateTPMBaselineException that has the * message msg. * - * @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 CreateTPMBaselineException that wraps the * given Throwable. * - * @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 CreateTPMBaselineException that has the * message msg 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); diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TCGEventLog.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TCGEventLog.java index 5cee1b93..0cabbdf4 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TCGEventLog.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TCGEventLog.java @@ -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 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 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 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); } /** diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TcgTpmtHa.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TcgTpmtHa.java index b079a977..614acda8 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TcgTpmtHa.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TcgTpmtHa.java @@ -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; - } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java index 4bd620fc..df5d7c92 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java @@ -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 */ diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent1.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent1.java index 002dce5d..f86f1dcf 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent1.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent1.java @@ -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) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent2.java index 0c015b69..bab1547d 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent2.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent2.java @@ -61,15 +61,15 @@ public class TpmPcrEvent2 extends TpmPcrEvent { /** * list of digests. */ - private ArrayList hashList = new ArrayList<>(); + private final ArrayList 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) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEvent.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEvent.java index 3d9a05c0..c6a1e265 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEvent.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEvent.java @@ -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. - * + *

* DEVICE SECURITY EVENT structures defined by PFP v1.06 Rev 52: *

* typedef struct tdDEVICE_SECURITY_EVENT_DATA { @@ -39,18 +39,17 @@ import lombok.Setter; * } *

*/ +@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) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index b9e5c982..f984ad39 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -15,19 +15,9 @@ import lombok.Getter; * } DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT; *

*/ +@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. diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataSubHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataSubHeader.java index 09b617d1..620c9a90 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataSubHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataSubHeader.java @@ -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; + }; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvConstants.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvConstants.java index 8e9d05de..f0b477da 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvConstants.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvConstants.java @@ -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. */ diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiGptPartition.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiGptPartition.java index 1c70f2c4..3e17e585 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiGptPartition.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiGptPartition.java @@ -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 partitionList; + private final List 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); diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiHandoffTable.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiHandoffTable.java index 9b931f24..cc8bd930 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiHandoffTable.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiHandoffTable.java @@ -31,20 +31,19 @@ import java.util.ArrayList; * standard that define the particular table. */ public class EvEfiHandoffTable { + /** + * List of Vendor GUIDs. + */ + private final ArrayList vendorGuids = new ArrayList<>(); + /** + * List of Vendors. + */ + private final ArrayList vendorTables = new ArrayList<>(); /** * Number of Tables. */ @Getter private int numberOfTables = 0; - /** - * List of Vendor GUIDs. - */ - private ArrayList vendorGuids = new ArrayList<>(); - /** - * List of Vendors. - */ - private ArrayList 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. */ diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvIPL.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvIPL.java index b6952961..d05beeb1 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvIPL.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvIPL.java @@ -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; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvPostCode.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvPostCode.java index 64027614..5fb8c920 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvPostCode.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvPostCode.java @@ -7,30 +7,39 @@ import java.nio.charset.StandardCharsets; /** * Class for processing EV_POST_CODE event types - * + *

* 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; + *

* 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(); } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvSCrtmContents.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvSCrtmContents.java index 1ba26104..f3efac88 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvSCrtmContents.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvSCrtmContents.java @@ -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; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/NvIndexDynamicEventLogData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/NvIndexDynamicEventLogData.java index c18866e8..e79aaece 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/NvIndexDynamicEventLogData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/NvIndexDynamicEventLogData.java @@ -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". - * + *

* HEADERS defined by PFP v1.06 Rev 52. * Certain fields are common to both ..HEADER and ..HEADER2, and are noted below the structures. *

diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java index 98bb2bab..8a26ac94 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java @@ -11,17 +11,17 @@ import java.io.IOException; *

* 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 bytes; + * Index 1 byte; + * MeasurementSpec 1 byte; + * MeasurementSize 2 bytes; + * Measurement bytes; * } *

* 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; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiConstants.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiConstants.java index 4844c4f1..ad29364b 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiConstants.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiConstants.java @@ -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. */ diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiDevicePath.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiDevicePath.java index 099b0050..2b307870 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiDevicePath.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiDevicePath.java @@ -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; - } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiGuid.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiGuid.java index 944446a5..166ddfe6 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiGuid.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiGuid.java @@ -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"). * diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureData.java index 4cc561a8..64fa45f0 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureData.java @@ -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 *

* 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. */ diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureList.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureList.java index 9ccd0c56..7b76b762 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureList.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureList.java @@ -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 *

* 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). *

* 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; - * + *

* 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). + *

+ * / |-------------------------| ------- 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 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 sigList = new ArrayList(); /** * 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; + }; } /** diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiVariable.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiVariable.java index 04752a3a..527f0b59 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiVariable.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiVariable.java @@ -35,7 +35,7 @@ public class UefiVariable { /** * List of Signature lists. */ - private List certSuperList; + private final List 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 "); } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiX509Cert.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiX509Cert.java index ad42ae0f..6258757f 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiX509Cert.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiX509Cert.java @@ -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; diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/BaseElement.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/BaseElement.java index 5e1eef02..f3589a9b 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/BaseElement.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/BaseElement.java @@ -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,14 +23,13 @@ import java.util.Map; /** - * - * Attributes common to all Elements in this schema - * - * + * Attributes common to all Elements in this schema + * + * *

Java class for BaseElement complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="BaseElement">
  *   <complexContent>
@@ -39,67 +40,38 @@ import java.util.Map;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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 otherAttributes = new HashMap(); - - /** - * - * 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. - * *

- * the map is keyed by the name of the attribute and + * the map is keyed by the name of the attribute and * the value is the string value of the attribute. - * + *

* 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 getOtherAttributes() { - return otherAttributes; - } + @XmlAnyAttribute + private final Map 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; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/CanonicalizationMethodType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/CanonicalizationMethodType.java index 0dcccd44..33d09ea8 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/CanonicalizationMethodType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/CanonicalizationMethodType.java @@ -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,13 +15,18 @@ 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; /** *

Java class for CanonicalizationMethodType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="CanonicalizationMethodType">
  *   <complexContent>
@@ -36,44 +39,43 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CanonicalizationMethodType", propOrder = { - "content" + "content" }) public class CanonicalizationMethodType { @XmlMixed @XmlAnyElement(lax = true) protected List content; + + @Getter + @Setter @XmlAttribute(name = "Algorithm", required = true) @XmlSchemaType(name = "anyURI") protected String algorithm; /** * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link Object } * {@link String } - * - * */ public List 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/DSAKeyValueType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/DSAKeyValueType.java index 6ea97e69..89a037cc 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/DSAKeyValueType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/DSAKeyValueType.java @@ -12,13 +12,15 @@ 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; /** *

Java class for DSAKeyValueType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="DSAKeyValueType">
  *   <complexContent>
@@ -40,188 +42,38 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/DigestMethodType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/DigestMethodType.java index 9d917341..296cf589 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/DigestMethodType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/DigestMethodType.java @@ -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,14 +15,19 @@ 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; + /** *

Java class for DigestMethodType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="DigestMethodType">
  *   <complexContent>
@@ -37,75 +40,49 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DigestMethodType", propOrder = { - "content" + "content" }) public class DigestMethodType { @XmlMixed @XmlAnyElement(lax = true) protected List content; + + @Getter + @Setter @XmlAttribute(name = "Algorithm", required = true) @XmlSchemaType(name = "anyURI") protected String algorithm; /** * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link Object } * {@link Element } * {@link String } - * - * */ public List getContent() { if (content == null) { - content = new ArrayList(); + 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Directory.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Directory.java index accb02ba..7133270a 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Directory.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Directory.java @@ -8,20 +8,21 @@ 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; + /** *

Java class for Directory complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="Directory">
  *   <complexContent>
@@ -35,49 +36,44 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @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 directoryOrFile; /** * Gets the value of the directoryOrFile property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the directoryOrFile property. - * + * *

* For example, to add a new item, do as follows: *

      *    getDirectoryOrFile().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link Directory } * {@link File } - * - * */ public List getDirectoryOrFile() { if (directoryOrFile == null) { - directoryOrFile = new ArrayList(); + directoryOrFile = new ArrayList<>(); } return this.directoryOrFile; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Entity.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Entity.java index e86e8f8c..03adfadf 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Entity.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Entity.java @@ -8,21 +8,24 @@ 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; /** *

Java class for Entity complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="Entity">
  *   <complexContent>
@@ -39,51 +42,55 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @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; + + @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 role; + + @Getter + @Setter @XmlAttribute(name = "thumbprint") protected String thumbprint; /** * Gets the value of the meta property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the meta property. - * + * *

* For example, to add a new item, do as follows: *

      *    getMeta().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link Meta } - * - * */ public List 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,69 +113,30 @@ 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. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the role property. - * + * *

* For example, to add a new item, do as follows: *

      *    getRole().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link String } - * - * */ public List getRole() { if (role == null) { - role = new ArrayList(); + 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Evidence.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Evidence.java index 721ca41b..d9690e78 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Evidence.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Evidence.java @@ -13,14 +13,17 @@ 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; /** *

Java class for Evidence complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="Evidence">
  *   <complexContent>
@@ -32,67 +35,18 @@ import javax.xml.datatype.XMLGregorianCalendar;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/File.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/File.java index 767e4735..5b17d597 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/File.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/File.java @@ -8,18 +8,21 @@ 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; /** *

Java class for File complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="File">
  *   <complexContent>
@@ -31,66 +34,17 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/FilesystemItem.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/FilesystemItem.java index 3cce0448..8e841812 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/FilesystemItem.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/FilesystemItem.java @@ -13,13 +13,15 @@ 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; /** *

Java class for FilesystemItem complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="FilesystemItem">
  *   <complexContent>
@@ -33,122 +35,27 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/KeyInfoType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/KeyInfoType.java index 44033a71..b1b6c0ad 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/KeyInfoType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/KeyInfoType.java @@ -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,14 +21,19 @@ 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; + /** *

Java class for KeyInfoType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="KeyInfoType">
  *   <complexContent>
@@ -50,27 +53,28 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @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 content; + + @Getter + @Setter @XmlAttribute(name = "Id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @@ -79,20 +83,20 @@ public class KeyInfoType { /** * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link KeyValueType }{@code >} @@ -105,38 +109,11 @@ public class KeyInfoType { * {@link Element } * {@link JAXBElement }{@code <}{@link SPKIDataType }{@code >} * {@link JAXBElement }{@code <}{@link RetrievalMethodType }{@code >} - * - * */ public List getContent() { if (content == null) { - content = new ArrayList(); + 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/KeyValueType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/KeyValueType.java index 0ac645dc..28351480 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/KeyValueType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/KeyValueType.java @@ -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,12 +18,15 @@ 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; + /** *

Java class for KeyValueType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="KeyValueType">
  *   <complexContent>
@@ -39,18 +40,16 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @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) @@ -58,20 +57,20 @@ public class KeyValueType { /** * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link RSAKeyValueType }{@code >} @@ -79,12 +78,10 @@ public class KeyValueType { * {@link String } * {@link JAXBElement }{@code <}{@link DSAKeyValueType }{@code >} * {@link Object } - * - * */ public List getContent() { if (content == null) { - content = new ArrayList(); + content = new ArrayList<>(); } return this.content; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Link.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Link.java index 4dde34e0..a7384c90 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Link.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Link.java @@ -15,13 +15,15 @@ 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; /** *

Java class for Link complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="Link">
  *   <complexContent>
@@ -38,199 +40,35 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/ManifestType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/ManifestType.java index 82a7fabb..ee1fdd1d 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/ManifestType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/ManifestType.java @@ -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,13 +17,18 @@ 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; /** *

Java class for ManifestType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="ManifestType">
  *   <complexContent>
@@ -38,17 +41,18 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ManifestType", propOrder = { - "reference" + "reference" }) public class ManifestType { @XmlElement(name = "Reference", required = true) protected List reference; + + @Getter + @Setter @XmlAttribute(name = "Id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @@ -57,55 +61,28 @@ public class ManifestType { /** * Gets the value of the reference property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the reference property. - * + * *

* For example, to add a new item, do as follows: *

      *    getReference().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link ReferenceType } - * - * */ public List getReference() { if (reference == null) { - reference = new ArrayList(); + 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Meta.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Meta.java index 832c59d3..4da3e0d5 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Meta.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Meta.java @@ -16,9 +16,9 @@ import jakarta.xml.bind.annotation.XmlType; /** *

Java class for Meta complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="Meta">
  *   <complexContent>
@@ -28,20 +28,17 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @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 { } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/ObjectFactory.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/ObjectFactory.java index b2a8d0d9..931083bc 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/ObjectFactory.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/ObjectFactory.java @@ -8,83 +8,114 @@ 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; /** - * This object contains factory methods for each - * Java content interface and Java element interface + * This object contains factory methods for each + * Java content interface and Java element interface * generated in the main.java.hirs.utils.xjc package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * 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 createSPKIData(SPKIDataType value) { - return new JAXBElement(_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 createKeyInfo(KeyInfoType value) { - return new JAXBElement(_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 createSignatureValue(SignatureValueType value) { - return new JAXBElement(_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 createKeyValue(KeyValueType value) { - return new JAXBElement(_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 createTransforms(TransformsType value) { - return new JAXBElement(_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 createDigestMethod(DigestMethodType value) { - return new JAXBElement(_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 createX509Data(X509DataType value) { - return new JAXBElement(_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 createSignatureProperty(SignaturePropertyType value) { - return new JAXBElement(_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 createKeyName(String value) { - return new JAXBElement(_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 createRSAKeyValue(RSAKeyValueType value) { - return new JAXBElement(_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 createSoftwareIdentity(SoftwareIdentity value) { - return new JAXBElement(_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 createSignature(SignatureType value) { - return new JAXBElement(_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 createMgmtData(String value) { - return new JAXBElement(_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 createSignatureMethod(SignatureMethodType value) { - return new JAXBElement(_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 createObject(ObjectType value) { - return new JAXBElement(_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 createSignatureProperties(SignaturePropertiesType value) { - return new JAXBElement(_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 createTransform(TransformType value) { - return new JAXBElement(_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 createPGPData(PGPDataType value) { - return new JAXBElement(_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 createReference(ReferenceType value) { - return new JAXBElement(_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 createRetrievalMethod(RetrievalMethodType value) { - return new JAXBElement(_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 createDSAKeyValue(DSAKeyValueType value) { - return new JAXBElement(_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 createDigestValue(byte[] value) { - return new JAXBElement(_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 createCanonicalizationMethod(CanonicalizationMethodType value) { - return new JAXBElement(_CanonicalizationMethod_QNAME, CanonicalizationMethodType.class, null, value); + public JAXBElement 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 createSignedInfo(SignedInfoType value) { - return new JAXBElement(_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 createManifest(ManifestType value) { - return new JAXBElement(_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 createTransformTypeXPath(String value) { - return new JAXBElement(_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 createX509DataTypeX509IssuerSerial(X509IssuerSerialType value) { - return new JAXBElement(_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 createX509DataTypeX509CRL(byte[] value) { - return new JAXBElement(_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 createX509DataTypeX509SubjectName(String value) { - return new JAXBElement(_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 createX509DataTypeX509SKI(byte[] value) { - return new JAXBElement(_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 createX509DataTypeX509Certificate(byte[] value) { - return new JAXBElement(_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 createSoftwareIdentityLink(Link value) { - return new JAXBElement(_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 createSoftwareIdentityEvidence(Evidence value) { - return new JAXBElement(_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 createSoftwareIdentityPayload(ResourceCollection value) { - return new JAXBElement(_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 createPayloadDirectory(FilesystemItem value) { - return new JAXBElement(_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 createDirectoryFile(FilesystemItem value) { - return new JAXBElement(_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 createSoftwareIdentityEntity(Entity value) { - return new JAXBElement(_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 createSoftwareIdentityMeta(SoftwareMeta value) { - return new JAXBElement(_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 createSignatureMethodTypeHMACOutputLength(BigInteger value) { - return new JAXBElement(_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 createSPKIDataTypeSPKISexp(byte[] value) { - return new JAXBElement(_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 createPGPDataTypePGPKeyID(byte[] value) { - return new JAXBElement(_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 createPGPDataTypePGPKeyPacket(byte[] value) { - return new JAXBElement(_PGPDataTypePGPKeyPacket_QNAME, byte[].class, PGPDataType.class, ((byte[]) value)); + return new JAXBElement<>(_PGPDataTypePGPKeyPacket_QNAME, byte[].class, PGPDataType.class, + value); } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/ObjectType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/ObjectType.java index 2317e5db..c7e5afa0 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/ObjectType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/ObjectType.java @@ -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,14 +18,20 @@ 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; + /** *

Java class for ObjectType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="ObjectType">
  *   <complexContent>
@@ -42,130 +46,60 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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 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; /** * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link Object } * {@link Element } * {@link String } - * - * */ public List getContent() { if (content == null) { - content = new ArrayList(); + 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Ownership.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Ownership.java index 97af993f..769957ba 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Ownership.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Ownership.java @@ -15,7 +15,7 @@ import jakarta.xml.bind.annotation.XmlType; /** *

Java class for Ownership. - * + * *

The following schema fragment specifies the expected content contained within this class. *

*

@@ -27,7 +27,6 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </restriction>
  * </simpleType>
  * 
- * */ @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; + } + } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/PGPDataType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/PGPDataType.java index b2f3f272..a0b8c359 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/PGPDataType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/PGPDataType.java @@ -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,12 +17,15 @@ 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; + /** *

Java class for PGPDataType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="PGPDataType">
  *   <complexContent>
@@ -44,56 +45,52 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @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 content; /** - * Gets the rest of the content model. - * + * Gets the rest of the content model. + * *

- * You are getting this "catch-all" property because of the following reason: - * The field name "PGPKeyPacket" is used by two different parts of a schema. See: + * You are getting this "catch-all" property because of the following reason: + * The field name "PGPKeyPacket" is used by two different parts of a schema. See: * line 218 of http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd * line 213 of http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd *

- * To get rid of this property, apply a property customization to one - * of both of the following declarations to change their names: + * To get rid of this property, apply a property customization to one + * of both of the following declarations to change their names: * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link Element } * {@link Object } - * - * */ public List getContent() { if (content == null) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Process.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Process.java index c5015a41..a7555bd2 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Process.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Process.java @@ -8,18 +8,21 @@ 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; /** *

Java class for Process complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="Process">
  *   <complexContent>
@@ -31,66 +34,16 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/RSAKeyValueType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/RSAKeyValueType.java index 9aaba233..e29c1922 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/RSAKeyValueType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/RSAKeyValueType.java @@ -12,13 +12,15 @@ 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; /** *

Java class for RSAKeyValueType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="RSAKeyValueType">
  *   <complexContent>
@@ -31,63 +33,19 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/ReferenceType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/ReferenceType.java index f02cd5a1..b2903ab7 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/ReferenceType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/ReferenceType.java @@ -17,13 +17,15 @@ 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; /** *

Java class for ReferenceType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="ReferenceType">
  *   <complexContent>
@@ -40,175 +42,37 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Resource.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Resource.java index 3180d937..274f700c 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Resource.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Resource.java @@ -12,13 +12,15 @@ 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; /** *

Java class for Resource complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="Resource">
  *   <complexContent>
@@ -29,40 +31,13 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/ResourceCollection.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/ResourceCollection.java index cf24381b..6a5bdeb9 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/ResourceCollection.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/ResourceCollection.java @@ -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,12 +15,15 @@ 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; + /** *

Java class for ResourceCollection complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="ResourceCollection">
  *   <complexContent>
@@ -38,52 +39,47 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @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 directoryOrFileOrProcess; /** * Gets the value of the directoryOrFileOrProcess property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the directoryOrFileOrProcess property. - * + * *

* For example, to add a new item, do as follows: *

      *    getDirectoryOrFileOrProcess().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link Directory } * {@link File } * {@link Process } * {@link Resource } - * - * */ public List getDirectoryOrFileOrProcess() { if (directoryOrFileOrProcess == null) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/RetrievalMethodType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/RetrievalMethodType.java index 8ccf3399..53b7228c 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/RetrievalMethodType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/RetrievalMethodType.java @@ -14,13 +14,15 @@ 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; /** *

Java class for RetrievalMethodType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="RetrievalMethodType">
  *   <complexContent>
@@ -34,94 +36,23 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SPKIDataType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SPKIDataType.java index aba6e9b8..2a8a645a 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SPKIDataType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SPKIDataType.java @@ -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,12 +16,15 @@ 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; + /** *

Java class for SPKIDataType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SPKIDataType">
  *   <complexContent>
@@ -36,12 +37,10 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SPKIDataType", propOrder = { - "spkiSexpAndAny" + "spkiSexpAndAny" }) public class SPKIDataType { @@ -51,27 +50,25 @@ public class SPKIDataType { /** * Gets the value of the spkiSexpAndAny property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the spkiSexpAndAny property. - * + * *

* For example, to add a new item, do as follows: *

      *    getSPKISexpAndAny().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link Object } * {@link Element } - * - * */ public List getSPKISexpAndAny() { if (spkiSexpAndAny == null) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureMethodType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureMethodType.java index de9091cc..86989fb5 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureMethodType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureMethodType.java @@ -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,13 +17,19 @@ 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; /** *

Java class for SignatureMethodType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SignatureMethodType">
  *   <complexContent>
@@ -40,12 +43,10 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SignatureMethodType", propOrder = { - "content" + "content" }) public class SignatureMethodType { @@ -53,33 +54,34 @@ public class SignatureMethodType { @XmlMixed @XmlAnyElement(lax = true) protected List content; + + @Getter + @Setter @XmlAttribute(name = "Algorithm", required = true) @XmlSchemaType(name = "anyURI") protected String algorithm; /** * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link BigInteger }{@code >} * {@link Object } * {@link String } - * - * */ public List 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignaturePropertiesType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignaturePropertiesType.java index 2fb8014c..f00f8263 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignaturePropertiesType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignaturePropertiesType.java @@ -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,13 +17,18 @@ 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; /** *

Java class for SignaturePropertiesType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SignaturePropertiesType">
  *   <complexContent>
@@ -38,17 +41,18 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "SignaturePropertiesType", propOrder = { - "signatureProperty" + "signatureProperty" }) public class SignaturePropertiesType { @XmlElement(name = "SignatureProperty", required = true) protected List signatureProperty; + + @Getter + @Setter @XmlAttribute(name = "Id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @@ -57,25 +61,23 @@ public class SignaturePropertiesType { /** * Gets the value of the signatureProperty property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the signatureProperty property. - * + * *

* For example, to add a new item, do as follows: *

      *    getSignatureProperty().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link SignaturePropertyType } - * - * */ public List 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignaturePropertyType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignaturePropertyType.java index 63799032..07b44af0 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignaturePropertyType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignaturePropertyType.java @@ -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,14 +18,20 @@ 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; + /** *

Java class for SignaturePropertyType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SignaturePropertyType">
  *   <complexContent>
@@ -41,21 +45,25 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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 content; + @XmlAttribute(name = "Target", required = true) @XmlSchemaType(name = "anyURI") protected String target; + @XmlAttribute(name = "Id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlID @@ -64,81 +72,30 @@ public class SignaturePropertyType { /** * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link Object } * {@link Element } * {@link String } - * - * */ public List getContent() { if (content == null) { - content = new ArrayList(); + 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureType.java index 4616bf66..fd9e2769 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureType.java @@ -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,13 +17,19 @@ 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; /** *

Java class for SignatureType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SignatureType">
  *   <complexContent>
@@ -41,155 +45,62 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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 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. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the object property. - * + * *

* For example, to add a new item, do as follows: *

      *    getObject().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link ObjectType } - * - * */ public List getObject() { if (object == null) { - object = new ArrayList(); + 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureValueType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureValueType.java index 517f672c..2fd4d545 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureValueType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignatureValueType.java @@ -17,13 +17,15 @@ 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; /** *

Java class for SignatureValueType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SignatureValueType">
  *   <simpleContent>
@@ -33,67 +35,20 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  *   </simpleContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignedInfoType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignedInfoType.java index 0d36d2d0..98f27e33 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SignedInfoType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SignedInfoType.java @@ -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,13 +17,19 @@ 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; /** *

Java class for SignedInfoType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SignedInfoType">
  *   <complexContent>
@@ -40,128 +44,58 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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 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. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the reference property. - * + * *

* For example, to add a new item, do as follows: *

      *    getReference().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link ReferenceType } - * - * */ public List getReference() { if (reference == null) { - reference = new ArrayList(); + 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareIdentity.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareIdentity.java index 040a9f7a..3f28ec2d 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareIdentity.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareIdentity.java @@ -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,12 +21,16 @@ 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; + /** *

Java class for SoftwareIdentity complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SoftwareIdentity">
  *   <complexContent>
@@ -56,23 +57,20 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @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 entityOrEvidenceOrLink; @@ -99,20 +97,20 @@ public class SoftwareIdentity /** * Gets the value of the entityOrEvidenceOrLink property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the entityOrEvidenceOrLink property. - * + * *

* For example, to add a new item, do as follows: *

      *    getEntityOrEvidenceOrLink().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link SoftwareMeta }{@code >} @@ -122,8 +120,6 @@ public class SoftwareIdentity * {@link JAXBElement }{@code <}{@link ResourceCollection }{@code >} * {@link Element } * {@link JAXBElement }{@code <}{@link Evidence }{@code >} - * - * */ public List getEntityOrEvidenceOrLink() { if (entityOrEvidenceOrLink == null) { @@ -134,11 +130,9 @@ 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) { @@ -150,11 +144,9 @@ 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; @@ -162,11 +154,9 @@ 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) { @@ -178,11 +168,9 @@ 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; @@ -190,11 +178,9 @@ 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; @@ -202,11 +188,9 @@ 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; @@ -214,11 +198,9 @@ 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; @@ -226,11 +208,9 @@ 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; @@ -238,11 +218,9 @@ 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) { @@ -254,11 +232,9 @@ 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; @@ -266,11 +242,9 @@ 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; @@ -278,11 +252,9 @@ 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; @@ -290,11 +262,9 @@ 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) { @@ -306,11 +276,9 @@ 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; @@ -318,11 +286,9 @@ 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) { @@ -334,11 +300,9 @@ 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; @@ -346,11 +310,9 @@ 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) { @@ -362,11 +324,9 @@ 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; diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareMeta.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareMeta.java index 32af99d1..ec3f5a5d 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareMeta.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/SoftwareMeta.java @@ -12,13 +12,15 @@ 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; /** *

Java class for SoftwareMeta complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="SoftwareMeta">
  *   <complexContent>
@@ -43,404 +45,55 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/TransformType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/TransformType.java index dea52db8..25af4f1b 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/TransformType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/TransformType.java @@ -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,14 +17,19 @@ 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; + /** *

Java class for TransformType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="TransformType">
  *   <complexContent>
@@ -40,12 +43,10 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TransformType", propOrder = { - "content" + "content" }) public class TransformType { @@ -53,34 +54,35 @@ public class TransformType { @XmlMixed @XmlAnyElement(lax = true) protected List content; + + @Getter + @Setter @XmlAttribute(name = "Algorithm", required = true) @XmlSchemaType(name = "anyURI") protected String algorithm; /** * Gets the value of the content property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the content property. - * + * *

* For example, to add a new item, do as follows: *

      *    getContent().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link Element } * {@link String } * {@link JAXBElement }{@code <}{@link String }{@code >} * {@link Object } - * - * */ public List 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; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/TransformsType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/TransformsType.java index 8bcbc8db..e2e073bc 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/TransformsType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/TransformsType.java @@ -8,19 +8,20 @@ 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.XmlType; +import java.util.ArrayList; +import java.util.List; + /** *

Java class for TransformsType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="TransformsType">
  *   <complexContent>
@@ -32,12 +33,10 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TransformsType", propOrder = { - "transform" + "transform" }) public class TransformsType { @@ -46,25 +45,23 @@ public class TransformsType { /** * Gets the value of the transform property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the transform property. - * + * *

* For example, to add a new item, do as follows: *

      *    getTransform().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link TransformType } - * - * */ public List getTransform() { if (transform == null) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/Use.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/Use.java index ceb80f8e..9e8de20b 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/Use.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/Use.java @@ -15,7 +15,7 @@ import jakarta.xml.bind.annotation.XmlType; /** *

Java class for Use. - * + * *

The following schema fragment specifies the expected content contained within this class. *

*

@@ -27,7 +27,6 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </restriction>
  * </simpleType>
  * 
- * */ @XmlType(name = "Use", namespace = "http://standards.iso.org/iso/19770/-2/2015/schema.xsd") @XmlEnum @@ -35,28 +34,19 @@ public enum Use { /** - * - * The [Link]'d software is absolutely required for installation - * - * + * The [Link]'d software is absolutely required for installation */ @XmlEnumValue("required") REQUIRED("required"), /** - * - * Not absolutely required, but install unless directed not to - * - * + * Not absolutely required, but install unless directed not to */ @XmlEnumValue("recommended") RECOMMENDED("recommended"), /** - * - * Not absolutely required, install only when asked - * - * + * Not absolutely required, install only when asked */ @XmlEnumValue("optional") OPTIONAL("optional"); @@ -66,12 +56,8 @@ public enum Use { value = v; } - public String value() { - return value; - } - public static Use fromValue(String v) { - for (Use c: Use.values()) { + for (Use c : Use.values()) { if (c.value.equals(v)) { return c; } @@ -79,4 +65,8 @@ public enum Use { throw new IllegalArgumentException(v); } + public String value() { + return value; + } + } diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/X509DataType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/X509DataType.java index 21843c46..520a58b2 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/X509DataType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/X509DataType.java @@ -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,12 +17,15 @@ 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; + /** *

Java class for X509DataType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="X509DataType">
  *   <complexContent>
@@ -43,41 +44,39 @@ import org.w3c.dom.Element;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "X509DataType", propOrder = { - "x509IssuerSerialOrX509SKIOrX509SubjectName" + "x509IssuerSerialOrX509SKIOrX509SubjectName" }) public class X509DataType { @XmlElementRefs({ - @XmlElementRef(name = "X509SubjectName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "X509CRL", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "X509IssuerSerial", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "X509SKI", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), - @XmlElementRef(name = "X509Certificate", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false) + @XmlElementRef(name = "X509SubjectName", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "X509CRL", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "X509IssuerSerial", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "X509SKI", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false), + @XmlElementRef(name = "X509Certificate", namespace = "http://www.w3.org/2000/09/xmldsig#", type = JAXBElement.class, required = false) }) @XmlAnyElement(lax = true) protected List x509IssuerSerialOrX509SKIOrX509SubjectName; /** * Gets the value of the x509IssuerSerialOrX509SKIOrX509SubjectName property. - * + * *

* This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the x509IssuerSerialOrX509SKIOrX509SubjectName property. - * + * *

* For example, to add a new item, do as follows: *

      *    getX509IssuerSerialOrX509SKIOrX509SubjectName().add(newItem);
      * 
- * - * + * + * *

* Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link String }{@code >} @@ -87,8 +86,6 @@ public class X509DataType { * {@link JAXBElement }{@code <}{@link byte[]}{@code >} * {@link Element } * {@link JAXBElement }{@code <}{@link byte[]}{@code >} - * - * */ public List getX509IssuerSerialOrX509SKIOrX509SubjectName() { if (x509IssuerSerialOrX509SKIOrX509SubjectName == null) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/xjc/X509IssuerSerialType.java b/HIRS_Utils/src/main/java/hirs/utils/xjc/X509IssuerSerialType.java index 99c6f858..5c02eea6 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/xjc/X509IssuerSerialType.java +++ b/HIRS_Utils/src/main/java/hirs/utils/xjc/X509IssuerSerialType.java @@ -8,18 +8,21 @@ 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.XmlElement; import jakarta.xml.bind.annotation.XmlType; +import lombok.Getter; +import lombok.Setter; + +import java.math.BigInteger; /** *

Java class for X509IssuerSerialType complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType name="X509IssuerSerialType">
  *   <complexContent>
@@ -32,67 +35,18 @@ import jakarta.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * */ +@Getter +@Setter @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "X509IssuerSerialType", propOrder = { - "x509IssuerName", - "x509SerialNumber" + "x509IssuerName", + "x509SerialNumber" }) public class X509IssuerSerialType { - @XmlElement(name = "X509IssuerName", required = true) protected String x509IssuerName; + @XmlElement(name = "X509SerialNumber", required = true) protected BigInteger x509SerialNumber; - - /** - * Gets the value of the x509IssuerName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getX509IssuerName() { - return x509IssuerName; - } - - /** - * Sets the value of the x509IssuerName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setX509IssuerName(String value) { - this.x509IssuerName = value; - } - - /** - * Gets the value of the x509SerialNumber property. - * - * @return - * possible object is - * {@link BigInteger } - * - */ - public BigInteger getX509SerialNumber() { - return x509SerialNumber; - } - - /** - * Sets the value of the x509SerialNumber property. - * - * @param value - * allowed object is - * {@link BigInteger } - * - */ - public void setX509SerialNumber(BigInteger value) { - this.x509SerialNumber = value; - } - } diff --git a/HIRS_Utils/src/main/resources/identity_transform.xslt b/HIRS_Utils/src/main/resources/identity_transform.xslt index e5b58225..77396b49 100644 --- a/HIRS_Utils/src/main/resources/identity_transform.xslt +++ b/HIRS_Utils/src/main/resources/identity_transform.xslt @@ -1,6 +1,6 @@ - - + + diff --git a/HIRS_Utils/src/main/resources/swid_schema.xsd b/HIRS_Utils/src/main/resources/swid_schema.xsd index 92ef54b2..9a10c262 100644 --- a/HIRS_Utils/src/main/resources/swid_schema.xsd +++ b/HIRS_Utils/src/main/resources/swid_schema.xsd @@ -1,19 +1,24 @@ - This is the XML Schema for the Jakarta XML Binding binding customization descriptor. All binding customization descriptors must indicate the descriptor schema by using the Jakarta XML Binding namespace: https://jakarta.ee/xml/ns/jaxb and by indicating the version of the schema by using the version element as shown below: - ... - The instance documents may indicate the published version of the schema using the xsi:schemaLocation attribute for Jakarta XML Binding namespace with the following location: https://jakarta.ee/xml/ns/jaxb/bindingschema_3_0.xsd + This is the XML Schema for the Jakarta XML Binding binding customization descriptor. All binding + customization descriptors must indicate the descriptor schema by using the Jakarta XML Binding namespace: + https://jakarta.ee/xml/ns/jaxb and by indicating the version of the schema by using the version element as + shown below: + ... + + The instance documents may indicate the published version of the schema using the xsi:schemaLocation + attribute for Jakarta XML Binding namespace with the following location: + https://jakarta.ee/xml/ns/jaxb/bindingschema_3_0.xsd + ref="xml:lang"> Allow xml:lang attribute on any element. @@ -125,7 +130,7 @@ default="http://invalid.unavailable"> - The regid of the organization. If the regid is unknown, the + The regid of the organization. If the regid is unknown, the value "invalid.unavailable" is provided by default (see RFC 6761 for more details on the default value). @@ -139,7 +144,7 @@ The relationship between this organization and this tag e.g. tag, - softwareCreator, licensor, tagCreator, etc. The role of + softwareCreator, licensor, tagCreator, etc. The role of tagCreator is required for every SWID tag. EntityRole may include any role value, but the pre-defined roles @@ -219,7 +224,7 @@ Files that are considered important or required for the use of - a software component. Typical key files would be those which, + a software component. Typical key files would be those which, if not available on a system, would cause the software not to execute. @@ -236,7 +241,7 @@ The directory or location where a file was found or can expected - to be located. does not include the filename itself. This can + to be located. does not include the filename itself. This can be relative path from the 'root' attribute. @@ -504,7 +509,7 @@ + use="required"> The link to the item being referenced. @@ -524,7 +529,7 @@ swidtags.( ie, "swid:2df9de35-0aff-4a86-ace6-f7dddd1ade4c" ) - an URI with "swidpath:" as the scheme, which refers to another - swid by an XPATH query. This URI would need to be resolved in + swid by an XPATH query. This URI would need to be resolved in the context of the system by software that can lookup other swidtags, and select the appropriate one based on an XPATH query. Examples: @@ -664,7 +669,7 @@ This element is used to provide results from a scan of a system where software that does not have a SWID tag is - discovered. This information is not provided by the + discovered. This information is not provided by the software creator, but is instead created when a system is being scanned and the evidence for why software is believed to be installed on the device is provided in the @@ -685,7 +690,7 @@ downloads can be found, vulnerability database associations, use rights, etc). - Note: This is modelled directly to match the HTML [LINK] + Note: This is modelled directly to match the HTML [LINK] element; it is critical for streamlining software discovery scenarios that these are kept consistent. @@ -712,7 +717,7 @@ The items that may be installed on a device when the software is - installed. Note that Payload may be a superset of the items + installed. Note that Payload may be a superset of the items installed and, depending on optimization systems for a device, may or may not include every item that could be created or executed on a device when software is installed. @@ -731,7 +736,7 @@ namespace="##other" processContents="lax" minOccurs="0" - maxOccurs="unbounded" > + maxOccurs="unbounded"> Allows any undeclared elements in the SoftwareIdentity element @@ -785,7 +790,7 @@ + use="optional"> media is a hint to the tag consumer to understand what this @@ -801,7 +806,7 @@ This attribute provides the software component name as it would - typically be referenced. For example, what would be seen in the + typically be referenced. For example, what would be seen in the add/remove dialog on a Windows device, or what is specified as the name of a packaged software product or a patch identifier name on a Linux device. @@ -830,7 +835,7 @@ + use="required"> tagId shall be a globally unique identifier and should be @@ -839,7 +844,7 @@ The tagID provides a unique reference for the specific product, version, edition, revision, etc (essentially, the same binary - distribution). If two tagIDs match and the tagCreator is the + distribution). If two tagIDs match and the tagCreator is the same, the underlying products they represent are expected to be exactly the same. @@ -856,7 +861,7 @@ unique ID may be constructed, this ID should include a unique naming authority for the tagCreator and sufficient additional details that the tagId is unique for the software product, - version, edition, revision, etc. This would likely look as + version, edition, revision, etc. This would likely look as follows (+ is used as a string concatenation symbol): regid + productName + version + edition + revision + ... @@ -873,12 +878,12 @@ The tagVersion indicates if a specific release of a software product has more than one tag that can represent that specific - release. This may be the case if a software tag producer creates + release. This may be the case if a software tag producer creates and releases an incorrect tag that they subsequently want to fix, but with no underlying changes to the product the SWID tag - represents. This could happen if, for example, a patch is + represents. This could happen if, for example, a patch is distributed that has a Link reference that does not cover all the - various software releases it can patch. A newer SWID tag for that + various software releases it can patch. A newer SWID tag for that patch can be generated and the tagVersion value incremented to indicate that the data is updated. @@ -889,7 +894,7 @@ name="version" type="xs:string" use="optional" - default="0.0" > + default="0.0"> Underlying development version for the software component. @@ -903,7 +908,7 @@ default="multipartnumeric"> - Scheme used for the version number. Some possible common values are: + Scheme used for the version number. Some possible common values are: value="alphanumeric" Strictly a string, sorting alphanumericaly @@ -913,7 +918,7 @@ value="multipartnumeric" Numbers seperated by dots, where the numbers are interpreted as - integers (ie, 1.2.3 , 1.4.5.6 , 1.2.3.4.5.6.7 ) + integers (ie, 1.2.3 , 1.4.5.6 , 1.2.3.4.5.6.7 ) value="multipartnumeric+suffix" Numbers seperated by dots, where the numbers are interpreted as @@ -940,7 +945,7 @@ An open-ended collection of key/value data related to this SWID. The attributes included in this Element are predefined attributes - to ensure common usage across the industry. The schema allows for + to ensure common usage across the industry. The schema allows for any additional attribute to be included in a SWID tag, though it is recommended that industry norms for new attributes are defined and followed to the degree possible. @@ -954,7 +959,7 @@ Identification of the activation status of this software title - (e.g. Trial, Serialized, Licensed, Unlicensed, etc). Typically, + (e.g. Trial, Serialized, Licensed, Unlicensed, etc). Typically, this is used in supplemental tags. @@ -968,7 +973,7 @@ Provides information on which channel this particular software was targeted for (e.g. Volume, Retail, OEM, - Academic, etc). Typically used in supplemental tags. + Academic, etc). Typically used in supplemental tags. @@ -988,7 +993,7 @@ Note that this representation of version is typically used to identify a group of specific software releases that are part of the same release/support infrastructure - (i.e. Fabrikam Office 2013). This version is used for string + (i.e. Fabrikam Office 2013). This version is used for string comparisons only and is not compared to be an earlier or later release (that is done via the SoftwareEntity version). @@ -1001,7 +1006,7 @@ use="optional"> - A longer, detailed description of the software. This description + A longer, detailed description of the software. This description can be multiple sentences (differentiated from summary which is a very short, one-sentence description). @@ -1052,7 +1057,7 @@ use="optional"> - The name of the software tool that created a SWID tag. This + The name of the software tool that created a SWID tag. This element is typically used if tags are created on the fly, or based on a catalogue based analysis for data found on a computing device. @@ -1067,7 +1072,7 @@ A GUID used to represent products installed where the products - are related, but may be different versions. See one + are related, but may be different versions. See one representation of this value through the use of what, in a windows installation process is referred to as an upgradeCode - http://msdn.microsoft.com/en-us/library/aa372375(v=vs.85).aspx @@ -1094,7 +1099,7 @@ use="optional"> - The overall product family this software belongs to. Product + The overall product family this software belongs to. Product family is not used to identify that a product is part of a suite, but is instead used when a set of products that are all related may be installed on multiple different devices. @@ -1102,7 +1107,7 @@ For example, an Enterprise backup system may consist of a backup server, multiple different backup systems that support mail servers, databases and ERP systems as well as individual software - items that backup client devices. In this case all software + items that backup client devices. In this case all software titles that are part of the backup system would have the same productFamily name so they can be grouped together in reporting systems. @@ -1117,7 +1122,7 @@ The informal or colloquial representation of the sub-version of - the given product (ie, SP1, R2, RC1, Beta 2, etc). Note that the + the given product (ie, SP1, R2, RC1, Beta 2, etc). Note that the SoftwareIdentity.version will provide very exact version details, the revision is intended for use in environments where reporting on the informal or colloquial representation of the software is @@ -1152,7 +1157,7 @@ An 8 digit code that provides UNSPSC classification of the - software product this SWID tag identifies. For more + software product this SWID tag identifies. For more information see, http://www.unspsc.org/ @@ -1217,8 +1222,8 @@ architecture PREFIX is defined as one of: - MIN # property has a minimum value of VALUE - MAX # property has a maximum value of VALUE + MIN # property has a minimum value of VALUE + MAX # property has a maximum value of VALUE if a PREFIX is not provided, then the property should equal VALUE diff --git a/HIRS_Utils/src/test/java/hirs/data/persist/PolicyTest.java b/HIRS_Utils/src/test/java/hirs/data/persist/PolicyTest.java index 79a6c4b7..9fd4e43c 100644 --- a/HIRS_Utils/src/test/java/hirs/data/persist/PolicyTest.java +++ b/HIRS_Utils/src/test/java/hirs/data/persist/PolicyTest.java @@ -1,12 +1,10 @@ package hirs.data.persist; import hirs.attestationca.persist.entity.Policy; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; /** * PolicyTest is a unit test class for the Policy diff --git a/HIRS_Utils/src/test/java/hirs/data/persist/TestPolicy.java b/HIRS_Utils/src/test/java/hirs/data/persist/TestPolicy.java index a8682eab..2c60460e 100644 --- a/HIRS_Utils/src/test/java/hirs/data/persist/TestPolicy.java +++ b/HIRS_Utils/src/test/java/hirs/data/persist/TestPolicy.java @@ -21,7 +21,7 @@ public class TestPolicy extends Policy { /** * Creates a new TestPolicy with the set name and description. * - * @param name name + * @param name name * @param description description */ public TestPolicy(final String name, final String description) { diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index cf854c69..79f9755e 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -109,10 +109,7 @@ - - - +