Skip to content

Commit

Permalink
Support multisignature and signaturechain
Browse files Browse the repository at this point in the history
Signed-off-by: andreas hilti <69210561+andreas-hilti@users.noreply.github.com>
  • Loading branch information
andreas-hilti committed Sep 14, 2024
1 parent c06a8c7 commit e684a5d
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/CycloneDX.Core/Json/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public static JsonSerializerOptions GetJsonSerializerOptions()
options.Converters.Add(new HyphenEnumConverter<Data.DataType>());
options.Converters.Add(new HyphenEnumConverter<ActivityType>());
options.Converters.Add(new HyphenEnumConverter<EnergySource>());
options.Converters.Add(new SignatureChoiceConverter());

Check failure on line 99 in src/CycloneDX.Core/Json/Utils.cs

View workflow job for this annotation

GitHub Actions / Build warnings check

The type or namespace name 'SignatureChoiceConverter' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 99 in src/CycloneDX.Core/Json/Utils.cs

View workflow job for this annotation

GitHub Actions / Build warnings check

The type or namespace name 'SignatureChoiceConverter' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 99 in src/CycloneDX.Core/Json/Utils.cs

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest

The type or namespace name 'SignatureChoiceConverter' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 99 in src/CycloneDX.Core/Json/Utils.cs

View workflow job for this annotation

GitHub Actions / Tests on windows-latest

The type or namespace name 'SignatureChoiceConverter' could not be found (are you missing a using directive or an assembly reference?)

options.Converters.Add(new JsonStringEnumConverter());

Expand Down
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Bom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,6 @@ public int NonNullableVersion
[JsonIgnore]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Component.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public bool NonNullableModified
[JsonIgnore]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }

public override bool Equals(object obj)
{
Expand Down
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Composition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public enum AggregateType
[JsonIgnore]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }

public System.Xml.Schema.XmlSchema GetSchema() {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Declarations/Affirmation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Affirmation
[JsonIgnore]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }

}
}
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Declarations/Attestation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class Attestation : IEquatable<Attestation>
public List<System.Xml.XmlElement> Any { get; set; }

[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }

public override bool Equals(object obj)
{
Expand Down
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Declarations/Claim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class Claim : IEquatable<Claim>, IHasBomRef
[JsonIgnore]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }

public override bool Equals(object obj)
{
Expand Down
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Declarations/Declarations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class Declarations
[JsonIgnore]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public DateTime? Expires
[JsonIgnore]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }

}
}
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Declarations/Signatory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public class Signatory
[JsonIgnore]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }
}
}
7 changes: 7 additions & 0 deletions src/CycloneDX.Core/Models/Declarations/Signature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public class Signature
public string Value { get; set; }
}

public class SignatureChoice
{
public List<Signature> Signers;
public List<Signature> Chain;
public Signature Signature;
}

public enum KeyTypeIndicator
{
EC,
Expand Down
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Definitions/Standard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class Standard : IEquatable<Standard>, IHasBomRef
public System.Xml.XmlAttribute[] AnyAttr { get; set; }

[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }



Expand Down
2 changes: 1 addition & 1 deletion src/CycloneDX.Core/Models/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public LicenseChoiceList LicensesSerialized
[XmlAnyElement("Signature", Namespace = "http://www.w3.org/2000/09/xmldsig#")]
public XmlElement XmlSignature { get; set; }
[XmlIgnore]
public Signature Signature { get; set; }
public SignatureChoice Signature { get; set; }

[XmlArray("tags")]
[XmlArrayItem("tag")]
Expand Down

0 comments on commit e684a5d

Please sign in to comment.