openssl / openssl/openssl

Requesting ability for policyMappings extension to parse mappings from one issuer domain to multiple subject domains

Open
#31,087 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted issue: feature request triaged: feature
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!

openssl-create-policyMappings-manually.py

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.