File: tls_policy.h

package info (click to toggle)
botan1.10 1.10.8-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 12,288 kB
  • sloc: cpp: 61,853; python: 1,687; asm: 1,247; ansic: 252; perl: 89; sh: 52; makefile: 38; lisp: 34
file content (63 lines) | stat: -rw-r--r-- 1,755 bytes parent folder | download | duplicates (3)
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
/*
* Policies
* (C) 2004-2006 Jack Lloyd
*
* Released under the terms of the Botan license
*/

#ifndef BOTAN_TLS_POLICY_H__
#define BOTAN_TLS_POLICY_H__

#include <botan/tls_magic.h>
#include <botan/x509cert.h>
#include <botan/dl_group.h>
#include <vector>

namespace Botan {

/**
* TLS Policy Base Class
* Inherit and overload as desired to suite local policy concerns
*/
class BOTAN_DLL TLS_Policy
   {
   public:
      std::vector<u16bit> ciphersuites() const;
      virtual std::vector<byte> compression() const;

      virtual u16bit choose_suite(const std::vector<u16bit>& client_suites,
                                  bool rsa_ok,
                                  bool dsa_ok) const;

      virtual byte choose_compression(const std::vector<byte>& client) const;

      virtual bool allow_static_rsa() const { return true; }
      virtual bool allow_edh_rsa() const { return true; }
      virtual bool allow_edh_dsa() const { return true; }
      virtual bool require_client_auth() const { return false; }

      virtual DL_Group dh_group() const;
      virtual size_t rsa_export_keysize() const { return 512; }

      /*
      * @return the minimum version that we will negotiate
      */
      virtual Version_Code min_version() const { return SSL_V3; }

      /*
      * @return the version we would prefer to negotiate
      */
      virtual Version_Code pref_version() const { return TLS_V11; }

      virtual bool check_cert(const std::vector<X509_Certificate>& cert_chain) const = 0;

      virtual ~TLS_Policy() {}
   private:
      virtual std::vector<u16bit> suite_list(bool use_rsa,
                                             bool use_edh_rsa,
                                             bool use_edh_dsa) const;
   };

}

#endif