コード例 #1
0
    def test_openssl_assert_error_on_stack(self):
        b = Binding()
        b.lib.ERR_put_error(b.lib.ERR_LIB_EVP, b.lib.EVP_F_EVP_ENCRYPTFINAL_EX,
                            b.lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH, b"",
                            -1)
        with pytest.raises(InternalError) as exc_info:
            _openssl_assert(b.lib, False)

        assert exc_info.value.err_code == [
            _OpenSSLErrorWithText(
                code=101183626,
                lib=b.lib.ERR_LIB_EVP,
                func=b.lib.EVP_F_EVP_ENCRYPTFINAL_EX,
                reason=b.lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH,
                reason_text=
                (b'error:0607F08A:digital envelope routines:EVP_EncryptFinal_'
                 b'ex:data not multiple of block length'))
        ]
コード例 #2
0
ファイル: test_openssl.py プロジェクト: Ayrx/cryptography
    def test_openssl_assert_error_on_stack(self):
        b = Binding()
        b.lib.ERR_put_error(
            b.lib.ERR_LIB_EVP,
            b.lib.EVP_F_EVP_ENCRYPTFINAL_EX,
            b.lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH,
            b"",
            -1
        )
        with pytest.raises(InternalError) as exc_info:
            _openssl_assert(b.lib, False)

        assert exc_info.value.err_code == [_OpenSSLErrorWithText(
            code=101183626,
            lib=b.lib.ERR_LIB_EVP,
            func=b.lib.EVP_F_EVP_ENCRYPTFINAL_EX,
            reason=b.lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH,
            reason_text=(
                b'error:0607F08A:digital envelope routines:EVP_EncryptFinal_'
                b'ex:data not multiple of block length'
            )
        )]