django-ca icon indicating copy to clipboard operation
django-ca copied to clipboard

TypeError: cannot pickle 'builtins.ObjectIdentifier' object

Open jacekjaros opened this issue 3 years ago • 2 comments

hi,

i'm try to run django-ca using https://django-ca.readthedocs.io/en/latest/quickstart_from_source.html

after running django-ca init_ca --pathlen=1 Root "/CN=my_page_root_CA" i get following error:

Traceback (most recent call last):
  File "/opt/django-ca/src/django-ca/ca/manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/django-ca/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/opt/django-ca/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/django-ca/venv/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/django-ca/venv/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/opt/django-ca/src/django-ca-1.21.0/ca/django_ca/management/commands/init_ca.py", line 286, in handle
    run_task(generate_ocsp_key, serial=ca.serial, password=password)
  File "/opt/django-ca/src/django-ca-1.21.0/ca/django_ca/tasks.py", line 71, in run_task
    return task(*args, **kwargs)
  File "/opt/django-ca/src/django-ca-1.21.0/ca/django_ca/tasks.py", line 117, in generate_ocsp_key
    private_path, cert_path, cert = ca.generate_ocsp_key(
  File "/opt/django-ca/src/django-ca-1.21.0/ca/django_ca/models.py", line 993, in generate_ocsp_key
    cert = Certificate.objects.create_cert(
  File "/opt/django-ca/src/django-ca-1.21.0/ca/django_ca/managers.py", line 638, in create_cert
    cert = profile.create_cert(ca, csr, **kwargs)
  File "/opt/django-ca/src/django-ca-1.21.0/ca/django_ca/profiles.py", line 265, in create_cert
    cert_extensions = deepcopy(self.extensions)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 271, in _reconstruct
    state = deepcopy(state, memo)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 265, in _reconstruct
    y = func(*args)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 264, in <genexpr>
    args = (deepcopy(arg, memo) for arg in args)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 206, in _deepcopy_list
    append(deepcopy(a, memo))
  File "/opt/python/v3.10/lib/python3.10/copy.py", line 161, in deepcopy
    rv = reductor(4)
TypeError: cannot pickle 'builtins.ObjectIdentifier' object

i'm using python v3.10.7 and ubuntu 22.04

jacekjaros avatar Sep 11 '22 14:09 jacekjaros

Hi!

This is due to pyca/cryptography#7587. For now you'll need to use cryptography<38 to use this project.

kr, Mat

mathiasertl avatar Sep 11 '22 15:09 mathiasertl

PS: I am of course working on making it compatible again.

mathiasertl avatar Sep 11 '22 15:09 mathiasertl

django-ca 1.23 is now compatible with cryptography 38!

mathiasertl avatar Dec 13 '22 21:12 mathiasertl