-
Notifications
You must be signed in to change notification settings - Fork 268
Description
The detail error is:
File "/usr/lib/python3.12/site-packages/aioquic/tls.py", line 1561, in _client_send_hello
cipher_suites=[int(x) for x in self._cipher_suites],
^^^^^^
ValueError: invalid literal for int() with base 10: 'TLS_AES_128_GCM_SHA256'
The code is:
'''python
server.py
import asyncio
from aioquic.tls import CipherSuite
from aioquic.asyncio import QuicConnectionProtocol, serve
from aioquic.quic.configuration import QuicConfiguration
class ServerProtocol(QuicConnectionProtocol):
def quic_event_received(self, event):
if hasattr(event, "data"):
print(f"Server received: {event.data.decode()}")
self._quic.send_stream_data(event.stream_id, event.data, end_stream=True)
async def main():
configuration = QuicConfiguration(
is_client=False, certificate = "cert.pem", private_key = "key.pem")
configuration.cipher_suites = [
CipherSuite.AES_256_GCM_SHA384,
CipherSuite.AES_128_GCM_SHA256,
CipherSuite.CHACHA20_POLY1305_SHA256 ]
await serve("0.0.0.0", 4433, configuration=configuration, create_protocol=ServerProtocol)
print("QUIC Server started")
await asyncio.Event().wait()
if name == "main":
asyncio.run(main())
'''
'''python
client.py
import asyncio
from aioquic.tls import CipherSuite
from aioquic.asyncio import connect
from aioquic.quic.configuration import QuicConfiguration
async def send_data():
configuration = QuicConfiguration(is_client=True)
configuration.verify_mode = 1
configuration.load_verify_locations("cert.pem")
configuration.cipher_suites = [
CipherSuite.AES_256_GCM_SHA384,
CipherSuite.AES_128_GCM_SHA256,
CipherSuite.CHACHA20_POLY1305_SHA256 ]
async with connect("localhost", 4433, configuration=configuration) as client:
client._quic.send_stream_data(0, b"Hello QUIC Server!", end_stream=False)
while True:
event = await client.wait_event()
if hasattr(event, "data"):
print(f"Client received: {event.data.decode()}")
break
if name == "main":
asyncio.run(send_data())
'''
cert.pem:
-----BEGIN CERTIFICATE-----
MIIBmjCCAT+gAwIBAgIUS38tiEggXFD4c8rBrabhb2El7qowCgYIKoZIzj0EAwIw
FDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTI1MDQwODAyNDg0NVoXDTI2MDQwODAy
NDg0NVowFDESMBAGA1UEAwwJbG9jYWxob3N0MFkwEwYHKoZIzj0CAQYIKoZIzj0D
AQcDQgAEeZuAxH+RFEXvlrapXyB4VqMcYc3QHNAooYkLdvaSzezXb2t7v15VR6of
NKIqWbnGp53LHIeqjnCuduSPpm1PF6NvMG0wHQYDVR0OBBYEFG5AY4ckU7Mji7/l
qgBIuEv3VsbZMB8GA1UdIwQYMBaAFG5AY4ckU7Mji7/lqgBIuEv3VsbZMA8GA1Ud
EwEB/wQFMAMBAf8wGgYDVR0RBBMwEYIJbG9jYWxob3N0hwR/AAABMAoGCCqGSM49
BAMCA0kAMEYCIQCx8C0O/iNihkh+KBLxtggGETVh69ZUJLhKQG4Yhp1TewIhAM1+
JzO8sXtrDkDCDOMpY3h6DvRAe7j+0GwcyB7tnMDk
-----END CERTIFICATE-----
key.pem:
-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIGxGo/y203W3p1pL51B9zE7zE0GxVNtO/554tqMmR5nAoAoGCCqGSM49
AwEHoUQDQgAEeZuAxH+RFEXvlrapXyB4VqMcYc3QHNAooYkLdvaSzezXb2t7v15V
R6ofNKIqWbnGp53LHIeqjnCuduSPpm1PFw==
-----END EC PRIVATE KEY-----
if I delete cipher_suites, it will report error:
Error296, reason: No supported signature algorithm, frame_type: 6.
thanks greatly.