Skip to content

fix: populate common_name in CertificateInfo for CAWG identity assertions#2126

Open
rajat-2023 wants to merge 2 commits into
contentauth:mainfrom
rajat-2023:fix/cawg-identity-common-name
Open

fix: populate common_name in CertificateInfo for CAWG identity assertions#2126
rajat-2023 wants to merge 2 commits into
contentauth:mainfrom
rajat-2023:fix/cawg-identity-common-name

Conversation

@rajat-2023
Copy link
Copy Markdown

Problem

cawg.identity.signature_info.common_name is always absent when verifying
a CAWG identity assertion, even when the signing certificate has a valid CN.
The top-level manifest signature.common_name (standard C2PA) works correctly
because it uses a different code path.

Root Cause

Two divergent code paths exist in c2pa:

  • src/cose_validator.rsget_signing_info() (standard C2PA manifest signatures)
    calls extract_common_name_from_cert() and sets common_name in CertificateInfo. ✅

  • src/crypto/cose/verifier.rsverify_signature() (CAWG identity assertions)
    builds CertificateInfo with ..Default::default(), leaving common_name: None. ❌

The CertificateInfo struct (certificate_info.rs:38) has pub common_name: Option<String>
defined, and cose_validator.rs correctly populates it. But when verifier.rs was
introduced in #801 (Dec 2024) to handle the CAWG identity verification path,
common_name was never ported over.

Fix

Extract common_name from the end-entity cert's subject in verifier.rs,
using the same x509_parser approach already used for issuer_org just above.

Testing

Verified by:

  1. Signing a JPEG with a CAWG identity assertion (cert CN = "rajat customer")
  2. Before fix: c2patool file.jpeg -d shows cawg.identity.signature_info
    with alg, issuer, cert_serial_number but no common_name
  3. After fix: common_name: "rajat customer" appears correctly

@rajat-2023 rajat-2023 closed this May 8, 2026
@rajat-2023 rajat-2023 reopened this May 8, 2026
@rajat-2023 rajat-2023 closed this May 8, 2026
@rajat-2023 rajat-2023 reopened this May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant