def set_peer_authentication(self, verify_mode, trusted_CAs=None):
        """
        This method controls how the peer's certificate is validated, if at all.  By default,
        neither servers nor clients attempt to verify their peers (PN_SSL_ANONYMOUS_PEER).
        Once certificates and trusted CAs are configured, peer verification can be enabled.

        .. note:: In order to verify a peer, a trusted CA must be configured. See
            :meth:`set_trusted_ca_db`.

        .. note:: Servers must provide their own certificate when verifying a peer.  See
            :meth:`set_credentials`.

        .. note:: This setting effects only those :class:`SSL` objects created after this call
            returns.  :class:`SSL` objects created before invoking this method will use the domain's
            previous setting.

        :param verify_mode: The level of validation to apply to the peer, one of :const:`VERIFY_PEER`,
                            :const:`VERIFY_PEER_NAME`, :const:`ANONYMOUS_PEER`, 
        :type verify_mode: ``int``
        :param trusted_CAs: Path to a database of trusted CAs that the server will advertise.
        :type trusted_CAs: ``str``
        :return: 0 on success
        :rtype: ``int``
        :raise: :exc:`SSLException` if there is any Proton error
        """
        return self._check(pn_ssl_domain_set_peer_authentication(self._domain,
                                                                 verify_mode,
                                                                 trusted_CAs))
Exemple #2
0
 def set_peer_authentication(self, verify_mode, trusted_CAs=None):
     return self._check(pn_ssl_domain_set_peer_authentication(self._domain,
                                                              verify_mode,
                                                              trusted_CAs))
Exemple #3
0
 def set_peer_authentication(self, verify_mode, trusted_CAs=None):
     return self._check(
         pn_ssl_domain_set_peer_authentication(self._domain, verify_mode,
                                               trusted_CAs))