Error while importing certificates

Description

I'm always getting python decoding errors when trying to import the public key of a CA.
The Organization name of the cert contains the Umlauts 'ü', which i suspect is the problem.

I don't know of it helps, but i can successfully import the same cert in pfsense which is based on ( FreeBSD 11.3-STABLE )

The problematic public key in pem format is attached

The error message looks like this:

Error: Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 137, in call_method
result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self,
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1191, in _call
return await methodobj(*prepared_call.args)
File "/usr/local/lib/python3.8/site-packages/middlewared/service.py", line 455, in create
rv = await self.middleware._call(
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1191, in _call
return await methodobj(*prepared_call.args)
File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 973, in nf
return await f(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 2419, in do_create
verrors = await self.validate_common_attributes(data, 'certificate_authority_create')
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 2234, in validate_common_attributes
await _validate_common_attributes(self.middleware, data, verrors, schema_name)
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 97, in _validate_common_attributes
if not matches or not await middleware.call('cryptokey.load_certificate', certificate):
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1233, in call
return await self._call(
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1202, in _call
return await self.run_in_executor(prepared_call.executor, methodobj, *prepared_call.args)
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1106, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
File "/usr/local/lib/python3.8/site-packages/middlewared/utils/io_thread_pool_executor.py", line 25, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 977, in nf
return f(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 379, in load_certificate
cert_info = self.get_x509_subject(cert)
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 452, in get_x509_subject
dn.append(f'{k.decode()}={v.decode()}')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 7: invalid start byte

Problem/Justification

None

Impact

None

SmartDraw Connector

Katalon Manual Tests (BETA)

Activity

Show:

Bug Clerk May 6, 2021 at 12:15 AM

William Gryzbowski May 4, 2021 at 12:19 PM

The fix was not merged to 12.0 yet.

Thomas Kempf May 4, 2021 at 5:34 AM

Seems, as if this issue is still the same in 12.0-U3

I installed 12.0-U3 from scratch and tried to import the CA hueperca.pem and get exact the same error ?!

 

 

Error: Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 137, in call_method
result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self,
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1195, in _call
return await methodobj(*prepared_call.args)
File "/usr/local/lib/python3.8/site-packages/middlewared/service.py", line 465, in create
rv = await self.middleware._call(
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1195, in _call
return await methodobj(*prepared_call.args)
File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 973, in nf
return await f(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 2429, in do_create
verrors = await self.validate_common_attributes(data, 'certificate_authority_create')
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 2244, in validate_common_attributes
await _validate_common_attributes(self.middleware, data, verrors, schema_name)
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 97, in _validate_common_attributes
if not matches or not await middleware.call('cryptokey.load_certificate', certificate):
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1238, in call
return await self._call(
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1206, in _call
return await self.run_in_executor(prepared_call.executor, methodobj, *prepared_call.args)
File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1110, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
File "/usr/local/lib/python3.8/site-packages/middlewared/utils/io_thread_pool_executor.py", line 25, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 977, in nf
return f(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 379, in load_certificate
cert_info = self.get_x509_subject(cert)
File "/usr/local/lib/python3.8/site-packages/middlewared/plugins/crypto.py", line 452, in get_x509_subject
dn.append(f'{k.decode()}={v.decode()}')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfc in position 7: invalid start byte

Bug Clerk January 22, 2021 at 11:13 AM

Thomas Kempf January 19, 2021 at 2:27 PM

Hi Bonnie,

debug is attached

Complete

Details

Assignee

Reporter

Labels

Impact

Medium

Components

Priority

More fields

Katalon Platform

Created January 19, 2021 at 8:26 AM
Updated July 1, 2022 at 5:14 PM
Resolved May 6, 2021 at 2:31 PM