Class X509Certificate.Builder

java.lang.Object
security.whisper.javastix.coo.objects.X509Certificate.Builder
Enclosing class:
X509Certificate

@NotThreadSafe public static final class X509Certificate.Builder extends Object
Builds instances of type X509Certificate. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      @CanIgnoreReturnValue public final X509Certificate.Builder from(BundleableObject instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.bundle.BundleableObject instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      @CanIgnoreReturnValue public final X509Certificate.Builder from(StixCustomProperties instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.common.StixCustomProperties instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      @CanIgnoreReturnValue public final X509Certificate.Builder from(X509CertificateCoo instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.coo.objects.X509CertificateCoo instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • from

      @CanIgnoreReturnValue public final X509Certificate.Builder from(CyberObservableObjectCommonProperties instance)
      Fill a builder with attribute values from the provided security.whisper.javastix.coo.CyberObservableObjectCommonProperties instance.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • isSelfSigned

      @CanIgnoreReturnValue public final X509Certificate.Builder isSelfSigned(boolean isSelfSigned)
      Initializes the optional value isSelfSigned to isSelfSigned.
      Parameters:
      isSelfSigned - The value for isSelfSigned
      Returns:
      this builder for chained invocation
    • isSelfSigned

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies whether the certificate is self-signed, i.e., whether it is signed by the same entity whose identity it certifies.") public final X509Certificate.Builder isSelfSigned(Optional<Boolean> isSelfSigned)
      Initializes the optional value isSelfSigned to isSelfSigned.
      Parameters:
      isSelfSigned - The value for isSelfSigned
      Returns:
      this builder for use in a chained invocation
    • putHash

      @CanIgnoreReturnValue public final X509Certificate.Builder putHash(String key, String value)
      Put one entry to the hashes map.
      Parameters:
      key - The key in the hashes map
      value - The associated value in the hashes map
      Returns:
      this builder for use in a chained invocation
    • putHash

      @CanIgnoreReturnValue public final X509Certificate.Builder putHash(Map.Entry<String,? extends String> entry)
      Put one entry to the hashes map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • hashes

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies any hashes that were calculated for the entire contents of the certificate.") public final X509Certificate.Builder hashes(Map<String,? extends String> entries)
      Sets or replaces all mappings from the specified map as entries for the hashes map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the hashes map
      Returns:
      this builder for use in a chained invocation
    • putAllHashes

      @CanIgnoreReturnValue public final X509Certificate.Builder putAllHashes(Map<String,? extends String> entries)
      Put all mappings from the specified map as entries to hashes map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the hashes map
      Returns:
      this builder for use in a chained invocation
    • version

      @CanIgnoreReturnValue public final X509Certificate.Builder version(String version)
      Initializes the optional value version to version.
      Parameters:
      version - The value for version
      Returns:
      this builder for chained invocation
    • version

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the version of the encoded certificate.") public final X509Certificate.Builder version(Optional<String> version)
      Initializes the optional value version to version.
      Parameters:
      version - The value for version
      Returns:
      this builder for use in a chained invocation
    • serialNumber

      @CanIgnoreReturnValue public final X509Certificate.Builder serialNumber(String serialNumber)
      Initializes the optional value serialNumber to serialNumber.
      Parameters:
      serialNumber - The value for serialNumber
      Returns:
      this builder for chained invocation
    • serialNumber

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the unique identifier for the certificate, as issued by a specific Certificate Authority.") public final X509Certificate.Builder serialNumber(Optional<String> serialNumber)
      Initializes the optional value serialNumber to serialNumber.
      Parameters:
      serialNumber - The value for serialNumber
      Returns:
      this builder for use in a chained invocation
    • signatureAlgorithm

      @CanIgnoreReturnValue public final X509Certificate.Builder signatureAlgorithm(String signatureAlgorithm)
      Initializes the optional value signatureAlgorithm to signatureAlgorithm.
      Parameters:
      signatureAlgorithm - The value for signatureAlgorithm
      Returns:
      this builder for chained invocation
    • signatureAlgorithm

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the name of the algorithm used to sign the certificate.") public final X509Certificate.Builder signatureAlgorithm(Optional<String> signatureAlgorithm)
      Initializes the optional value signatureAlgorithm to signatureAlgorithm.
      Parameters:
      signatureAlgorithm - The value for signatureAlgorithm
      Returns:
      this builder for use in a chained invocation
    • issuer

      @CanIgnoreReturnValue public final X509Certificate.Builder issuer(String issuer)
      Initializes the optional value issuer to issuer.
      Parameters:
      issuer - The value for issuer
      Returns:
      this builder for chained invocation
    • issuer

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the name of the Certificate Authority that issued the certificate.") public final X509Certificate.Builder issuer(Optional<String> issuer)
      Initializes the optional value issuer to issuer.
      Parameters:
      issuer - The value for issuer
      Returns:
      this builder for use in a chained invocation
    • validityNotBefore

      @CanIgnoreReturnValue public final X509Certificate.Builder validityNotBefore(StixInstant validityNotBefore)
      Initializes the optional value validityNotBefore to validityNotBefore.
      Parameters:
      validityNotBefore - The value for validityNotBefore
      Returns:
      this builder for chained invocation
    • validityNotBefore

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the date on which the certificate validity period begins.") public final X509Certificate.Builder validityNotBefore(Optional<? extends StixInstant> validityNotBefore)
      Initializes the optional value validityNotBefore to validityNotBefore.
      Parameters:
      validityNotBefore - The value for validityNotBefore
      Returns:
      this builder for use in a chained invocation
    • validityNotAfter

      @CanIgnoreReturnValue public final X509Certificate.Builder validityNotAfter(StixInstant validityNotAfter)
      Initializes the optional value validityNotAfter to validityNotAfter.
      Parameters:
      validityNotAfter - The value for validityNotAfter
      Returns:
      this builder for chained invocation
    • validityNotAfter

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the date on which the certificate validity period ends.") public final X509Certificate.Builder validityNotAfter(Optional<? extends StixInstant> validityNotAfter)
      Initializes the optional value validityNotAfter to validityNotAfter.
      Parameters:
      validityNotAfter - The value for validityNotAfter
      Returns:
      this builder for use in a chained invocation
    • subject

      @CanIgnoreReturnValue public final X509Certificate.Builder subject(String subject)
      Initializes the optional value subject to subject.
      Parameters:
      subject - The value for subject
      Returns:
      this builder for chained invocation
    • subject

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the name of the entity associated with the public key stored in the subject public key field of the certificate.") public final X509Certificate.Builder subject(Optional<String> subject)
      Initializes the optional value subject to subject.
      Parameters:
      subject - The value for subject
      Returns:
      this builder for use in a chained invocation
    • subjectPublicKeyAlgorithm

      @CanIgnoreReturnValue public final X509Certificate.Builder subjectPublicKeyAlgorithm(String subjectPublicKeyAlgorithm)
      Initializes the optional value subjectPublicKeyAlgorithm to subjectPublicKeyAlgorithm.
      Parameters:
      subjectPublicKeyAlgorithm - The value for subjectPublicKeyAlgorithm
      Returns:
      this builder for chained invocation
    • subjectPublicKeyAlgorithm

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the name of the algorithm with which to encrypt data being sent to the subject.") public final X509Certificate.Builder subjectPublicKeyAlgorithm(Optional<String> subjectPublicKeyAlgorithm)
      Initializes the optional value subjectPublicKeyAlgorithm to subjectPublicKeyAlgorithm.
      Parameters:
      subjectPublicKeyAlgorithm - The value for subjectPublicKeyAlgorithm
      Returns:
      this builder for use in a chained invocation
    • subjectPublicKeyModulus

      @CanIgnoreReturnValue public final X509Certificate.Builder subjectPublicKeyModulus(String subjectPublicKeyModulus)
      Initializes the optional value subjectPublicKeyModulus to subjectPublicKeyModulus.
      Parameters:
      subjectPublicKeyModulus - The value for subjectPublicKeyModulus
      Returns:
      this builder for chained invocation
    • subjectPublicKeyModulus

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the modulus portion of the subject\u2019s public RSA key.") public final X509Certificate.Builder subjectPublicKeyModulus(Optional<String> subjectPublicKeyModulus)
      Initializes the optional value subjectPublicKeyModulus to subjectPublicKeyModulus.
      Parameters:
      subjectPublicKeyModulus - The value for subjectPublicKeyModulus
      Returns:
      this builder for use in a chained invocation
    • subjectPublicKeyExponent

      @CanIgnoreReturnValue public final X509Certificate.Builder subjectPublicKeyExponent(long subjectPublicKeyExponent)
      Initializes the optional value subjectPublicKeyExponent to subjectPublicKeyExponent.
      Parameters:
      subjectPublicKeyExponent - The value for subjectPublicKeyExponent
      Returns:
      this builder for chained invocation
    • subjectPublicKeyExponent

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies the exponent portion of the subject\u2019s public RSA key, as an integer.") public final X509Certificate.Builder subjectPublicKeyExponent(Optional<Long> subjectPublicKeyExponent)
      Initializes the optional value subjectPublicKeyExponent to subjectPublicKeyExponent.
      Parameters:
      subjectPublicKeyExponent - The value for subjectPublicKeyExponent
      Returns:
      this builder for use in a chained invocation
    • x509V3Extensions

      @CanIgnoreReturnValue public final X509Certificate.Builder x509V3Extensions(X509v3ExtensionsObj x509V3Extensions)
      Initializes the optional value x509V3Extensions to x509V3Extensions.
      Parameters:
      x509V3Extensions - The value for x509V3Extensions
      Returns:
      this builder for chained invocation
    • x509V3Extensions

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies any standard X.509 v3 extensions that may be used in the certificate.") public final X509Certificate.Builder x509V3Extensions(Optional<? extends X509v3ExtensionsObj> x509V3Extensions)
      Initializes the optional value x509V3Extensions to x509V3Extensions.
      Parameters:
      x509V3Extensions - The value for x509V3Extensions
      Returns:
      this builder for use in a chained invocation
    • type

      @CanIgnoreReturnValue public final X509Certificate.Builder type(String type)
      Initializes the value for the type attribute.
      Parameters:
      type - The value for type (can be null)
      Returns:
      this builder for use in a chained invocation
    • addExtension

      @CanIgnoreReturnValue public final X509Certificate.Builder addExtension(@Nullable CyberObservableExtension element)
      Adds one element to extensions set.
      Parameters:
      element - A extensions element
      Returns:
      this builder for use in a chained invocation
    • addExtensions

      @CanIgnoreReturnValue public final X509Certificate.Builder addExtensions(CyberObservableExtension... elements)
      Adds elements to extensions set.
      Parameters:
      elements - An array of extensions elements
      Returns:
      this builder for use in a chained invocation
    • extensions

      @CanIgnoreReturnValue @JsonPropertyDescription("Specifies any extensions of the object, as a dictionary.") public final X509Certificate.Builder extensions(Iterable<? extends CyberObservableExtension> elements)
      Sets or replaces all elements for extensions set.
      Parameters:
      elements - An iterable of extensions elements
      Returns:
      this builder for use in a chained invocation
    • addAllExtensions

      @CanIgnoreReturnValue public final X509Certificate.Builder addAllExtensions(Iterable<? extends CyberObservableExtension> elements)
      Adds elements to extensions set.
      Parameters:
      elements - An iterable of extensions elements
      Returns:
      this builder for use in a chained invocation
    • observableObjectKey

      @CanIgnoreReturnValue public final X509Certificate.Builder observableObjectKey(String observableObjectKey)
      Initializes the value for the observableObjectKey attribute.

      If not set, this attribute will have a default value as returned by the initializer of observableObjectKey.

      Parameters:
      observableObjectKey - The value for observableObjectKey
      Returns:
      this builder for use in a chained invocation
    • defanged

      @CanIgnoreReturnValue public final X509Certificate.Builder defanged(boolean defanged)
      Initializes the optional value defanged to defanged.
      Parameters:
      defanged - The value for defanged
      Returns:
      this builder for chained invocation
    • defanged

      @CanIgnoreReturnValue @JsonPropertyDescription("Indicates whether the data contained in the SCO has been defanged.") public final X509Certificate.Builder defanged(Optional<Boolean> defanged)
      Initializes the optional value defanged to defanged.
      Parameters:
      defanged - The value for defanged
      Returns:
      this builder for use in a chained invocation
    • putCustomProperty

      @CanIgnoreReturnValue public final X509Certificate.Builder putCustomProperty(String key, Object value)
      Put one entry to the customProperties map.
      Parameters:
      key - The key in the customProperties map
      value - The associated value in the customProperties map
      Returns:
      this builder for use in a chained invocation
    • putCustomProperty

      @CanIgnoreReturnValue public final X509Certificate.Builder putCustomProperty(Map.Entry<String,? extends Object> entry)
      Put one entry to the customProperties map. Nulls are not permitted
      Parameters:
      entry - The key and value entry
      Returns:
      this builder for use in a chained invocation
    • customProperties

      @CanIgnoreReturnValue public final X509Certificate.Builder customProperties(Map<String,? extends Object> entries)
      Sets or replaces all mappings from the specified map as entries for the customProperties map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the customProperties map
      Returns:
      this builder for use in a chained invocation
    • putAllCustomProperties

      @CanIgnoreReturnValue public final X509Certificate.Builder putAllCustomProperties(Map<String,? extends Object> entries)
      Put all mappings from the specified map as entries to customProperties map. Nulls are not permitted
      Parameters:
      entries - The entries that will be added to the customProperties map
      Returns:
      this builder for use in a chained invocation
    • addObjectMarkingRef

      @CanIgnoreReturnValue public final X509Certificate.Builder addObjectMarkingRef(@Nullable MarkingDefinitionDm element)
      Adds one element to objectMarkingRefs set.
      Parameters:
      element - A objectMarkingRefs element
      Returns:
      this builder for use in a chained invocation
    • addObjectMarkingRefs

      @CanIgnoreReturnValue public final X509Certificate.Builder addObjectMarkingRefs(MarkingDefinitionDm... elements)
      Adds elements to objectMarkingRefs set.
      Parameters:
      elements - An array of objectMarkingRefs elements
      Returns:
      this builder for use in a chained invocation
    • objectMarkingRefs

      @CanIgnoreReturnValue public final X509Certificate.Builder objectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements)
      Sets or replaces all elements for objectMarkingRefs set.
      Parameters:
      elements - An iterable of objectMarkingRefs elements
      Returns:
      this builder for use in a chained invocation
    • addAllObjectMarkingRefs

      @CanIgnoreReturnValue public final X509Certificate.Builder addAllObjectMarkingRefs(Iterable<? extends MarkingDefinitionDm> elements)
      Adds elements to objectMarkingRefs set.
      Parameters:
      elements - An iterable of objectMarkingRefs elements
      Returns:
      this builder for use in a chained invocation
    • addGranularMarking

      @CanIgnoreReturnValue public final X509Certificate.Builder addGranularMarking(@Nullable GranularMarkingDm element)
      Adds one element to granularMarkings set.
      Parameters:
      element - A granularMarkings element
      Returns:
      this builder for use in a chained invocation
    • addGranularMarkings

      @CanIgnoreReturnValue public final X509Certificate.Builder addGranularMarkings(GranularMarkingDm... elements)
      Adds elements to granularMarkings set.
      Parameters:
      elements - An array of granularMarkings elements
      Returns:
      this builder for use in a chained invocation
    • granularMarkings

      @CanIgnoreReturnValue public final X509Certificate.Builder granularMarkings(Iterable<? extends GranularMarkingDm> elements)
      Sets or replaces all elements for granularMarkings set.
      Parameters:
      elements - An iterable of granularMarkings elements
      Returns:
      this builder for use in a chained invocation
    • addAllGranularMarkings

      @CanIgnoreReturnValue public final X509Certificate.Builder addAllGranularMarkings(Iterable<? extends GranularMarkingDm> elements)
      Adds elements to granularMarkings set.
      Parameters:
      elements - An iterable of granularMarkings elements
      Returns:
      this builder for use in a chained invocation
    • hydrated

      @CanIgnoreReturnValue public final X509Certificate.Builder hydrated(boolean hydrated)
      Initializes the value for the hydrated attribute.
      Parameters:
      hydrated - The value for hydrated
      Returns:
      this builder for use in a chained invocation
    • toJsonString

      @CanIgnoreReturnValue public final X509Certificate.Builder toJsonString(String toJsonString)
      Initializes the value for the toJsonString attribute.
      Parameters:
      toJsonString - The value for toJsonString (can be null)
      Returns:
      this builder for use in a chained invocation
    • build

      public X509Certificate build()
      Builds a new X509Certificate.
      Returns:
      An immutable instance of X509Certificate
      Throws:
      IllegalStateException - if any required attributes are missing