certapi 0.4.7__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. {certapi-0.4.7/src/certapi.egg-info → certapi-0.5.0}/PKG-INFO +3 -1
  2. {certapi-0.4.7 → certapi-0.5.0}/README.md +3 -1
  3. {certapi-0.4.7 → certapi-0.5.0}/setup.py +1 -1
  4. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/__init__.py +1 -1
  5. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/acme/Acme.py +4 -4
  6. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/acme/http.py +3 -0
  7. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/ChallengeSolver.py +1 -1
  8. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/client/cert_manager_client.py +1 -1
  9. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/crypto/crypto.py +0 -1
  10. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/issuers/AcmeCertIssuer.py +3 -2
  11. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/manager/acme_cert_manager.py +3 -3
  12. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/server/api.py +1 -1
  13. {certapi-0.4.7 → certapi-0.5.0/src/certapi.egg-info}/PKG-INFO +3 -1
  14. {certapi-0.4.7 → certapi-0.5.0}/MANIFEST.in +0 -0
  15. {certapi-0.4.7 → certapi-0.5.0}/pyproject.toml +0 -0
  16. {certapi-0.4.7 → certapi-0.5.0}/setup.cfg +0 -0
  17. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/acme/AcmeError.py +0 -0
  18. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/acme/Challenge.py +0 -0
  19. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/acme/Order.py +0 -0
  20. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/acme/__init__.py +0 -0
  21. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/FileSystemChallengeSolver.py +0 -0
  22. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/InmemoryChallengeSolver.py +0 -0
  23. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/__init__.py +0 -0
  24. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/dns/__init__.py +0 -0
  25. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/dns/cloudflare/__init__.py +0 -0
  26. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/dns/cloudflare/cloudflare_challenge_solver.py +0 -0
  27. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/dns/cloudflare/cloudflare_client.py +0 -0
  28. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/dns/digitalocean/__init__.py +0 -0
  29. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/dns/digitalocean/digitalocean_challenge_solver.py +0 -0
  30. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/challenge_solver/dns/digitalocean/digitalocean_client.py +0 -0
  31. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/client/__init__.py +0 -0
  32. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/crypto/__init__.py +0 -0
  33. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/crypto/crypto_classes.py +0 -0
  34. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/errors.py +0 -0
  35. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/http/HttpClientBase.py +0 -0
  36. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/http/__init__.py +0 -0
  37. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/http/types.py +0 -0
  38. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/issuers/SelfCertIssuer.py +0 -0
  39. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/issuers/__init__.py +0 -0
  40. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/issuers/abstract_certissuer.py +0 -0
  41. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/keystore/FileSystemKeyStore.py +0 -0
  42. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/keystore/KeyStore.py +0 -0
  43. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/keystore/PostgresqlKeyStore.py +0 -0
  44. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/keystore/RemoteKeyStore.py +0 -0
  45. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/keystore/SqliteKeyStore.py +0 -0
  46. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/keystore/__init__.py +0 -0
  47. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/manager/__init__.py +0 -0
  48. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/server/__init__.py +0 -0
  49. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/server/cert_api.py +0 -0
  50. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/server/key_api.py +0 -0
  51. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/util.py +0 -0
  52. {certapi-0.4.7 → certapi-0.5.0}/src/certapi/utils.py +0 -0
  53. {certapi-0.4.7 → certapi-0.5.0}/src/certapi.egg-info/SOURCES.txt +0 -0
  54. {certapi-0.4.7 → certapi-0.5.0}/src/certapi.egg-info/dependency_links.txt +0 -0
  55. {certapi-0.4.7 → certapi-0.5.0}/src/certapi.egg-info/requires.txt +0 -0
  56. {certapi-0.4.7 → certapi-0.5.0}/src/certapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: certapi
3
- Version: 0.4.7
3
+ Version: 0.5.0
4
4
  Summary: Python Package for managing keys, request SSL certificates from ACME.
5
5
  Home-page: https://github.com/mesudip/certapi
6
6
  Author: Sudip Bhattarai
@@ -18,6 +18,8 @@ This is to be used as a base library for building other tools, or to integrate C
18
18
 
