Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bridge between Certificate and Security.SecCertificate #182

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

aryan-25
Copy link
Contributor

@aryan-25 aryan-25 commented Jul 2, 2024

Motivation:

Currently, there is no way to create an instance of Certificate from Security.SecCertificate and vice versa (GitHub Issue #168).

Modifications:

  • Added an initializer to Certificate which constructs an instance from Security.SecCertificate.
  • Added a static function createWithCertificate(_ certificate: Certificate) in an extension to Security.SecCertificate which returns a SecCertificate instance.
    • Various errors when trying to add an initializer in an extension of Security.SecCertificate -- this is presumably because SecCertificate is defined in C.

Result:

Users can create an instance of Certificate from Security.SecCertificate and vice versa.

@aryan-25 aryan-25 changed the title Add bridge between Certificate and Security.SecCertificate Add bridge between Certificate and Security.SecCertificate Jul 2, 2024
Copy link
Member

@dnadoba dnadoba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! This functionality is usually rather difficult to discover. Can we also add a section to the documentation overview that briefly mentions these methods?

Sources/X509/Certificate.swift Outdated Show resolved Hide resolved
… `Security.SecCertificate`. Add `make` prefix to `SecCertificate` factory method.
@dnadoba dnadoba enabled auto-merge (squash) July 2, 2024 15:08
@dnadoba
Copy link
Member

dnadoba commented Jul 2, 2024

@swift-server-bot add to allowlist

@dnadoba dnadoba merged commit 2f79730 into apple:main Jul 2, 2024
5 of 6 checks passed
@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants