Skip to content
This repository has been archived by the owner on Sep 3, 2020. It is now read-only.

Add support for DER encoded x509 certificate #86

Merged
merged 4 commits into from
Jun 15, 2020
Merged

Conversation

emarashliev
Copy link

@emarashliev emarashliev commented Apr 16, 2019

Fixes #85

@joscdk joscdk requested a review from tanner0101 April 16, 2019 11:54
@tanner0101 tanner0101 added the enhancement New feature or request label Apr 25, 2019
Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

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

This change looks great, thanks. Just a couple of small nits. Would you mind creating a version of this against the master branch (for Vapor 4)?

Sources/Crypto/RSA/RSAKey.swift Outdated Show resolved Hide resolved
Sources/Crypto/RSA/RSAKey.swift Outdated Show resolved Hide resolved
@emarashliev
Copy link
Author

emarashliev commented Apr 26, 2019

@tanner0101 Thanks for the feedback! And yes, I'll create a version of this against the master branch.

Sources/Crypto/RSA/RSAKey.swift Outdated Show resolved Hide resolved
Sources/Crypto/RSA/RSAKey.swift Outdated Show resolved Hide resolved
@tanner0101
Copy link
Member

The linux-mysql CI test can be fixed by changing this line to clone 3 instead of master
https://github.com/vapor/crypto/blob/3/circle.yml#L58

@emarashliev
Copy link
Author

emarashliev commented Apr 29, 2019

@tanner0101 Again, thank you for the feedback! The things you mentioned are fixed.

@emarashliev
Copy link
Author

emarashliev commented Apr 29, 2019

@tanner0101 I opened one more pull request #89 as well, with this functionality but adapted for Vapor 4, against the master branch.

@tanner0101
Copy link
Member

Thanks!

@tanner0101 tanner0101 merged commit 5b020d1 into vapor:3 Jun 15, 2020
@kevinschlieper
Copy link

kevinschlieper commented Jun 15, 2020

@tanner0101 It seems to me that this merge causes a build error on Linux when using Swift >= 5.0 and since Vapor 3 is using the latest version of open-crypto, the Vapor 3 build now also fails on Linux when building with Swift 5.

The Linux tests in this branch are still using Swift 4.2, but you can verify the problem by using this Dockerfile instead:

FROM swift:5.0
COPY Sources/ Sources/
COPY Tests/ Tests/
COPY Package.swift Package.swift
RUN apt-get update && apt-get -y install openssl libssl-dev
ENTRYPOINT swift build

I haven't had a chance to look into a possible fix, yet, but here are the error messages when building with Swift 5:

/Sources/Crypto/RSA/RSAKey.swift:127:96: error: use of undeclared type 'X509'
             guard let x509 = derDecoded.withByteBuffer({ bufferPointer -> UnsafeMutablePointer<X509>? in
                                                                                               ^~~~
/Sources/Crypto/RSA/RSAKey.swift:127:56: error: cannot convert value of type '(_) -> <<error type>>' to expected argument type '(BytesBufferPointer) -> _' (aka '(UnsafeBufferPointer<UInt8>) -> _')
             guard let x509 = derDecoded.withByteBuffer({ bufferPointer -> UnsafeMutablePointer<X509>? in
                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@tanner0101
Copy link
Member

@kevinschlieper ah yeah looks like this PR didn't take OpenSSL 1.1's breaking changes into account. I've pushed a release here that should fix it: https://github.com/vapor/open-crypto/releases/tag/3.4.1

@kevinschlieper
Copy link

@tanner0101 Thanks for the quick fix, Tanner. Everything is working as expected now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants