Esempio n. 1
0
 def client_identity(self):
     id = Identity()
     rc = _lib.xtt_get_clients_identity(id.native, self.native)
     if rc == RC.SUCCESS:
         return id
     else:
         raise error_from_code(rc)
Esempio n. 2
0
 def my_identity(self):
     ident = Identity()
     rc = _lib.xtt_get_my_identity(ident.native, self.native)
     if rc == RC.SUCCESS:
         return ident
     else:
         raise error_from_code(rc)
Esempio n. 3
0
 def __init__(self, sock, version, suite_spec, group_context, server_id,
              root_id, root_pubkey, identity=None):
     self._sock = sock
     self._server_root_id = CertificateRootId()
     self._root_cert = ECDSAP256RootCertificateContext(root_id, root_pubkey)
     self._server_id = server_id
     self._identity  = identity or Identity()
     self._group_ctx = group_context
     self._ctx = ClientHandshakeContext(version, suite_spec)
Esempio n. 4
0
    def __init__(self):
        self.native = _ffi.new('struct xtt_server_handshake_context*')

        if self.native == _ffi.NULL:
            raise MemoryError("Unable to allocate native object")

        self._in = Buffer(_lib.max_handshake_client_message_length())
        self._out = Buffer(_lib.max_handshake_server_message_length())
        self._io = BufferView()

        self._client_requested_id = Identity()
        self._client_claimed_group = GroupId()

        rc = _lib.xtt_initialize_server_handshake_context(
            self.native, self._in.native, self._in.size, self._out.native,
            self._out.size)

        if rc != RC.SUCCESS:
            raise error_from_code(rc)
Esempio n. 5
0
 def id(self):
     value = _lib.xtt_server_certificate_access_id(self._raw)
     buff = _ffi.buffer(value, Identity.sizeof)
     return Identity(buff)