Requesting ability for policyMappings extension to parse mappings from one issuer domain to multiple subject domains
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 30.8k
- Forks
- 11.5k
- Avg merge
- 10m
- Merged PRs (30d)
- 1
Description
When building a certificate profile in openssl.cnf for a cross certificate, the policyMappings extension cannot process multiple mappings from one issuer policy to multiple subject policies.
In this case, the second occurrence of the issuer:subject mapping wins.
Example snippet from my profile:
policyMappings = @cross_cert_mappings
[ cross_cert_mappings ]
2.16.840.1.999.1 = 2.16.840.1.666.1
2.16.840.1.999.2 = 2.16.840.1.666.2
2.16.840.1.999.2 = 2.16.840.1.777.1
2.16.840.1.999.3 = 2.16.840.1.666.3
When signing the cert with openssl ca, i get this:
X509v3 Policy Mappings:
2.16.840.1.999.1:2.16.840.1.666.1,
2.16.840.1.999.2:2.16.840.1.777.1,
2.16.840.1.999.3:2.16.840.1.666.3
So this (first) occurrence of the issuer:subject policy mapping ending in .2 policy is lost in the final certificate:
2.16.840.1.999.2:2.16.840.1.666.2
There is a workaround by manually creating the ASN.1 structure of the policyMappings extension and then adding it to the profile (sample python script attached to do this, i've also done similar with openssl asn1parse -genconf):
2.5.29.33 = DER:30503012060760864801876701060760864801851a013012060760864801876702060760864801851a0230120607608648018767020607608648018609013012060760864801876703060760864801851a03
Which correctly produces the following:
X509v3 Policy Mappings:
2.16.840.1.999.1:2.16.840.1.666.1,
2.16.840.1.999.2:2.16.840.1.666.2,
2.16.840.1.999.2:2.16.840.1.777.1,
2.16.840.1.999.3:2.16.840.1.666.3
But this is tedious and having the extension be able to parse multiple occurrences of one issuer policy to multiple subject policies would be very helpful.
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the shown openssl.cnf policyMappings section and openssl ca command, then compare it with the manually encoded ASN.1 example. Trace how policyMappings entries are parsed and confirm that repeated issuer policies preserve every issuer:subject pair; done means the resulting certificate contains all four mappings shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cryptography
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100