diff --git a/src/main/java/org/cyclonedx/model/component/crypto/CryptoRef.java b/src/main/java/org/cyclonedx/model/component/crypto/CryptoRef.java deleted file mode 100644 index e1df02869..000000000 --- a/src/main/java/org/cyclonedx/model/component/crypto/CryptoRef.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.cyclonedx.model.component.crypto; - -import java.util.List; -import java.util.Objects; - -public class CryptoRef -{ - private List ref; - - public List getRef() { - return ref; - } - - public void setRef(final List ref) { - this.ref = ref; - } - - @Override - public boolean equals(final Object object) { - if (this == object) { - return true; - } - if (!(object instanceof CryptoRef)) { - return false; - } - CryptoRef cryptoRef = (CryptoRef) object; - return Objects.equals(ref, cryptoRef.ref); - } - - @Override - public int hashCode() { - return Objects.hashCode(ref); - } -} diff --git a/src/main/java/org/cyclonedx/model/component/crypto/Ikev2TransformTypes.java b/src/main/java/org/cyclonedx/model/component/crypto/Ikev2TransformTypes.java new file mode 100644 index 000000000..50cff8bc3 --- /dev/null +++ b/src/main/java/org/cyclonedx/model/component/crypto/Ikev2TransformTypes.java @@ -0,0 +1,90 @@ +package org.cyclonedx.model.component.crypto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; + +import java.util.List; + +public class Ikev2TransformTypes { + + @JacksonXmlElementWrapper(useWrapping = false) + @JacksonXmlProperty(localName = "encr") + @JsonProperty("encr") + private List encr; + + @JacksonXmlElementWrapper(useWrapping = false) + @JacksonXmlProperty(localName = "prf") + @JsonProperty("prf") + private List prf; + + @JacksonXmlElementWrapper(useWrapping = false) + @JacksonXmlProperty(localName = "integ") + @JsonProperty("integ") + private List integ; + + @JacksonXmlElementWrapper(useWrapping = false) + @JacksonXmlProperty(localName = "ke") + @JsonProperty("ke") + private List ke; + + @JsonProperty("esn") + private Boolean esn; + + @JacksonXmlElementWrapper(useWrapping = false) + @JacksonXmlProperty(localName = "auth") + @JsonProperty("auth") + private List auth; + + public Ikev2TransformTypes() { + } + + public List getEncr() { + return encr; + } + + public void setEncr(List encr) { + this.encr = encr; + } + + public List getPrf() { + return prf; + } + + public void setPrf(List prf) { + this.prf = prf; + } + + public List getInteg() { + return integ; + } + + public void setInteg(List integ) { + this.integ = integ; + } + + public List getKe() { + return ke; + } + + public void setKe(List ke) { + this.ke = ke; + } + + public Boolean getEsn() { + return esn; + } + + public void setEsn(Boolean esn) { + this.esn = esn; + } + + public List getAuth() { + return auth; + } + + public void setAuth(List auth) { + this.auth = auth; + } +} + diff --git a/src/main/java/org/cyclonedx/model/component/crypto/ProtocolProperties.java b/src/main/java/org/cyclonedx/model/component/crypto/ProtocolProperties.java index 4939f7c82..24926356a 100644 --- a/src/main/java/org/cyclonedx/model/component/crypto/ProtocolProperties.java +++ b/src/main/java/org/cyclonedx/model/component/crypto/ProtocolProperties.java @@ -1,7 +1,6 @@ package org.cyclonedx.model.component.crypto; import java.util.List; -import java.util.Map; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -23,9 +22,10 @@ public class ProtocolProperties private List cipherSuites; - private Map ikev2TransformTypes; + @JsonProperty("ikev2TransformTypes") + private Ikev2TransformTypes ikev2TransformTypes; - private CryptoRef cryptoRefArray; + private List cryptoRefArray; public ProtocolType getType() { return type; @@ -54,19 +54,22 @@ public void setCipherSuites(final List cipherSuites) { this.cipherSuites = cipherSuites; } - public Map getIkev2TransformTypes() { + public Ikev2TransformTypes getIkev2TransformTypes() { return ikev2TransformTypes; } - public void setIkev2TransformTypes(final Map ikev2TransformTypes) { + public void setIkev2TransformTypes(final Ikev2TransformTypes ikev2TransformTypes) { this.ikev2TransformTypes = ikev2TransformTypes; } - public CryptoRef getCryptoRefArray() { + @JacksonXmlElementWrapper(useWrapping = false) + @JacksonXmlProperty(localName = "cryptoRef") + @JsonProperty("cryptoRefArray") + public List getCryptoRefArray() { return cryptoRefArray; } - public void setCryptoRefArray(final CryptoRef cryptoRefArray) { + public void setCryptoRefArray(final List cryptoRefArray) { this.cryptoRefArray = cryptoRefArray; } diff --git a/src/test/resources/1.6/valid-cryptography-full-1.6.json b/src/test/resources/1.6/valid-cryptography-full-1.6.json index ac1344659..254d8433b 100644 --- a/src/test/resources/1.6/valid-cryptography-full-1.6.json +++ b/src/test/resources/1.6/valid-cryptography-full-1.6.json @@ -65,7 +65,16 @@ "0xC0" ] } - ] + ], + "ikev2TransformTypes" : { + "encr" : [ "bom-ref-to-encryption-algorithm", "bom-ref-to-encryption-algorithm1" ], + "prf" : [ "bom-ref-to-pseudorandom-function" ], + "integ" : [ "bom-ref-to-integrity-algorithm" ], + "ke" : [ "bom-ref-to-key-exchange-method" ], + "esn" : true, + "auth" : [ "bom-ref-to-authentication-method" ] + }, + "cryptoRefArray" : [ "test", "test1" ] }, "oid": "oid:1.2.3.4.5.6.7.8.9" } diff --git a/src/test/resources/1.6/valid-cryptography-full-1.6.xml b/src/test/resources/1.6/valid-cryptography-full-1.6.xml index 0e151a343..907ac04ba 100644 --- a/src/test/resources/1.6/valid-cryptography-full-1.6.xml +++ b/src/test/resources/1.6/valid-cryptography-full-1.6.xml @@ -61,6 +61,17 @@ + + bom-ref-to-encryption-algorithm + bom-ref-to-encryption-algorithm1 + bom-ref-to-pseudorandom-function + bom-ref-to-integrity-algorithm + bom-ref-to-key-exchange-method + true + bom-ref-to-authentication-method + + test + test1 oid:1.2.3.4.5.6.7.8.9