예제 #1
0
    def test_basic_iov_wrap_unwrap_autoalloc(self):
        init_data = b'some encrypted data'
        init_other_data = b'some other encrypted data'
        init_signed_info = b'some sig data'
        init_message = gb.IOV((gb.IOVBufferType.sign_only, init_signed_info),
                              init_data, init_other_data)

        conf = gb.wrap_iov(self.client_ctx, init_message)

        conf.should_be_a(bool)
        conf.should_be_true()

        # make sure we didn't strings used
        init_data.should_be(b'some encrypted data')
        init_other_data.should_be(b'some other encrypted data')
        init_signed_info.should_be(b'some sig data')

        init_message[2].value.shouldnt_be(b'some encrypted data')
        init_message[3].value.shouldnt_be(b'some other encrypted data')

        (conf, qop) = gb.unwrap_iov(self.server_ctx, init_message)

        conf.should_be_a(bool)
        conf.should_be_true()

        qop.should_be_a(int)

        init_message[1].value.should_be(init_signed_info)
        init_message[2].value.should_be(init_data)
        init_message[3].value.should_be(init_other_data)
예제 #2
0
    def test_verify_mic_iov_bad_mic_raises_error(self):
        init_message = gb.IOV(b'some data',
                              (gb.IOVBufferType.sign_only, b'some sig data'),
                              (gb.IOVBufferType.mic_token, 'abaava'),
                              std_layout=False)

        # test a bad MIC
        gb.verify_mic_iov.should_raise(gb.GSSError, self.server_ctx,
                                       init_message)
예제 #3
0
    def test_get_mic_iov(self):
        init_message = gb.IOV(b'some data',
                              (gb.IOVBufferType.sign_only, b'some sig data'),
                              gb.IOVBufferType.mic_token,
                              std_layout=False)

        gb.get_mic_iov(self.client_ctx, init_message)

        init_message[2].type.should_be(gb.IOVBufferType.mic_token)
        init_message[2].value.shouldnt_be_empty()
예제 #4
0
    def test_basic_verify_mic_iov(self):
        init_message = gb.IOV(b'some data',
                              (gb.IOVBufferType.sign_only, b'some sig data'),
                              gb.IOVBufferType.mic_token,
                              std_layout=False)

        gb.get_mic_iov(self.client_ctx, init_message)

        init_message[2].type.should_be(gb.IOVBufferType.mic_token)
        init_message[2].value.shouldnt_be_empty()

        qop_used = gb.verify_mic_iov(self.server_ctx, init_message)

        qop_used.should_be_an_integer()