Skip to content

Commit

Permalink
Merge branch '15-updating-to-work-with-latest-cryptoparser-version'
Browse files Browse the repository at this point in the history
Closes: #15
  • Loading branch information
c0r0n3r committed May 3, 2023
2 parents 743ae63 + 4ae58a9 commit 3d33002
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 6 additions & 5 deletions dheater/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
import attr
import urllib3

from cryptoparser.common.algorithm import Authentication
from cryptodatahub.common.algorithm import Authentication

from cryptoparser.common.exception import InvalidType, NotEnoughData

from cryptoparser.tls.algorithm import TlsSignatureAndHashAlgorithm
from cryptoparser.tls.ciphersuite import TlsCipherSuite
from cryptoparser.tls.extension import TlsNamedCurve, TlsExtensionEllipticCurves
from cryptoparser.tls.record import TlsRecord
from cryptoparser.tls.subprotocol import TlsHandshakeType
from cryptoparser.tls.version import TlsProtocolVersionFinal, TlsVersion
from cryptoparser.tls.version import TlsProtocolVersion, TlsVersion

from cryptoparser.ssh.record import SshRecordInit, SshRecordKexDH, SshRecordKexDHGroup
from cryptoparser.ssh.subprotocol import (
Expand Down Expand Up @@ -345,7 +346,7 @@ def _send_packets(self, client):
@attr.s
class DHEPreCheckResultTLS(DHEPreCheckResultBase): # pylint: disable=too-few-public-methods
dh_public_key = attr.ib(validator=attr.validators.instance_of((DHPublicKey, TlsNamedCurve)))
protocol_version = attr.ib(validator=attr.validators.instance_of(TlsProtocolVersionFinal))
protocol_version = attr.ib(validator=attr.validators.instance_of(TlsProtocolVersion))
cipher_suite = attr.ib(validator=attr.validators.instance_of(TlsCipherSuite))
receivable_byte_count = attr.ib(validator=attr.validators.instance_of(int))

Expand Down Expand Up @@ -373,7 +374,7 @@ def _pre_check(self):

protocol_version = max(analyzer_result_versions.versions)
dh_public_key = None
if protocol_version > TlsProtocolVersionFinal(TlsVersion.TLS1_2):
if protocol_version > TlsProtocolVersion(TlsVersion.TLS1_2):
named_curves = list(sorted(
TlsHandshakeClientHelloKeyExchangeDHE._NAMED_CURVES, # pylint: disable=protected-access
key=lambda named_curve: named_curve.value.named_group.value.size, reverse=True
Expand Down Expand Up @@ -455,7 +456,7 @@ def _prepare_packets(self):
]

client_hello_class = TlsHandshakeClientHelloSpecalization
if protocol_version > TlsProtocolVersionFinal(TlsVersion.TLS1_2):
if protocol_version > TlsProtocolVersion(TlsVersion.TLS1_2):
signature_algorithms = None
extensions = client_hello_class._get_tls1_3_extensions( # pylint: disable=protected-access
[protocol_version, ], [self.pre_check_result.dh_public_key, ], signature_algorithms
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
attrs>=19.2.0
cryptoparser>=0.8.0,<0.9.0
cryptolyzer>=0.8.0,<0.9.0
cryptolyzer>=0.8.5
urllib3

0 comments on commit 3d33002

Please sign in to comment.