How to use the bless.ssh.protocol.ssh_protocol.pack_ssh_uint32 function in bless

To help you get started, we’ve selected a few bless examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Netflix / bless / tests / ssh / test_ssh_protocol.py View on Github external
def test_floats():
    with pytest.raises(TypeError):
        pack_ssh_uint64(4.2)

    with pytest.raises(TypeError):
        pack_ssh_uint32(4.2)
github Netflix / bless / tests / ssh / test_ssh_protocol.py View on Github external
def test_uint32():
    uint32s = {0x00: binascii.unhexlify('00000000'), 0x0a: binascii.unhexlify('0000000a'),
               0xab: binascii.unhexlify('000000ab'), 0xabcd: binascii.unhexlify('0000abcd'),
               0xabcdef: binascii.unhexlify('00abcdef'), 0xffffffff: binascii.unhexlify('ffffffff'),
               0xf0f0f0f0: binascii.unhexlify('f0f0f0f0'), 0x0f0f0f0f: binascii.unhexlify('0f0f0f0f')}

    for known_input, known_answer in uint32s.items():
        assert known_answer == pack_ssh_uint32(known_input)
github Netflix / bless / tests / ssh / test_ssh_protocol.py View on Github external
def test_uint_too_long():
    with pytest.raises(ValueError):
        pack_ssh_uint64(0x1FFFFFFFFFFFFFFFF)

    with pytest.raises(ValueError):
        pack_ssh_uint32(int(0x1FFFFFFFF))

    with pytest.raises(ValueError):
        pack_ssh_uint32(int(0x1FFFFFFFF))
github Netflix / bless / bless / ssh / certificates / ssh_certificate_builder.py View on Github external
def _serialize_certificate_body(self):
        body = pack_ssh_string(self.cert_key_type)
        body += pack_ssh_string(self.nonce)
        body += self._serialize_ssh_public_key()
        body += pack_ssh_uint64(self.serial)
        body += pack_ssh_uint32(self.cert_type)
        body += pack_ssh_string(self.key_id)
        body += pack_ssh_string(self._serialize_valid_principals())
        body += pack_ssh_uint64(self.valid_after)
        body += pack_ssh_uint64(self.valid_before)
        body += pack_ssh_string(self._serialize_critical_options())
        body += pack_ssh_string(self._serialize_extensions())
        body += pack_ssh_string('')
        body += pack_ssh_string(self.ca.get_signature_key())
        return body