예제 #1
0
파일: test_message.py 프로젝트: moshez/tls
 def test_parse_certificate_types_too_short(self):
     """
     :py:func:`tls.message.CertificateRequest` fails to parse a
     certificate request packet whose ``certificate_types`` is too
     short.
     """
     with pytest.raises(ValidationError) as exc_info:
         CertificateRequest.from_bytes(self.certificate_types_too_short)
     assert exc_info.value.args == ('invalid object', 0)
예제 #2
0
파일: test_message.py 프로젝트: ashfall/tls
 def test_parse_certificate_types_too_short(self):
     """
     :py:func:`tls.message.CertificateRequest` fails to parse a
     certificate request packet whose ``certificate_types`` is too
     short.
     """
     with pytest.raises(ValidationError) as exc_info:
         CertificateRequest.from_bytes(self.certificate_types_too_short)
     assert exc_info.value.args == ('invalid object', 0)
예제 #3
0
파일: test_message.py 프로젝트: moshez/tls
 def test_parse_supported_signature_algorithms_too_short(self):
     """
     :py:func:`CertificateRequest` fails to parse a certificate
     request packet whose ``supported_signature_algorithms`` is too
     short.
     """
     with pytest.raises(ValidationError) as exc_info:
         CertificateRequest.from_bytes(
             self.supported_signature_algorithms_too_short)
     assert exc_info.value.args == ('invalid object', 0)
예제 #4
0
파일: test_message.py 프로젝트: ashfall/tls
 def test_parse_supported_signature_algorithms_too_short(self):
     """
     :py:func:`CertificateRequest` fails to parse a certificate
     request packet whose ``supported_signature_algorithms`` is too
     short.
     """
     with pytest.raises(ValidationError) as exc_info:
         CertificateRequest.from_bytes(
             self.supported_signature_algorithms_too_short)
     assert exc_info.value.args == ('invalid object', 0)
예제 #5
0
 def test_parse_certificate_request(self):
     record = CertificateRequest.from_bytes(self.no_authorities_packet)
     assert record.certificate_types == [ClientCertificateType.RSA_SIGN]
     assert len(record.supported_signature_algorithms) == 1
     assert record.supported_signature_algorithms[0].hash == \
         HashAlgorithm.MD5
     assert record.supported_signature_algorithms[0].signature == \
         SignatureAlgorithm.RSA
     assert record.certificate_authorities == b''
예제 #6
0
 def test_parse_certificate_request(self):
     record = CertificateRequest.from_bytes(self.no_authorities_packet)
     assert record.certificate_types == [ClientCertificateType.RSA_SIGN]
     assert len(record.supported_signature_algorithms) == 1
     assert record.supported_signature_algorithms[0].hash == \
         HashAlgorithm.MD5
     assert record.supported_signature_algorithms[0].signature == \
         SignatureAlgorithm.RSA
     assert record.certificate_authorities == b''
예제 #7
0
파일: test_message.py 프로젝트: moshez/tls
 def test_as_bytes_certificate_types_too_short(self):
     """
     :py:func:`tls.message.CertificateRequest` fails to construct a
     certificate request packet whose ``certificate_types`` would
     be too short.
     """
     record = CertificateRequest.from_bytes(self.no_authorities_packet)
     record.certificate_types = []
     with pytest.raises(ValidationError) as exc_info:
         record.as_bytes()
     assert exc_info.value.args == ('invalid object', 0)
예제 #8
0
파일: test_message.py 프로젝트: moshez/tls
 def test_as_bytes_supported_signature_algorithms_too_short(self):
     """
     :py:func:`CertificateRequest` fails to construct a certificate
     request packet whose ``supported_signature_algorithms`` would
     be too short.
     """
     record = CertificateRequest.from_bytes(self.no_authorities_packet)
     record.supported_signature_algorithms = []
     with pytest.raises(ValidationError) as exc_info:
         record.as_bytes()
     assert exc_info.value.args == ('invalid object', 0)
예제 #9
0
파일: test_message.py 프로젝트: ashfall/tls
 def test_as_bytes_certificate_types_too_short(self):
     """
     :py:func:`tls.message.CertificateRequest` fails to construct a
     certificate request packet whose ``certificate_types`` would
     be too short.
     """
     record = CertificateRequest.from_bytes(self.no_authorities_packet)
     record.certificate_types = []
     with pytest.raises(ValidationError) as exc_info:
         record.as_bytes()
     assert exc_info.value.args == ('invalid object', 0)
예제 #10
0
파일: test_message.py 프로젝트: ashfall/tls
 def test_as_bytes_supported_signature_algorithms_too_short(self):
     """
     :py:func:`CertificateRequest` fails to construct a certificate
     request packet whose ``supported_signature_algorithms`` would
     be too short.
     """
     record = CertificateRequest.from_bytes(self.no_authorities_packet)
     record.supported_signature_algorithms = []
     with pytest.raises(ValidationError) as exc_info:
         record.as_bytes()
     assert exc_info.value.args == ('invalid object', 0)
예제 #11
0
 def test_as_bytes_with_authoritites(self):
     record = CertificateRequest.from_bytes(self.with_authorities_packet)
     assert record.as_bytes() == self.with_authorities_packet
예제 #12
0
 def test_parse_certificate_request_with_authorities(self):
     record = CertificateRequest.from_bytes(self.with_authorities_packet)
     assert record.certificate_authorities == b'03'
예제 #13
0
 def test_as_bytes_with_authoritites(self):
     record = CertificateRequest.from_bytes(self.with_authorities_packet)
     assert record.as_bytes() == self.with_authorities_packet
예제 #14
0
 def test_parse_certificate_request_with_authorities(self):
     record = CertificateRequest.from_bytes(self.with_authorities_packet)
     assert record.certificate_authorities == b'03'