Class X509Certificate

java.lang.Object
security.whisper.javastix.coo.objects.X509Certificate
All Implemented Interfaces:
Serializable, BundleableObject, Stix, StixCustomProperties, CyberObservableObject, CyberObservableObjectCommonProperties, X509CertificateCoo, GenericValidation, SdoDefaultValidator

@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class X509Certificate extends Object implements X509CertificateCoo
x509-certificate

The X509 Certificate Object represents the properties of an X.509 certificate.

See Also:
  • Method Details

    • isSelfSigned

      @JsonPropertyDescription("Specifies whether the certificate is self-signed, i.e., whether it is signed by the same entity whose identity it certifies.") public Optional<Boolean> isSelfSigned()
      Specified by:
      isSelfSigned in interface X509CertificateCoo
      Returns:
      The value of the isSelfSigned attribute
    • getHashes

      @JsonPropertyDescription("Specifies any hashes that were calculated for the entire contents of the certificate.") public com.google.common.collect.ImmutableMap<String,String> getHashes()
      Specified by:
      getHashes in interface X509CertificateCoo
      Returns:
      The value of the hashes attribute
    • getVersion

      @JsonPropertyDescription("Specifies the version of the encoded certificate.") public Optional<String> getVersion()
      Specified by:
      getVersion in interface X509CertificateCoo
      Returns:
      The value of the version attribute
    • getSerialNumber

      @JsonPropertyDescription("Specifies the unique identifier for the certificate, as issued by a specific Certificate Authority.") public Optional<String> getSerialNumber()
      Specified by:
      getSerialNumber in interface X509CertificateCoo
      Returns:
      The value of the serialNumber attribute
    • getSignatureAlgorithm

      @JsonPropertyDescription("Specifies the name of the algorithm used to sign the certificate.") public Optional<String> getSignatureAlgorithm()
      Specified by:
      getSignatureAlgorithm in interface X509CertificateCoo
      Returns:
      The value of the signatureAlgorithm attribute
    • getIssuer

      @JsonPropertyDescription("Specifies the name of the Certificate Authority that issued the certificate.") public Optional<String> getIssuer()
      Specified by:
      getIssuer in interface X509CertificateCoo
      Returns:
      The value of the issuer attribute
    • getValidityNotBefore

      @JsonPropertyDescription("Specifies the date on which the certificate validity period begins.") public Optional<StixInstant> getValidityNotBefore()
      Specified by:
      getValidityNotBefore in interface X509CertificateCoo
      Returns:
      The value of the validityNotBefore attribute
    • getValidityNotAfter

      @JsonPropertyDescription("Specifies the date on which the certificate validity period ends.") public Optional<StixInstant> getValidityNotAfter()
      Specified by:
      getValidityNotAfter in interface X509CertificateCoo
      Returns:
      The value of the validityNotAfter attribute
    • getSubject

      @JsonPropertyDescription("Specifies the name of the entity associated with the public key stored in the subject public key field of the certificate.") public Optional<String> getSubject()
      Specified by:
      getSubject in interface X509CertificateCoo
      Returns:
      The value of the subject attribute
    • getSubjectPublicKeyAlgorithm

      @JsonPropertyDescription("Specifies the name of the algorithm with which to encrypt data being sent to the subject.") public Optional<String> getSubjectPublicKeyAlgorithm()
      Specified by:
      getSubjectPublicKeyAlgorithm in interface X509CertificateCoo
      Returns:
      The value of the subjectPublicKeyAlgorithm attribute
    • getSubjectPublicKeyModulus

      @JsonPropertyDescription("Specifies the modulus portion of the subject\u2019s public RSA key.") public Optional<String> getSubjectPublicKeyModulus()
      Specified by:
      getSubjectPublicKeyModulus in interface X509CertificateCoo
      Returns:
      The value of the subjectPublicKeyModulus attribute
    • getSubjectPublicKeyExponent

      @JsonPropertyDescription("Specifies the exponent portion of the subject\u2019s public RSA key, as an integer.") public Optional<Long> getSubjectPublicKeyExponent()
      Specified by:
      getSubjectPublicKeyExponent in interface X509CertificateCoo
      Returns:
      The value of the subjectPublicKeyExponent attribute
    • getX509V3Extensions

      @JsonPropertyDescription("Specifies any standard X.509 v3 extensions that may be used in the certificate.") public Optional<X509v3ExtensionsObj> getX509V3Extensions()
      Specified by:
      getX509V3Extensions in interface X509CertificateCoo
      Returns:
      The value of the x509V3Extensions attribute
    • getId

      public String getId()
      Deterministically generates the ID for this X.509 certificate based on its serial number, hashes, or subject.
      Specified by:
      getId in interface BundleableObject
      Specified by:
      getId in interface CyberObservableObjectCommonProperties
      Specified by:
      getId in interface X509CertificateCoo
    • getType

      public String getType()
      Specified by:
      getType in interface BundleableObject
      Specified by:
      getType in interface CyberObservableObjectCommonProperties
      Returns:
      The value of the type attribute
    • getExtensions

      @JsonPropertyDescription("Specifies any extensions of the object, as a dictionary.") public com.google.common.collect.ImmutableSet<CyberObservableExtension> getExtensions()
      Multiple extensions can be added, but only 1 instance of a specific extension can be added.
      Specified by:
      getExtensions in interface CyberObservableObjectCommonProperties
    • getObservableObjectKey

      public String getObservableObjectKey()
      Used for generation of Map Keys by
      invalid reference
      ObservedDataSdo#getObjects()
      Manually set this value if you want to control key names. Otherwise UUIDs will be used.
      Specified by:
      getObservableObjectKey in interface CyberObservableObjectCommonProperties
    • getDefanged

      @JsonPropertyDescription("Indicates whether the data contained in the SCO has been defanged.") public Optional<Boolean> getDefanged()
      Indicates whether the data contained in the SCO has been defanged. Defanging refers to the process of modifying data to make it safe to handle (e.g., changing an IP address from 192.168.1.1 to 192[.]168[.]1[.]1).
      Specified by:
      getDefanged in interface CyberObservableObjectCommonProperties
    • getCustomProperties

      public com.google.common.collect.ImmutableMap<String,Object> getCustomProperties()
      Custom Properties for STIX Objects. Any object that supports custom properties will have a validation of the custom property prefix (typically "x_"). If the additional property in the JSON does not meet the StartsWith condition, then the JSON will be rejected.
      Specified by:
      getCustomProperties in interface StixCustomProperties
      Returns:
      Map of custom properties Map<String, Object>
    • getObjectMarkingRefs

      public com.google.common.collect.ImmutableSet<MarkingDefinitionDm> getObjectMarkingRefs()
      Specified by:
      getObjectMarkingRefs in interface BundleableObject
      Returns:
      The value of the objectMarkingRefs attribute
    • getGranularMarkings

      public com.google.common.collect.ImmutableSet<GranularMarkingDm> getGranularMarkings()
      Specified by:
      getGranularMarkings in interface BundleableObject
      Returns:
      The value of the granularMarkings attribute
    • getHydrated

      public boolean getHydrated()
      Specified by:
      getHydrated in interface BundleableObject
      Returns:
      The value of the hydrated attribute
    • toJsonString

      public String toJsonString()
      Specified by:
      toJsonString in interface BundleableObject
      Returns:
      The value of the toJsonString attribute
    • withIsSelfSigned

      public final X509Certificate withIsSelfSigned(boolean value)
      Copy the current immutable object by setting a present value for the optional isSelfSigned attribute.
      Parameters:
      value - The value for isSelfSigned
      Returns:
      A modified copy of this object
    • withIsSelfSigned

      public final X509Certificate withIsSelfSigned(Optional<Boolean> optional)
      Copy the current immutable object by setting an optional value for the isSelfSigned attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for isSelfSigned
      Returns:
      A modified copy of this object
    • withHashes

      public final X509Certificate withHashes(Map<String,? extends String> entries)
      Copy the current immutable object by replacing the hashes map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the hashes map
      Returns:
      A modified copy of this object
    • withVersion

      public final X509Certificate withVersion(String value)
      Copy the current immutable object by setting a present value for the optional version attribute.
      Parameters:
      value - The value for version
      Returns:
      A modified copy of this object
    • withVersion

      public final X509Certificate withVersion(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the version attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for version
      Returns:
      A modified copy of this object
    • withSerialNumber

      public final X509Certificate withSerialNumber(String value)
      Copy the current immutable object by setting a present value for the optional serialNumber attribute.
      Parameters:
      value - The value for serialNumber
      Returns:
      A modified copy of this object
    • withSerialNumber

      public final X509Certificate withSerialNumber(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the serialNumber attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for serialNumber
      Returns:
      A modified copy of this object
    • withSignatureAlgorithm

      public final X509Certificate withSignatureAlgorithm(String value)
      Copy the current immutable object by setting a present value for the optional signatureAlgorithm attribute.
      Parameters:
      value - The value for signatureAlgorithm
      Returns:
      A modified copy of this object
    • withSignatureAlgorithm

      public final X509Certificate withSignatureAlgorithm(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the signatureAlgorithm attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for signatureAlgorithm
      Returns:
      A modified copy of this object
    • withIssuer

      public final X509Certificate withIssuer(String value)
      Copy the current immutable object by setting a present value for the optional issuer attribute.
      Parameters:
      value - The value for issuer
      Returns:
      A modified copy of this object
    • withIssuer

      public final X509Certificate withIssuer(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the issuer attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for issuer
      Returns:
      A modified copy of this object
    • withValidityNotBefore

      public final X509Certificate withValidityNotBefore(StixInstant value)
      Copy the current immutable object by setting a present value for the optional validityNotBefore attribute.
      Parameters:
      value - The value for validityNotBefore
      Returns:
      A modified copy of this object
    • withValidityNotBefore

      public final X509Certificate withValidityNotBefore(Optional<? extends StixInstant> optional)
      Copy the current immutable object by setting an optional value for the validityNotBefore attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for validityNotBefore
      Returns:
      A modified copy of this object
    • withValidityNotAfter

      public final X509Certificate withValidityNotAfter(StixInstant value)
      Copy the current immutable object by setting a present value for the optional validityNotAfter attribute.
      Parameters:
      value - The value for validityNotAfter
      Returns:
      A modified copy of this object
    • withValidityNotAfter

      public final X509Certificate withValidityNotAfter(Optional<? extends StixInstant> optional)
      Copy the current immutable object by setting an optional value for the validityNotAfter attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for validityNotAfter
      Returns:
      A modified copy of this object
    • withSubject

      public final X509Certificate withSubject(String value)
      Copy the current immutable object by setting a present value for the optional subject attribute.
      Parameters:
      value - The value for subject
      Returns:
      A modified copy of this object
    • withSubject

      public final X509Certificate withSubject(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the subject attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for subject
      Returns:
      A modified copy of this object
    • withSubjectPublicKeyAlgorithm

      public final X509Certificate withSubjectPublicKeyAlgorithm(String value)
      Copy the current immutable object by setting a present value for the optional subjectPublicKeyAlgorithm attribute.
      Parameters:
      value - The value for subjectPublicKeyAlgorithm
      Returns:
      A modified copy of this object
    • withSubjectPublicKeyAlgorithm

      public final X509Certificate withSubjectPublicKeyAlgorithm(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the subjectPublicKeyAlgorithm attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for subjectPublicKeyAlgorithm
      Returns:
      A modified copy of this object
    • withSubjectPublicKeyModulus

      public final X509Certificate withSubjectPublicKeyModulus(String value)
      Copy the current immutable object by setting a present value for the optional subjectPublicKeyModulus attribute.
      Parameters:
      value - The value for subjectPublicKeyModulus
      Returns:
      A modified copy of this object
    • withSubjectPublicKeyModulus

      public final X509Certificate withSubjectPublicKeyModulus(Optional<String> optional)
      Copy the current immutable object by setting an optional value for the subjectPublicKeyModulus attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for subjectPublicKeyModulus
      Returns:
      A modified copy of this object
    • withSubjectPublicKeyExponent

      public final X509Certificate withSubjectPublicKeyExponent(long value)
      Copy the current immutable object by setting a present value for the optional subjectPublicKeyExponent attribute.
      Parameters:
      value - The value for subjectPublicKeyExponent
      Returns:
      A modified copy of this object
    • withSubjectPublicKeyExponent

      public final X509Certificate withSubjectPublicKeyExponent(Optional<Long> optional)
      Copy the current immutable object by setting an optional value for the subjectPublicKeyExponent attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for subjectPublicKeyExponent
      Returns:
      A modified copy of this object
    • withX509V3Extensions

      public final X509Certificate withX509V3Extensions(X509v3ExtensionsObj value)
      Copy the current immutable object by setting a present value for the optional x509V3Extensions attribute.
      Parameters:
      value - The value for x509V3Extensions
      Returns:
      A modified copy of this object
    • withX509V3Extensions

      public final X509Certificate withX509V3Extensions(Optional<? extends X509v3ExtensionsObj> optional)
      Copy the current immutable object by setting an optional value for the x509V3Extensions attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for x509V3Extensions
      Returns:
      A modified copy of this object
    • withType

      public final X509Certificate withType(String value)
      Copy the current immutable object by setting a value for the type attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for type (can be null)
      Returns:
      A modified copy of the this object
    • withExtensions

      public final X509Certificate withExtensions(CyberObservableExtension... elements)
      Copy the current immutable object with elements that replace the content of extensions.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withExtensions

      public final X509Certificate withExtensions(Iterable<? extends CyberObservableExtension> elements)
      Copy the current immutable object with elements that replace the content of extensions. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of extensions elements to set
      Returns:
      A modified copy of this object
    • withObservableObjectKey

      public final X509Certificate withObservableObjectKey(String value)
      Copy the current immutable object by setting a value for the observableObjectKey attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for observableObjectKey
      Returns:
      A modified copy of the this object
    • withDefanged

      public final X509Certificate withDefanged(boolean value)
      Copy the current immutable object by setting a present value for the optional defanged attribute.
      Parameters:
      value - The value for defanged
      Returns:
      A modified copy of this object
    • withDefanged

      public final X509Certificate withDefanged(Optional<Boolean> optional)
      Copy the current immutable object by setting an optional value for the defanged attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for defanged
      Returns:
      A modified copy of this object
    • withCustomProperties

      public final X509Certificate withCustomProperties(Map<String,? extends Object> entries)
      Copy the current immutable object by replacing the customProperties map with the specified map. Nulls are not permitted as keys or values. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      entries - The entries to be added to the customProperties map
      Returns:
      A modified copy of this object
    • withObjectMarkingRefs

      public final X509Certificate withObjectMarkingRefs(MarkingDefinitionDm... elements)
      Copy the current immutable object with elements that replace the content of objectMarkingRefs.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withObjectMarkingRefs

      public final X509Certificate withObjectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements)
      Copy the current immutable object with elements that replace the content of objectMarkingRefs. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of objectMarkingRefs elements to set
      Returns:
      A modified copy of this object
    • withGranularMarkings

      public final X509Certificate withGranularMarkings(GranularMarkingDm... elements)
      Copy the current immutable object with elements that replace the content of granularMarkings.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withGranularMarkings

      public final X509Certificate withGranularMarkings(Iterable<? extends GranularMarkingDm> elements)
      Copy the current immutable object with elements that replace the content of granularMarkings. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of granularMarkings elements to set
      Returns:
      A modified copy of this object
    • withHydrated

      public final X509Certificate withHydrated(boolean value)
      Copy the current immutable object by setting a value for the hydrated attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for hydrated
      Returns:
      A modified copy of the this object
    • withToJsonString

      public final X509Certificate withToJsonString(String value)
      Copy the current immutable object by setting a value for the toJsonString attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for toJsonString (can be null)
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(@Nullable Object another)
      This instance is equal to all instances of X509Certificate that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: isSelfSigned, hashes, version, serialNumber, signatureAlgorithm, issuer, validityNotBefore, validityNotAfter, subject, subjectPublicKeyAlgorithm, subjectPublicKeyModulus, subjectPublicKeyExponent, x509V3Extensions, id, type, extensions, observableObjectKey, defanged, customProperties, objectMarkingRefs, granularMarkings, hydrated, toJsonString.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value X509Certificate with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static X509Certificate copyOf(X509CertificateCoo instance)
      Creates an immutable copy of a X509CertificateCoo value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable X509Certificate instance
    • builder

      public static X509Certificate.Builder builder()
      Creates a builder for X509Certificate.
      Returns:
      A new X509Certificate builder