Package core :: Module ssl_support |
[hide private]
[frames] | no frames]

# Source Code for Module core.ssl_support

     1  # Copyright 2011 the original author or authors.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #      http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14
    15  __author__ = "Scott Horn"
    16  __email__ = "scott@hornmicro.com"
    17  __credits__ = "Based entirely on work by Tim Fox http://tfox.org"
    18
    19 -class SSLSupport(object):
    20    """ A mixin module allowing SSL attributes to be set on classes """
    21
    22 -  def set_ssl(self, val):
    23      """ Set whether the server or client will use SSL.
    24
    25      Keyword arguments:
    26      @param val: If true then ssl will be used.
    27
    28      return self. So multiple invocations can be chained.
    29      """
    30      self.java_obj.setSSL(val)
    31      return self
    32
    33    ssl = property(fset=set_ssl)
    34
    35 -  def set_key_store_path(self, path):
    36      """Set the path to the SSL key store. This method should only be used with the client/server in SSL mode, i.e. after {#ssl=}
    37      has been set to true.
    38      The SSL key store is a standard Java Key Store, and should contain the client/server certificate. For a client, it's only necessary to supply
    39      a client key store if the server requires client authentication via client certificates.
    40
    41      Keyword arguments:
    42      @param path: The path to the key store
    43
    44      return self. So multiple invocations can be chained.
    45      """
    46      self.java_obj.setKeyStorePath(path)
    47      return self
    48
    49    key_store_path = property(fset=set_key_store_path)
    50
    51 -  def set_key_store_password(self, password):
    52      """Set the password for the SSL key store. This method should only be used with the client in SSL mode, i.e. after ssl
    53      has been set to true.
    54
    55      Keyword arguments:
    56      @param password: The password.
    57
    58      return self. So multiple invocations can be chained.
    59      """
    60      self.java_obj.setKeyStorePassword(password)
    61      return self
    62
    63    key_store_password = property(fset=set_key_store_password)
    64
    65 -  def set_trust_store_path(self, path):
    66      """Set the path to the SSL trust store. This method should only be used with the client/server in SSL mode, i.e. after {#ssl=}
    67      has been set to true.
    68      The SSL trust store is a standard Java Key Store, and should contain the certificate(s) of the clients/servers that the server/client trusts. The SSL
    69      handshake will fail if the server provides a certificate that the client does not trust, or if client authentication is used,
    70      if the client provides a certificate the server does not trust.
    71
    72      Keyword arguments:
    73      @param path: The path to the trust store
    74
    75      return self. So multiple invocations can be chained.
    76      """
    77      self.java_obj.setTrustStorePath(path)
    78      return self
    79
    80    trust_store_path = property(fset=set_trust_store_path)
    81
    82 -  def set_trust_store_password(self, password):
    83      """Set the password for the SSL trust store. This method should only be used with the client in SSL mode, i.e. after {#ssl=}
    84      has been set to true.
    85
    86      Keyword arguments:
    87      @param password: The password.
    88
    89      return self. So multiple invocations can be chained.
    90      """
    91      self.java_obj.setTrustStorePassword(password)
    92      return self
    93
    94    trust_store_password = property(fset=set_trust_store_password)
    95