Skip to content

Commit 39c26e0

Browse files
authored
Merge pull request microsoft#1 from reneme/feature/cert_access
FIX: Certificate Pinning Compilation on Linux
2 parents fd17845 + 9aa9ae5 commit 39c26e0

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

CONTRIBUTORS.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Chris O'Gorman (chogorma)
4040
Ocedo GmbH
4141
Henning Pfeiffer (megaposer)
4242

43+
neXenio GmbH
44+
Patrik Fiedler (xqp)
45+
René Meusel (reneme)
46+
4347
thomasschaub
4448

4549
Trimble

Release/include/cpprest/details/x509_cert_utilities.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <string>
1717
#include "cpprest/certificate_info.h"
1818

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

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

3939
using namespace utility;
4040

41+
#if !defined(__linux__)
4142

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

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

55+
#endif
56+
57+
5558
std::vector<std::vector<unsigned char>> get_X509_cert_chain_encoded_data(boost::asio::ssl::verify_context &verifyCtx);
5659

5760
}}}}

Release/src/http/client/x509_cert_utilities.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "stdafx.h"
1515

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

1818
#include "cpprest/details/x509_cert_utilities.h"
1919
#include <vector>
@@ -40,6 +40,8 @@
4040

4141
namespace web { namespace http { namespace client { namespace details {
4242

43+
#if !defined(__linux__)
44+
4345
bool is_end_certificate_in_chain(boost::asio::ssl::verify_context &verifyCtx)
4446
{
4547
X509_STORE_CTX *storeContext = verifyCtx.native_handle();
@@ -104,6 +106,8 @@ bool verify_cert_chain_platform_specific(boost::asio::ssl::verify_context &verif
104106
return verify_result;
105107
}
106108

109+
#endif
110+
107111
#if defined(ANDROID) || defined(__ANDROID__)
108112
using namespace crossplat;
109113

0 commit comments

Comments
 (0)