swift-server / swift-server/async-http-client

Authenticate using certificate and passphrase like curl's `--cert` option

Open
#669 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
1.1k
Forks
156
PR merge metrics
No merged PRs in 30d

Description

I'm working with Vapor on Linux on a API which connects to a URL and send it a XML, this URL needs certificate authentication (.pem, or p12) and passphrase.

Using curl on terminal works perfect, with this command:

curl -X POST https://myurl.com/api -H "ContentType: application/xml" --cert file.pem:password -d "<xml>my awesome xml</xml>"

Ref: https://curl.se/docs/manpage.html#-E

Now I'm trying to figure it to how to implement using TLSConfiguration.forClient(), based on this comment: https://github.com/swift-server/async-http-client/issues/27#issuecomment-489760481, and I'm not sure how to "inject" the certificate and its passphrase and later using it on one of my routes.

Any help appreciated

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 with TLSConfiguration.forClient() and the linked async-http-client issue comment to understand how client TLS settings are configured. Determine how a PEM or PKCS#12 certificate and passphrase should be supplied for the HTTPS request, then verify that the certificate-authenticated XML POST works against the described API.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.