Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Document ordering guarantee for X509Chain.ChainElements collection#11475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gewarren merged 6 commits intomainfromcopilot/fix-11359
Jun 20, 2025

Conversation

Copilot
Copy link
Contributor

@CopilotCopilotAI commentedJun 19, 2025
edited
Loading

Summary

This PR clarifies the ordering of certificates in theX509Chain.ChainElements collection, which was previously undocumented and caused confusion for developers working with certificate chains across different platforms.

Changes Made

Updated the documentation for theChainElements property inX509Chain.xml to include:

1.Explicit Ordering Guarantee

Added clear statement that the collection is ordered from end-entity (leaf) certificate at index 0 to trust anchor (root certificate) at the final index.

2.Cross-Platform Consistency References

  • Windows: ReferencesCERT_CHAIN_CONTEXT structure behavior wherergpChain[0] is the end certificate
  • Linux/macOS: References OpenSSL'sX509_STORE_CTX_get0_chain() which returns certificates ordered from leaf to root

3.Practical Code Example

Added demonstration showing how to reliably access certificates by their position in the chain:

usingvarchain=newX509Chain();chain.Build(serverCertificate);// chain.ChainElements[0] is the leaf (end-entity) certificate// chain.ChainElements[^1] is the root (trust anchor) certificateConsole.WriteLine("Certificate chain from leaf to root:");for(inti=0;i<chain.ChainElements.Count;i++){varcert=chain.ChainElements[i].Certificate;varrole=i==0?"Leaf":i==chain.ChainElements.Count-1?"Root":"Intermediate";Console.WriteLine($"[{i}]{role}:{cert.Subject}");}

Impact

This documentation enhancement:

  • Eliminates ambiguity around certificate chain ordering
  • Enables reliable cross-platform code that depends on certificate position
  • Provides confidence for developers implementing certificate validation logic
  • Maintains backward compatibility (documentation-only change)

The changes are minimal (22 lines added) and focused solely on clarifying existing behavior without modifying any implementation.

Fixes#11359.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn moreCopilot coding agent tips in the docs.

Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
@CopilotCopilotAI changed the title[WIP] Ordering of X509Chain.ChainElementsDocument ordering guarantee for X509Chain.ChainElements collectionJun 19, 2025
@CopilotCopilotAI requested a review fromjeffhandleyJune 19, 2025 06:47
Copilot finished work on behalf ofjeffhandleyJune 19, 2025 06:47
@jeffhandleyjeffhandley marked this pull request as ready for reviewJune 19, 2025 07:05
@jeffhandleyjeffhandley requested a review froma team as acode ownerJune 19, 2025 07:05
…unctuationCo-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
@CopilotCopilotAI requested a review fromgewarrenJune 19, 2025 08:07
Copilot finished work on behalf ofgewarrenJune 19, 2025 08:07
…ocumentationCo-authored-by: vcsjones <361677+vcsjones@users.noreply.github.com>
@CopilotCopilotAI requested a review fromvcsjonesJune 19, 2025 14:57
Copilot finished work on behalf ofvcsjonesJune 19, 2025 14:57
Co-authored-by: bartonjs <10642668+bartonjs@users.noreply.github.com>
@CopilotCopilotAI requested a review frombartonjsJune 19, 2025 17:13
Copilot finished work on behalf ofbartonjsJune 19, 2025 17:13
…xampleCo-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
@CopilotCopilotAI requested a review fromgewarrenJune 19, 2025 19:09
Copilot finished work on behalf ofgewarrenJune 19, 2025 19:09
@gewarrengewarren merged commit20a51c9 intomainJun 20, 2025
5 checks passed
@gewarrengewarren deleted the copilot/fix-11359 branchJune 20, 2025 06:52
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jeffhandleyjeffhandleyjeffhandley approved these changes

@bartonjsbartonjsbartonjs approved these changes

@vcsjonesvcsjonesAwaiting requested review from vcsjones

@gewarrengewarrenAwaiting requested review from gewarren

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Ordering of X509Chain.ChainElements
5 participants
@Copilot@vcsjones@jeffhandley@bartonjs@gewarren

[8]ページ先頭

©2009-2025 Movatter.jp