You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use template for CA API (and configurable subject encoding)聽#2653
If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
Issue details
I am working with a constrained CA that uses the UTF-8 encoding. The name constraints dictate that the subject must be under one of two allowed base DNs.
DC=org,DC=example
O=Example Org,OU=Branch Office
To be valid, my leafs must use a subject like
O=Example Org,OU=Branch Office,CN=Webservice + for example SAN www.example.org
or
O=Example Org,OU=Branch Office,CN=www.example.org
As discussed in #1917, step-ca can only issue certificates using the PrintableString encoding, meaning all certificate are invalid.
Firefox rejects them with SEC_ERROR_CERT_NOT_IN_NAME_SPACE
My preferred fix would be to make the encoding either globally or per field configurable.
An alternative solution I have considered is the use of the subject.ExtraNames which seem to be a workaround for more complex DNs but I don't know how they are correctly used in the template.
Why is this needed?
Step CA is currently unable to issue valid certificates in my environment.
So if I got this right the "authority" level "template" is different from the provisioner level "template". At least that gives me a bit of an explanation why I haven't seen my template used at all. Step-CA is unable to issue a valid cert for itself and acme clients refuse to connect due to the invalid cert. Therefore I only tried connecting directly to step to check my certs.
Now I still didn't get it to issue any DN values of my choice but if I am correct, the effort is futile anyways because the server certificate step issues for itself is also required to contain an explicit policy, which, given the different template struct, is impossible.
After opening the issue for the initial suspect of subject encoding I discovered that the issue is a bit deeper as is apparent from my other comments. If it is of any value, I can try to reword the opening comment. ^^
Activity
Gabgobie commentedon Apr 17, 2026
Maybe this can be achieved per field using asn1enc but I think this would still not solve the re-encoding of the CN field.
asn1Enc "utf8:foobar"Edit:
Possibly by wrapping it in the marshall thing?
(asn1Marshal (.Insecure.CR.Subject.CommonName) "utf8")or similar?Gabgobie commentedon Apr 17, 2026
Edit: I didn't get it quite right, see the below comment.
certificates/authority/config/config.go
Lines 143 to 172 in 14f4ad7
So if I got this right the "authority" level "template" is different from the provisioner level "template". At least that gives me a bit of an explanation why I haven't seen my template used at all. Step-CA is unable to issue a valid cert for itself and acme clients refuse to connect due to the invalid cert. Therefore I only tried connecting directly to step to check my certs.
Now I still didn't get it to issue any DN values of my choice but if I am correct, the effort is futile anyways because the server certificate step issues for itself is also required to contain an explicit policy, which, given the different template struct, is impossible.
Gabgobie commentedon Apr 18, 2026
At the risk of derailing the issue, I was digging around and this function should be the one issuing the API certificate.
certificates/authority/tls.go
Lines 884 to 984 in 14f4ad7
If I got this right, the CSR is only using
Config.CommonNameand entirely ignoresConfig.AuthorityConfig.Template[-]Configurable subject encoding[/-][+]Configurable subject (and encoding)[/+][-]Configurable subject (and encoding)[/-][+]Use template for CA API (and configurable subject encoding)[/+]Gabgobie commentedon Apr 23, 2026
After opening the issue for the initial suspect of subject encoding I discovered that the issue is a bit deeper as is apparent from my other comments. If it is of any value, I can try to reword the opening comment. ^^