#7697 ipa ca-show --certificate-out is broken on python3
Closed: duplicate Opened by bartoc.

Issue

ipa ca-show --certificate-out=... fails with python3

Steps to Reproduce

  1. join a domain on a mcahine where ipa uses python3
  2. use ipa ca-show ipa --certificate-out=/some/path/you/can/write/to.pem
  3. observe bug

Actual behavior

ipa: ERROR: non-public: TypeError: initializer for ctype 'char[]' must be a bytes or list or tuple, not str
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/ipalib/backend.py", line 141, in execute
    return self.Command[_name](*args, **options)
  File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 450, in __call__
    return self.__do_call(*args, **options)
  File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 478, in __do_call
    ret = self.run(*args, **options)
  File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 801, in run
    return self.forward(*args, **options)
  File "/usr/lib/python3.6/site-packages/ipaclient/plugins/ca.py", line 42, in forward
    result['result']['certificate'])
  File "/usr/lib/python3.6/site-packages/ipalib/x509.py", line 406, in load_der_x509_certificate
    crypto_x509.load_der_x509_certificate(data, backend=default_backend())
  File "/usr/lib64/python3.6/site-packages/cryptography/x509/base.py", line 47, in load_der_x509_certificate
    return backend.load_der_x509_certificate(data)
  File "/usr/lib64/python3.6/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 1144, in load_der_x509_certificate
    mem_bio = self._bytes_to_bio(data)
  File "/usr/lib64/python3.6/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 436, in _bytes_to_bio
    data_char_p = self._ffi.new("char[]", data)
TypeError: initializer for ctype 'char[]' must be a bytes or list or tuple, not str
ipa: ERROR: an internal error has occurred

Expected behavior

Expect output like ipa-ca show ipa and a pem certificate at the path specified

Version/Release/Distribution

freeipa-client-4.7.0-1.fc28.x86_64


Duplicate of #7628.

Metadata Update from @abiagion:
- Issue close_status updated to: duplicate
- Issue status updated to: Closed (was: Open)

Metadata