diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java index 5f6ef83f..09a8ca0b 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/SwidTagGateway.java @@ -309,8 +309,6 @@ public class SwidTagGateway { addNonNullAttribute(attributes, SwidTagConstants._BINDING_SPEC_VERSION, jsonObject.getString(SwidTagConstants.BINDING_SPEC_VERSION, "")); addNonNullAttribute(attributes, SwidTagConstants._PC_URI_LOCAL, jsonObject.getString(SwidTagConstants.PC_URI_LOCAL, "")); addNonNullAttribute(attributes, SwidTagConstants._PC_URI_GLOBAL, jsonObject.getString(SwidTagConstants.PC_URI_GLOBAL, "")); - addNonNullAttribute(attributes, SwidTagConstants._SUPPORT_RIM_TYPE, jsonObject.getString(SwidTagConstants.SUPPORT_RIM_TYPE, "")); - addNonNullAttribute(attributes, SwidTagConstants._SUPPORT_RIM_FORMAT, jsonObject.getString(SwidTagConstants.SUPPORT_RIM_FORMAT, "")); addNonNullAttribute(attributes, SwidTagConstants._RIM_LINK_HASH, jsonObject.getString(SwidTagConstants.RIM_LINK_HASH, "")); return softwareMeta; @@ -328,6 +326,8 @@ public class SwidTagGateway { addNonNullAttribute(attributes, SwidTagConstants._N8060_ENVVARPREFIX, jsonObject.getString(SwidTagConstants._N8060_ENVVARPREFIX.getLocalPart(), "")); addNonNullAttribute(attributes, SwidTagConstants._N8060_ENVVARSUFFIX, jsonObject.getString(SwidTagConstants._N8060_ENVVARSUFFIX.getLocalPart(), "")); addNonNullAttribute(attributes, SwidTagConstants._N8060_PATHSEPARATOR, jsonObject.getString(SwidTagConstants._N8060_PATHSEPARATOR.getLocalPart(), "")); + addNonNullAttribute(attributes, SwidTagConstants._SUPPORT_RIM_FORMAT, jsonObject.getString(SwidTagConstants.SUPPORT_RIM_FORMAT, "")); + addNonNullAttribute(attributes, SwidTagConstants._SUPPORT_RIM_TYPE, jsonObject.getString(SwidTagConstants.SUPPORT_RIM_TYPE, "")); addNonNullAttribute(attributes, SwidTagConstants._SUPPORT_RIM_URI_GLOBAL, jsonObject.getString(SwidTagConstants.SUPPORT_RIM_URI_GLOBAL, "")); return payload; @@ -366,24 +366,11 @@ public class SwidTagGateway { } /** - * This method creates a hirs.swid.xjc.File from a direct payload type. - * - * @param jsonObject - * @return hirs.swid.xjc.File object from File object - * - private hirs.swid.xjc.File createFile(JsonObject jsonObject) { - hirs.swid.xjc.File file = objectFactory.createFile(); - file.setName(jsonObject.getString(SwidTagConstants.NAME, "")); - file.setSize(new BigInteger(jsonObject.getString(SwidTagConstants.SIZE, "0"))); - Map attributes = file.getOtherAttributes(); - addNonNullAttribute(attributes, _SHA256_HASH, jsonObject.getString(SwidTagConstants.HASH, "")); - addNonNullAttribute(attributes, SwidTagConstants._SUPPORT_RIM_TYPE, jsonObject.getString(SwidTagConstants.SUPPORT_RIM_TYPE, "")); - addNonNullAttribute(attributes, SwidTagConstants._SUPPORT_RIM_FORMAT, jsonObject.getString(SwidTagConstants.SUPPORT_RIM_FORMAT, "")); - addNonNullAttribute(attributes, SwidTagConstants._SUPPORT_RIM_URI_GLOBAL, jsonObject.getString(SwidTagConstants.SUPPORT_RIM_URI_GLOBAL, "")); - - return file; - }*/ - + * This utility method checks if an attribute value is empty before adding it to the map. + * @param attributes + * @param key + * @param value + */ private void addNonNullAttribute(Map attributes, QName key, String value) { if (!value.isEmpty()) { attributes.put(key, value); diff --git a/tools/tcg_rim_tool/src/test/resources/generated_no_cert.swidtag b/tools/tcg_rim_tool/src/test/resources/generated_no_cert.swidtag index 9b89b331..51a45d76 100644 --- a/tools/tcg_rim_tool/src/test/resources/generated_no_cert.swidtag +++ b/tools/tcg_rim_tool/src/test/resources/generated_no_cert.swidtag @@ -2,8 +2,8 @@ - - + + @@ -17,14 +17,14 @@ - 1rf2CJ9y+OSyPzuqgJt9ve3WiaBjya/RylFFZwSpy5Y= + 97uWB7zSsO5WaGbrcQrlKd1Bju0aDTjK1/ktUYBje8A= - TRqJ4HtAuQRSqL8TnqhpANTRkAPAI1tUft44xSAzqITT9NSetbLd2Te2D5/jg5kNwfpIYKirGKrd -suTuBID5DsUsuZqExuvfAKPh1AQuSrQDrZReu+Ma1P/IGzZq3hRV1LVinV5NojdQbyB+yUcTp/d0 -gpBr5Y/PfYGLbkHshw2yJuhd6l1a2WPU8AxBQYTGJiFYX3WEkW20EubJ9FoxCVImdkhzbQKP/3lp -M31jCMKM1DcFuUU3zdonZukWhd4bbqj926Av+r+qH9S1uGmwQEsNT0lfLljGd7Q7MMxuZ+9fbSgo -D5GuQbkDL+RfEjbseEpOaB0w4f1uqeCoTEuiiA== + N1YtTeo2Ryuj+CtlXIpICEay+ni7vt8+4J7tAsYpa3efnLwtea69PIqEylPWm9LdA8Eo8XDdpgxV +7h3hi2LTOU+Wxq3bLiLamo99T1EtIwl+ZPcOv8bsfEkmShHdMC0dlfcj6r7x4tc0XkNAhhJgfRNz +FsmPWKJb6FYcsHFbHO/Uw1hSokbAGcWWTshEOqvKHMa8UVkrFMUPnrnMtdyJqZlhDBrZHNi4rWth +8TjlUnQVSCF9s9I04FxJ1cUAdeVMHtXKM8Pvjv68PaJMJK73dW5Yd3SbcgoKLesf/HPWeeZL0rr4 +TNjlqJ/wq61Ons45MFG9bIscVbnd+XxFHx8Skw== 2fdeb8e7d030a2209daa01861a964fedecf2bcc1 diff --git a/tools/tcg_rim_tool/src/test/resources/generated_with_cert.swidtag b/tools/tcg_rim_tool/src/test/resources/generated_with_cert.swidtag index 2c1c9c01..38a0cf0a 100644 --- a/tools/tcg_rim_tool/src/test/resources/generated_with_cert.swidtag +++ b/tools/tcg_rim_tool/src/test/resources/generated_with_cert.swidtag @@ -2,8 +2,8 @@ - - + + @@ -17,14 +17,14 @@ - 1rf2CJ9y+OSyPzuqgJt9ve3WiaBjya/RylFFZwSpy5Y= + 97uWB7zSsO5WaGbrcQrlKd1Bju0aDTjK1/ktUYBje8A= - TRqJ4HtAuQRSqL8TnqhpANTRkAPAI1tUft44xSAzqITT9NSetbLd2Te2D5/jg5kNwfpIYKirGKrd -suTuBID5DsUsuZqExuvfAKPh1AQuSrQDrZReu+Ma1P/IGzZq3hRV1LVinV5NojdQbyB+yUcTp/d0 -gpBr5Y/PfYGLbkHshw2yJuhd6l1a2WPU8AxBQYTGJiFYX3WEkW20EubJ9FoxCVImdkhzbQKP/3lp -M31jCMKM1DcFuUU3zdonZukWhd4bbqj926Av+r+qH9S1uGmwQEsNT0lfLljGd7Q7MMxuZ+9fbSgo -D5GuQbkDL+RfEjbseEpOaB0w4f1uqeCoTEuiiA== + N1YtTeo2Ryuj+CtlXIpICEay+ni7vt8+4J7tAsYpa3efnLwtea69PIqEylPWm9LdA8Eo8XDdpgxV +7h3hi2LTOU+Wxq3bLiLamo99T1EtIwl+ZPcOv8bsfEkmShHdMC0dlfcj6r7x4tc0XkNAhhJgfRNz +FsmPWKJb6FYcsHFbHO/Uw1hSokbAGcWWTshEOqvKHMa8UVkrFMUPnrnMtdyJqZlhDBrZHNi4rWth +8TjlUnQVSCF9s9I04FxJ1cUAdeVMHtXKM8Pvjv68PaJMJK73dW5Yd3SbcgoKLesf/HPWeeZL0rr4 +TNjlqJ/wq61Ons45MFG9bIscVbnd+XxFHx8Skw== CN=example.RIM.signer,OU=PCClient,O=Example,ST=VA,C=US diff --git a/tools/tcg_rim_tool/src/test/resources/rim_fields.json b/tools/tcg_rim_tool/src/test/resources/rim_fields.json index e8e67a85..c5cd3f41 100644 --- a/tools/tcg_rim_tool/src/test/resources/rim_fields.json +++ b/tools/tcg_rim_tool/src/test/resources/rim_fields.json @@ -33,11 +33,11 @@ "bindingSpec": "PC Client RIM", "bindingSpecVersion": "1.2", "pcURIlocal": "/boot/tcg/manifest/switag/", - "pcURIGlobal": "https://Example.com/support/ProductA/", - "supportRIMFormat":"TCG_EventLog_Assertion" + "pcURIGlobal": "https://Example.com/support/ProductA/" }, "Payload": { "supportRIMURIGlobal": "https://Example.com/support/ProductA/firmware/rims/", + "supportRIMFormat":"TCG_EventLog_Assertion", "Directory": { "name": "rim", "root": "/boot/tcg/manifest/rim/",