mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-04-12 21:53:08 +00:00
v3_issue_906: Figured out where I can place the code that will display the PCIE component class value. First cut at it.
Some checks failed
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (ubuntu-20.04) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (windows-2022) (push) Has been cancelled
HIRS Build and Unit Test / ACA_Provisioner_Unit_Tests (push) Has been cancelled
HIRS System Tests / DockerTests (push) Has been cancelled
Dotnet Provisioner Unit Tests / Evaluate Tests (push) Has been cancelled
Some checks failed
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (ubuntu-20.04) (push) Has been cancelled
Dotnet Provisioner Unit Tests / Restore and Run Unit Tests (windows-2022) (push) Has been cancelled
HIRS Build and Unit Test / ACA_Provisioner_Unit_Tests (push) Has been cancelled
HIRS System Tests / DockerTests (push) Has been cancelled
Dotnet Provisioner Unit Tests / Evaluate Tests (push) Has been cancelled
This commit is contained in:
parent
0b7a72805a
commit
03cee0a6d5
@ -477,12 +477,15 @@ public class PlatformCredential extends DeviceAssociatedCertificate {
|
||||
if (subjectAlternativeNameExtension != null) {
|
||||
GeneralNames gnames = GeneralNames.getInstance(
|
||||
subjectAlternativeNameExtension.getParsedValue());
|
||||
for (GeneralName gname : gnames.getNames()) {
|
||||
GeneralName[] allGnames = gnames.getNames();
|
||||
for (GeneralName gname : allGnames) {
|
||||
// Check if it's a directoryName [4] Name type
|
||||
if (gname.getTagNo() == GeneralName.directoryName) {
|
||||
X500Name name = X500Name.getInstance(gname.getName());
|
||||
for (RDN rdn : name.getRDNs()) {
|
||||
for (AttributeTypeAndValue attTV : rdn.getTypesAndValues()) {
|
||||
RDN[] rdns = name.getRDNs();
|
||||
for (RDN rdn : rdns) {
|
||||
AttributeTypeAndValue[] attributeTypeAndValues = rdn.getTypesAndValues();
|
||||
for (AttributeTypeAndValue attTV : attributeTypeAndValues) {
|
||||
switch (attTV.getType().toString()) {
|
||||
case PLATFORM_MANUFACTURER_2_0:
|
||||
this.manufacturer = attTV.getValue().toString();
|
||||
|
@ -149,7 +149,16 @@ ComponentClass {
|
||||
default:
|
||||
this.category = this.componentIdentifier.substring(0, MID_INDEX) + this.category;
|
||||
this.component = OTHER + this.componentIdentifier.substring(MID_INDEX);
|
||||
findStringValues(JsonUtils.getSpecificJsonObject(componentClassPath, registryType));
|
||||
|
||||
// if the registry type is of type PCIE, attempt to use the included library to parse the string values
|
||||
if (this.registryType.equals("PCIE")) {
|
||||
findStringValuesForPCIE();
|
||||
}
|
||||
// for all other registry types, attempt to retrieve the string values using the component class json file
|
||||
else {
|
||||
findStringValuesFromJSONObject(
|
||||
JsonUtils.getSpecificJsonObject(componentClassPath, registryType));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -191,22 +200,29 @@ ComponentClass {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
String resultString;
|
||||
if (componentStr.equals(UNKNOWN_STRING) || component.equals(OTHER_STRING)) {
|
||||
resultString = String.format("%s%n%s", registryType, categoryStr);
|
||||
} else {
|
||||
resultString = String.format("%s%n%s - %s", registryType, categoryStr, componentStr);
|
||||
return String.format("%s%n%s", registryType, categoryStr);
|
||||
}
|
||||
return resultString;
|
||||
return String.format("%s%n%s - %s", registryType, categoryStr, componentStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the Category mapped to the associated value in.
|
||||
*
|
||||
* @param categories a JSON object associated with mapped categories in file
|
||||
* {}@link componentIdentifier}.
|
||||
* Helper method that attempts to find and set the category and component string using the provided library. This method
|
||||
* will be used only for the PCIE registry types.
|
||||
*/
|
||||
private void findStringValues(final JsonObject categories) {
|
||||
private void findStringValuesForPCIE() {
|
||||
//TODO placeholders
|
||||
this.categoryStr = NONE_STRING;
|
||||
this.componentStr = UNKNOWN_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method that attempts to find and set the category and component string using the provided JSON object. This
|
||||
* method will typically be used for the SMBIOS and TCG registry types.
|
||||
*
|
||||
* @param categories a JSON object associated with mapped categories in file.
|
||||
*/
|
||||
private void findStringValuesFromJSONObject(final JsonObject categories) {
|
||||
String categoryID;
|
||||
String componentMask;
|
||||
boolean found = false;
|
||||
|
@ -753,8 +753,10 @@ public class IdentityClaimProcessor extends AbstractProcessor {
|
||||
ComponentResult componentResult;
|
||||
|
||||
if (platformCredential.getPlatformConfigurationV1() != null) {
|
||||
for (ComponentIdentifier componentIdentifier : platformCredential
|
||||
.getComponentIdentifiers()) {
|
||||
List<ComponentIdentifier> componentIdentifiers = platformCredential
|
||||
.getComponentIdentifiers();
|
||||
|
||||
for (ComponentIdentifier componentIdentifier : componentIdentifiers) {
|
||||
componentResult = new ComponentResult(platformCredential.getPlatformSerial(),
|
||||
platformCredential.getSerialNumber().toString(),
|
||||
platformCredential.getPlatformChainType(),
|
||||
@ -764,8 +766,10 @@ public class IdentityClaimProcessor extends AbstractProcessor {
|
||||
componentResultRepository.save(componentResult);
|
||||
}
|
||||
} else if (platformCredential.getPlatformConfigurationV2() != null) {
|
||||
for (ComponentIdentifierV2 componentIdentifierV2 : platformCredential
|
||||
.getComponentIdentifiersV2()) {
|
||||
List<ComponentIdentifierV2> componentIdentifiersV2 = platformCredential
|
||||
.getComponentIdentifiersV2();
|
||||
|
||||
for (ComponentIdentifierV2 componentIdentifierV2 : componentIdentifiersV2) {
|
||||
componentResult = new ComponentResult(platformCredential.getPlatformSerial(),
|
||||
platformCredential.getSerialNumber().toString(),
|
||||
platformCredential.getPlatformChainType(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user