summaryrefslogtreecommitdiff
path: root/ACE/protocols/ace/INet/HTTPS_Context.inl
blob: d4aaee7e8c882aecd0ec028c14810a9dbd91af86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// -*- C++ -*-
//
// $Id$

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

namespace ACE
{
  namespace HTTPS
  {

    ACE_INLINE
    Context::operator bool (void) const
      {
        return this->ssl_ctx_ != 0;
      }

    ACE_INLINE
    bool Context::operator ! (void) const
      {
        return this->ssl_ctx_ == 0;
      }

    ACE_INLINE
    ACE_SSL_Context& Context::ssl_context (void)
      {
        return *this->ssl_ctx_;
      }

    ACE_INLINE
    const ACE_SSL_Context& Context::ssl_context (void) const
      {
        return *this->ssl_ctx_;
      }

    ACE_INLINE
    bool Context::use_default_ca ()
      {
        if (::SSL_CTX_set_default_verify_paths(this->ssl_ctx_->context ()) != 1)
          {
            ACE_SSL_Context::report_error ();
            return false;
          }
        return true;
      }

    ACE_INLINE
    bool Context::set_key_files (const char* certificate_filename,
                                 const char* private_key_filename,
                                 int file_type)
      {
        if (this->ssl_ctx_->certificate (certificate_filename, file_type) == 0)
          {
            if (this->ssl_ctx_->private_key (private_key_filename, file_type) == 0)
              {
                return true;
              }
          }
        return false;
      }

    ACE_INLINE
    int Context::has_trusted_ca ()
      {
        return this->ssl_ctx_->have_trusted_ca ();
      }

    ACE_INLINE
    void Context::set_default_ssl_mode (int ssl_mode)
      {
        Context::ssl_mode_ = ssl_mode;
      }

    ACE_INLINE
    void Context::set_default_verify_mode (bool verify_peer)
      {
        Context::ssl_verify_peer_ = verify_peer;
      }

    ACE_INLINE
    void Context::set_default_verify_settings (bool strict,
                                                bool once,
                                                int depth)
      {
        Context::ssl_strict_ = strict;
        Context::ssl_once_ = once;
        Context::ssl_depth_ = depth;
      }


  }
}

ACE_END_VERSIONED_NAMESPACE_DECL