@@ -41,10 +41,9 @@ public class SPDX30Parser : ISbomParser
4141 {
4242 "SpdxDocument" ,
4343 "File" ,
44- "Package" ,
4544 } ;
4645
47- private IReadOnlyCollection < string > ? entitiesToEnforceComplianceStandardsFor ;
46+ private IReadOnlyCollection < string > ? entititesRequiringDeserializationWithNTIA ;
4847 private SpdxMetadata metadata = new SpdxMetadata ( ) ;
4948 private readonly LargeJsonParser parser ;
5049 private readonly IList < string > observedFieldNames = new List < string > ( ) ;
@@ -161,7 +160,7 @@ public void SetComplianceStandard(string? complianceStandardFromCli)
161160 {
162161 case ComplianceStandard . NTIA :
163162 RequiredComplianceStandard = complianceStandardAsEnum ;
164- entitiesToEnforceComplianceStandardsFor = EntitiesWithDifferentNTIARequirements ;
163+ entititesRequiringDeserializationWithNTIA = EntitiesWithDifferentNTIARequirements ;
165164 break ;
166165 default :
167166 break ;
@@ -262,7 +261,7 @@ private Type GetEntityType(JsonObject jsonObject, ComplianceStandard? requiredCo
262261 switch ( requiredComplianceStandard )
263262 {
264263 case ComplianceStandard . NTIA :
265- if ( this . entitiesToEnforceComplianceStandardsFor ? . Contains ( entityType ) == true )
264+ if ( this . entititesRequiringDeserializationWithNTIA ? . Contains ( entityType ) == true )
266265 {
267266 entityType = "NTIA" + entityType ;
268267 }
@@ -337,10 +336,10 @@ private void ValidateSbomPackagesForNTIA(List<Element> elementsList)
337336 {
338337 var packageSpdxId = packageElement . SpdxId ;
339338
340- var packageHasSha256Hash = packageElement . VerifiedUsing .
339+ var packageHasSha256Hash = packageElement . VerifiedUsing ? .
341340 Any ( packageVerificationCode => packageVerificationCode . Algorithm == HashAlgorithm . sha256 ) ;
342341
343- if ( ! packageHasSha256Hash )
342+ if ( packageHasSha256Hash is null || packageHasSha256Hash == false )
344343 {
345344 throw new ParserException ( $ "SBOM document is not NTIA compliant because package with SPDX ID { packageSpdxId } does not have a SHA256 hash.") ;
346345 }
0 commit comments