Skip to content

Commit

Permalink
Merge pull request microsoft#1 from reneme/feature/cert_access
Browse files Browse the repository at this point in the history
FIX: Certificate Pinning Compilation on Linux
  • Loading branch information
chogorma authored Feb 28, 2018
2 parents fd17845 + 9aa9ae5 commit 39c26e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ Chris O'Gorman (chogorma)
Ocedo GmbH
Henning Pfeiffer (megaposer)

neXenio GmbH
Patrik Fiedler (xqp)
René Meusel (reneme)

thomasschaub

Trimble
Expand Down
7 changes: 5 additions & 2 deletions Release/include/cpprest/details/x509_cert_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <string>
#include "cpprest/certificate_info.h"

#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) || (defined(_WIN32) && !defined(__cplusplus_winrt) && !defined(_M_ARM) && !defined(CPPREST_EXCLUDE_WEBSOCKETS))
#if defined(__linux__) || defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) || (defined(_WIN32) && !defined(__cplusplus_winrt) && !defined(_M_ARM) && !defined(CPPREST_EXCLUDE_WEBSOCKETS))

#if defined(_MSC_VER)
#pragma warning(push)
Expand All @@ -38,6 +38,7 @@ namespace web { namespace http { namespace client { namespace details {

using namespace utility;

#if !defined(__linux__)

bool is_end_certificate_in_chain(boost::asio::ssl::verify_context &verifyCtx);

Expand All @@ -49,9 +50,11 @@ bool is_end_certificate_in_chain(boost::asio::ssl::verify_context &verifyCtx);
/// <param name="hostName">Host name from the URI.</param>
/// <returns>True if verification passed and server can be trusted, false otherwise.</returns>
bool verify_cert_chain_platform_specific(boost::asio::ssl::verify_context &verifyCtx, const std::string &hostName, const CertificateChainFunction& func = nullptr);

bool verify_X509_cert_chain(const std::vector<std::string> &certChain, const std::string &hostName, const CertificateChainFunction& func = nullptr);

#endif


std::vector<std::vector<unsigned char>> get_X509_cert_chain_encoded_data(boost::asio::ssl::verify_context &verifyCtx);

}}}}
Expand Down
6 changes: 5 additions & 1 deletion Release/src/http/client/x509_cert_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "stdafx.h"

#if defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) || (defined(_WIN32) && !defined(__cplusplus_winrt) && !defined(_M_ARM) && !defined(CPPREST_EXCLUDE_WEBSOCKETS))
#if defined(__linux__) || defined(__APPLE__) || (defined(ANDROID) || defined(__ANDROID__)) || (defined(_WIN32) && !defined(__cplusplus_winrt) && !defined(_M_ARM) && !defined(CPPREST_EXCLUDE_WEBSOCKETS))

#include "cpprest/details/x509_cert_utilities.h"
#include <vector>
Expand All @@ -40,6 +40,8 @@

namespace web { namespace http { namespace client { namespace details {

#if !defined(__linux__)

bool is_end_certificate_in_chain(boost::asio::ssl::verify_context &verifyCtx)
{
X509_STORE_CTX *storeContext = verifyCtx.native_handle();
Expand Down Expand Up @@ -104,6 +106,8 @@ bool verify_cert_chain_platform_specific(boost::asio::ssl::verify_context &verif
return verify_result;
}

#endif

#if defined(ANDROID) || defined(__ANDROID__)
using namespace crossplat;

Expand Down

0 comments on commit 39c26e0

Please sign in to comment.