Skip to content
Snippets Groups Projects
Verified Commit e4c6eefd authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: implement TLS

parent 5b1149d5
No related branches found
No related tags found
No related merge requests found
Pipeline #9125 passed with warnings
Pipeline: caosdb-cppinttest

#9128

    ...@@ -75,9 +75,13 @@ public: ...@@ -75,9 +75,13 @@ public:
    }; };
    class SslCaosDBConnectionConfig : public CaosDBConnectionConfig { class SslCaosDBConnectionConfig : public CaosDBConnectionConfig {
    private:
    std::shared_ptr<ChannelCredentials> credentials;
    public:
    SslCaosDBConnectionConfig(const std::string &host, int port); SslCaosDBConnectionConfig(const std::string &host, int port);
    SslCaosDBConnectionConfig(const std::string &host, int port, SslCaosDBConnectionConfig(const std::string &host, int port,
    std::string cacert); const std::string &cacert);
    }; };
    /** /**
    ......
    ...@@ -37,6 +37,8 @@ using caosdb::info::v1alpha1::GetVersionInfoRequest; ...@@ -37,6 +37,8 @@ using caosdb::info::v1alpha1::GetVersionInfoRequest;
    using caosdb::info::v1alpha1::GetVersionInfoResponse; using caosdb::info::v1alpha1::GetVersionInfoResponse;
    using caosdb::info::v1alpha1::VersionInfo; using caosdb::info::v1alpha1::VersionInfo;
    using grpc::InsecureChannelCredentials; using grpc::InsecureChannelCredentials;
    using grpc::SslCredentials;
    using grpc::SslCredentialsOptions;
    CaosDBConnectionConfig::CaosDBConnectionConfig(const std::string &host, CaosDBConnectionConfig::CaosDBConnectionConfig(const std::string &host,
    int port) { int port) {
    ...@@ -72,6 +74,21 @@ auto InsecureCaosDBConnectionConfig::getChannelCredentials() const ...@@ -72,6 +74,21 @@ auto InsecureCaosDBConnectionConfig::getChannelCredentials() const
    return this->credentials; return this->credentials;
    } }
    SslCaosDBConnectionConfig::SslCaosDBConnectionConfig(
    const std::string &host, int port, const std::string &cacert)
    : CaosDBConnectionConfig(host, port) {
    auto options = SslCredentialsOptions();
    options.pem_root_certs = cacert;
    this->credentials = SslCredentials(options);
    }
    SslCaosDBConnectionConfig::SslCaosDBConnectionConfig(
    const std::string &host, int port)
    : CaosDBConnectionConfig(host, port) {
    auto options = SslCredentialsOptions();
    this->credentials = SslCredentials(options);
    }
    CaosDBConnection::CaosDBConnection( CaosDBConnection::CaosDBConnection(
    const std::shared_ptr<CaosDBConnectionConfig> &config) { const std::shared_ptr<CaosDBConnectionConfig> &config) {
    this->config = config; this->config = config;
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment