ExAcme.RevocationBuilder (ExAcme v0.3.0)

View Source

Provides functionality to build ACME certificate revocation requests.

Use this module to construct a revocation request by supplying the certificate in one of several formats (X509.Certificate struct, DER binary, or PEM string) and an optional revocation reason.

Summary

Types

t()

A certificate revocation builder

Functions

Sets the certificate for revocation using an X509 certificate struct.

Sets the certificate for revocation using a DER-encoded binary.

Sets the certificate for revocation using a PEM-encoded string.

Creates a new revocation builder.

Sets the revocation reason.

Converts the revocation builder to a map.

Types

t()

@type t() :: %ExAcme.RevocationBuilder{
  certificate: binary() | nil,
  reason: integer() | nil
}

A certificate revocation builder

Functions

certificate(revocation, certificate)

@spec certificate(t(), X509.Certificate.t()) :: t()

Sets the certificate for revocation using an X509 certificate struct.

Parameters

  • revocation: The current revocation builder.
  • certificate: An X509.Certificate struct representing the certificate to revoke.

Returns

certificate_der(revocation, der)

@spec certificate_der(t(), binary()) :: t()

Sets the certificate for revocation using a DER-encoded binary.

Parameters

  • revocation: The current revocation builder.
  • der: A binary containing the DER-encoded certificate.

Returns

certificate_pem(revocation, pem)

@spec certificate_pem(t(), String.t()) :: t()

Sets the certificate for revocation using a PEM-encoded string.

Parameters

  • revocation: The current revocation builder.
  • pem: A string containing the PEM-encoded certificate.

Returns

  • {:ok, revocation} if successful and the PEM certificate is valid.
  • {:error, reason} if the PEM certificate is invalid.

new_revocation()

@spec new_revocation() :: t()

Creates a new revocation builder.

Returns

reason(revocation, reason)

@spec reason(
  t(),
  :unspecified
  | :key_compromise
  | :affiliation_changed
  | :superseded
  | :cessation_of_operation
  | integer()
) :: t()

Sets the revocation reason.

Accepts either a named reason or a numeric reason code as defined in RFC 5280.

Parameters

  • revocation: The current revocation builder.
  • reason: An atom representing the reason (:unspecified, :key_compromise, :affiliation_changed, :superseded, or :cessation_of_operation) or an integer code.

Returns

to_map(revocation)

@spec to_map(t()) :: map()

Converts the revocation builder to a map.

Removes any keys with nil values and converts all keys to camelCase for API compatibility.

Parameters

  • revocation: The revocation builder struct.

Returns

  • A map representing the revocation request.