Messages

ACME protocol messages.

acme.messages.is_acme_error(err)[source]

Check if argument is an ACME error.

exception acme.messages.Error(**kwargs)[source]

ACME error.

https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00

Variables
  • typ (unicode) –

  • title (unicode) –

  • detail (unicode) –

classmethod with_code(code, **kwargs)[source]

Create an Error instance with an ACME Error code.

Unicode code

An ACME error code, like ‘dnssec’.

Kwargs

kwargs to pass to Error.

property description

Hardcoded error description based on its type.

Returns

Description if standard ACME error or None.

Return type

unicode

property code

ACME error code.

Basically self.typ without the ERROR_PREFIX.

Returns

error code if standard ACME code or None.

Return type

unicode

class acme.messages.Status(name)[source]

ACME “status” field.

class acme.messages.IdentifierType(name)[source]

ACME identifier type.

class acme.messages.Identifier(**kwargs)[source]

ACME identifier.

Variables
class acme.messages.Directory(jobj)[source]

Directory.

class Meta(**kwargs)[source]

Directory Meta.

property terms_of_service

URL for the CA TOS

classmethod register(resource_body_cls)[source]

Register resource.

to_partial_json()[source]

Partially serialize.

Following the example, partial serialization means the following:

assert isinstance(Bar().to_partial_json()[0], Foo)
assert isinstance(Bar().to_partial_json()[1], Foo)

# in particular...
assert Bar().to_partial_json() != ['foo', 'foo']
Raises

josepy.errors.SerializationError – in case of any serialization error.

Returns

Partially serializable object.

classmethod from_json(jobj)[source]

Deserialize a decoded JSON document.

Parameters

jobj – Python object, composed of only other basic data types, as decoded from JSON document. Not necessarily dict (as decoded from “JSON object” document).

Raises

josepy.errors.DeserializationError – if decoding was unsuccessful, e.g. in case of unparseable X509 certificate, or wrong padding in JOSE base64 encoded string, etc.

class acme.messages.Resource(**kwargs)[source]

ACME Resource.

Variables

body (acme.messages.ResourceBody) – Resource body.

class acme.messages.ResourceWithURI(**kwargs)[source]

ACME Resource with URI.

Variables

uri (unicode) – Location of the resource.

class acme.messages.ResourceBody(**kwargs)[source]

ACME Resource Body.

class acme.messages.ExternalAccountBinding[source]

ACME External Account Binding

classmethod from_data(account_public_key, kid, hmac_key, directory)[source]

Create External Account Binding Resource from contact details, kid and hmac.

class acme.messages.Registration(**kwargs)[source]

Registration Resource Body.

Variables
  • key (josepy.jwk.JWK) – Public key.

  • contact (tuple) – Contact information following ACME spec, tuple of unicode.

  • agreement (unicode) –

classmethod from_data(phone=None, email=None, external_account_binding=None, **kwargs)[source]

Create registration resource from contact details.

property phones

All phones found in the contact field.

property emails

All emails found in the contact field.

class acme.messages.NewRegistration(**kwargs)[source]

New registration.

class acme.messages.UpdateRegistration(**kwargs)[source]

Update registration.

class acme.messages.RegistrationResource(**kwargs)[source]

Registration Resource.

Variables
class acme.messages.ChallengeBody(**kwargs)[source]

Challenge Resource Body.

Variables
encode(name)[source]

Encode a single field.

Parameters

name (str) – Name of the field to be encoded.

Raises
  • errors.SerializationError – if field cannot be serialized

  • errors.Error – if field could not be found

to_partial_json()[source]

Partially serialize.

Following the example, partial serialization means the following:

assert isinstance(Bar().to_partial_json()[0], Foo)
assert isinstance(Bar().to_partial_json()[1], Foo)

# in particular...
assert Bar().to_partial_json() != ['foo', 'foo']
Raises

josepy.errors.SerializationError – in case of any serialization error.

Returns

Partially serializable object.

classmethod fields_from_json(jobj)[source]

Deserialize fields from JSON.

property uri

The URL of this challenge.

class acme.messages.ChallengeResource(**kwargs)[source]

Challenge Resource.

Variables
property uri

The URL of the challenge body.

class acme.messages.Authorization(**kwargs)[source]

Authorization Resource Body.

Variables
property resolved_combinations

Combinations with challenges instead of indices.

class acme.messages.NewAuthorization(**kwargs)[source]

New authorization.

class acme.messages.UpdateAuthorization(**kwargs)[source]

Update authorization.

class acme.messages.AuthorizationResource(**kwargs)[source]

Authorization Resource.

Variables
class acme.messages.CertificateRequest(**kwargs)[source]

ACME new-cert request.

Variables

csr (josepy.util.ComparableX509) – OpenSSL.crypto.X509Req wrapped in ComparableX509

class acme.messages.CertificateResource(**kwargs)[source]

Certificate Resource.

Variables
  • body (josepy.util.ComparableX509) – OpenSSL.crypto.X509 wrapped in ComparableX509

  • cert_chain_uri (unicode) – URI found in the ‘up’ Link header

  • authzrs (tuple) – tuple of AuthorizationResource.

class acme.messages.Revocation(**kwargs)[source]

Revocation message.

Variables

certificate (ComparableX509) – OpenSSL.crypto.X509 wrapped in ComparableX509

class acme.messages.Order(**kwargs)[source]

Order Resource Body.

Variables
  • identifiers (list of Identifier) – List of identifiers for the certificate.

  • status (acme.messages.Status) –

  • authorizations (list of str) – URLs of authorizations.

  • certificate (str) – URL to download certificate as a fullchain PEM.

  • finalize (str) – URL to POST to to request issuance once all authorizations have “valid” status.

  • expires (datetime.datetime) – When the order expires.

  • error (Error) – Any error that occurred during finalization, if applicable.

class acme.messages.OrderResource(**kwargs)[source]

Order Resource.

Variables
  • body (acme.messages.Order) –

  • csr_pem (str) – The CSR this Order will be finalized with.

  • authorizations (list of acme.messages.AuthorizationResource) – Fully-fetched AuthorizationResource objects.

  • fullchain_pem (str) – The fetched contents of the certificate URL produced once the order was finalized, if it’s present.

  • alternative_fullchains_pem (list of str) – The fetched contents of alternative certificate chain URLs produced once the order was finalized, if present and requested during finalization.

class acme.messages.NewOrder(**kwargs)[source]

New order.