19
19
  > ⚠️ Warning: This project is in beta. Please stay tuned for the LTS `v1.0.0` release.
20
20
 
21
+ For a detailed list of changes, please refer to the [CHANGELOG.md](CHANGELOG.md).
22
+
21
23
  ## Installation
22
24
 
23
25
  You can install CertApi using pip
@@ -5,6 +5,8 @@ This is to be used as a base library for building other tools, or to integrate C
5
5
 
6
6
  > ⚠️ Warning: This project is in beta. Please stay tuned for the LTS `v1.0.0` release.
7
7
 
8
+ For a detailed list of changes, please refer to the [CHANGELOG.md](CHANGELOG.md).
9
+
8
10
  ## Installation
9
11
 
10
12
  You can install CertApi using pip
@@ -47,4 +49,4 @@ except CertApiException as e:
47
49
  ## Example: Use High Leve API
48
50
 
49
51
  ```
50
- ```
52
+ ```
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="certapi",
5
- version="0.4.7",
5
+ version="0.5.0",
6
6
  packages=find_packages(where="src"),
7
7
  package_dir={"": "src"},
8
8
  install_requires=[
@@ -1,4 +1,4 @@
1
- from .acme.Acme import Acme, Order, AcmeNetworkError, AcmeHttpError,AcmeError, Challenge
1
+ from .acme.Acme import Acme, Order, AcmeNetworkError, AcmeHttpError, AcmeError, Challenge
2
2
  from .manager.acme_cert_manager import AcmeCertManager
3
3
  from .http.types import CertificateResponse, IssuedCert
4
4
  from .errors import CertApiException
@@ -93,9 +93,9 @@ class Acme:
93
93
  return response
94
94
 
95
95
  def _signed_req(
96
- self, url, payload: Union[str, dict, list, bytes, None] = None, depth=0, step="Acme Request", throw=True
96
+ self, url, req_payload: Union[str, dict, list, bytes, None] = None, depth=0, step="Acme Request", throw=True
97
97
  ) -> requests.Response:
98
- payload64 = b64_encode(payload) if payload is not None else b""
98
+ payload64 = b64_encode(req_payload) if req_payload is not None else b""
99
99
 
100
100
  protected = {
101
101
  "url": url,
@@ -118,9 +118,9 @@ class Acme:
118
118
 
119
119
  response = post(step, url, json=payload, headers={"Content-Type": "application/jose+json"}, throw=throw)
120
120
  except AcmeError as e:
121
- if e.can_retry and depth <= 0:
121
+ if e.can_retry and depth <= 1:
122
122
  time.sleep(2)
123
- return self._signed_req(url, payload, depth + 1, step, throw)
123
+ return self._signed_req(url, req_payload, depth + 1, step, throw)
124
124
  else:
125
125
  raise e
126
126
 
@@ -1,5 +1,6 @@
1
1
  import requests
2
2
  from .AcmeError import *
3
+ import json as j
3
4
 
4
5
 
5
6
  def request(method, step: str, url: str, json=None, headers=None, throw=True) -> requests.Response:
@@ -21,6 +22,8 @@ def request(method, step: str, url: str, json=None, headers=None, throw=True) ->
21
22
  step,
22
23
  )
23
24
  if 199 <= res.status_code > 299:
25
+ if json:
26
+ print("Request:", j.dumps(json))
24
27
  [print(x, y) for (x, y) in res.headers.items()]
25
28
  print("Response:", res.text)
26
29
  json_data = None
@@ -6,7 +6,7 @@ from typing import Literal
6
6
 
7
7
  class ChallengeSolver(ABC):
8
8
  """
9
- Abstract base class for a challenge store.
9
+ Abstract base class for a challenge solver.
10
10
  """
11
11
 
12
12
  @abstractmethod
@@ -27,7 +27,7 @@ class CertManagerClient:
27
27
  def obtain_certificate(
28
28
  self,
29
29
  hostnames: Union[str, List[str]],
30
- key_type: str = "rsa",
30
+ key_type: str = "ecdsa",
31
31
  expiry_days: int = 90,
32
32
  country: Optional[str] = None,
33
33
  state: Optional[str] = None,
@@ -181,7 +181,6 @@ def digest_sha256(data: bytes) -> bytes:
181
181
  def get_csr_hostnames(csr: x509.CertificateSigningRequest):
182
182
 
183
183
  domains = []
184
-
185
184
  common_names = [attr.value for attr in csr.subject.get_attributes_for_oid(NameOID.COMMON_NAME)]
186
185
  if common_names:
187
186
  cn = common_names[0]
@@ -55,11 +55,12 @@ class AcmeCertIssuer(CertIssuer):
55
55
 
56
56
  # acme can use our key and immediately allow certificate registration if we have recently proved domain ownership.
57
57
  if len(challenges) > 0 and challenge_solver.supported_challenge_type() == "dns-01":
58
- print("Waiting 10 seconds for DNS propagation .. ")
59
- time.sleep(10) # sleep 7 seconds for dns propagation
58
+ print("Waiting 20 seconds for DNS propagation .. ")
59
+ time.sleep(20) # sleep 20 seconds for dns propagation
60
60
 
61
61
  for c in challenges:
62
62
  c.verify(challenge_solver.supported_challenge_type())
63
+
63
64
  while len(remaining_now) > 0:
64
65
  if time.time() > end and counter > 4:
65
66
  print("Order finalization time out")
@@ -36,7 +36,7 @@ class AcmeCertManager:
36
36
  if not hostnames:
37
37
  raise ValueError("CSR does not contain any hostnames.")
38
38
 
39
- # Find a challenge store that supports all hostnames in the CSR
39
+ # Find a challenge solver that supports all hostnames in the CSR
40
40
  selected_challenge_solver = None
41
41
  for store in self.challenge_solvers:
42
42
  if all(store.supports_domain(h) for h in hostnames):
@@ -44,7 +44,7 @@ class AcmeCertManager:
44
44
  break
45
45
 
46
46
  if selected_challenge_solver is None:
47
- raise ValueError(f"No challenge store found that supports all domains: {hostnames}")
47
+ raise ValueError(f"No challenge solver found that supports all domains: {hostnames}")
48
48
 
49
49
  fullchain_cert = self.cert_issuer.sign_csr(csr, challenge_solver=selected_challenge_solver)
50
50
  if fullchain_cert:
@@ -81,7 +81,7 @@ class AcmeCertManager:
81
81
  missing = [h for h in hosts if h not in existing]
82
82
  if len(missing) > 0:
83
83
  issued_certs_list = []
84
- # Group missing hosts by the challenge store that supports them
84
+ # Group missing hosts by the challenge solver that supports them
85
85
  domains_by_store: Dict[ChallengeSolver, List[str]] = {}
86
86
  for host in missing:
87
87
  found_store = None
@@ -38,7 +38,7 @@ def create_api_resources(api_ns, cert_manager: AcmeCertManager):
38
38
  obtain_parser.add_argument(
39
39
  "hostname", type=str, action="append", required=True, help="List of hostnames for the certificate"
40
40
  )
41
- obtain_parser.add_argument("key_type", type=str, default="rsa", help="Type of key (rsa or ecdsa)")
41
+ obtain_parser.add_argument("key_type", type=str, default="ecdsa", help="Type of key (rsa or ecdsa)")
42
42
  obtain_parser.add_argument("expiry_days", type=int, default=90, help="Number of days until certificate expiry")
43
43
  obtain_parser.add_argument("country", type=str, help="Country name")
44
44
  obtain_parser.add_argument("state", type=str, help="State or province name")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: certapi
3
- Version: 0.4.7
3
+ Version: 0.5.0
4
4
  Summary: Python Package for managing keys, request SSL certificates from ACME.
5
5
  Home-page: https://github.com/mesudip/certapi
6
6
  Author: Sudip Bhattarai
@@ -18,6 +18,8 @@ This is to be used as a base library for building other tools, or to integrate C
18
18
 
19
19
  > ⚠️ Warning: This project is in beta. Please stay tuned for the LTS `v1.0.0` release.
20
20
 
21
+ For a detailed list of changes, please refer to the [CHANGELOG.md](CHANGELOG.md).
22
+
21
23
  ## Installation
22
24
 
23
25
  You can install CertApi using pip
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes