BlueSSLService icon indicating copy to clipboard operation
BlueSSLService copied to clipboard

Relaxing the validation of server certificates when using self-signed embedded certs

Open kkieffer opened this issue 5 years ago • 5 comments

When using embedded self-signed (pinned) certificates, the default validation is to use the SSL policy, which is more restrictive than necessary. In addition to validating the x509 certificate, the SSL policy checks that the hostname you are connecting to is listed on the certificate. In iOS13 and MacOS Catalina, Apple has increased the certificate requirements. The hostname must be in the subject alternative field, and the certificate cannot be valid for more than 825 days.

When using certificate pinning, checking the hostname is not necessary because the client is only using the embedded cert for verification (see https://tools.ietf.org/html/rfc2818#section-3.1). Checking the hostname also precludes connecting to a server by IP address instead of a hostname.

To provide flexibility for self-signed certificates, this pull request changes the trust policy from SSL to x509 only when evaluating self-signed certificates.

Also updated the README to describe using embedded self-signed certs.

Motivation and Context

Relaxes certificate requirements that aren't necessary for pinned self-signed certs.

How Has This Been Tested?

Running swift tests, all tests pass. Have also validated against my own server using a self-signed cert that doesn't pass the requirements in ios13.

Checklist:

  • [x] I have submitted a CLA form
  • [x ] If applicable, I have updated the documentation accordingly.
  • [n/a ] If applicable, I have added tests to cover my changes.

kkieffer avatar Dec 18 '19 16:12 kkieffer

Just checking in to see if there are any comments/questions on this PR....

kkieffer avatar Dec 27 '19 00:12 kkieffer

@kkieffer This looks and sounds reasonable, though I'm not a subject matter expert. @billabt any thoughts?

djones6 avatar Jan 08 '20 13:01 djones6

@billabt would you review?

kkieffer avatar Mar 30 '20 17:03 kkieffer

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 27 '20 02:09 CLAassistant

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Nov 25 '21 01:11 sonarqubecloud[bot]