예제 #1
0
    def test_pack_short_form(self):
        test_data = b'1'
        expected = hex_to_byte('01 31')

        actual = pack_asn1(test_data)

        assert actual == expected
예제 #2
0
    def test_pack_unpack_long_form_four_octets(self):
        test_data = b'1' * 16777216

        expected_data = hex_to_byte('31') * 16777216
        expected = hex_to_byte('84 01 00 00 00') + expected_data

        actual = pack_asn1(test_data)

        assert actual == expected
예제 #3
0
    def test_pack_unpack_long_form_two_octets(self):
        test_data = b'1' * 256

        expected_data = hex_to_byte('31') * 256
        expected = hex_to_byte('82 01 00') + expected_data

        actual = pack_asn1(test_data)

        assert actual == expected
예제 #4
0
    def test_pack_unpack_long_form_three_octets(self):
        test_data = b'1' * 65536

        expected_data = hex_to_byte('31') * 65536
        expected = hex_to_byte('83 01 00 00') + expected_data

        actual = pack_asn1(test_data)

        assert actual == expected
예제 #5
0
    def test_pack_long_form_one_octet(self):
        test_data = b'1' * 128

        expected_data = hex_to_byte('31') * 128
        expected = hex_to_byte('81 80') + expected_data

        actual = pack_asn1(test_data)

        assert actual == expected