Пример #1
0
import abi
import sys

__m = abi.load("script.module.libtorrent", "libtorrent")
import sys
sys.modules[__name__] = __m
Пример #2
0
# -*- coding: utf-8 -*-
'''
Wrap libsodium routines
'''
# pylint: disable=C0103
# Import libnacl libs
from libnacl.version import __version__
# Import python libs
import ctypes
import sys
import abi
import os

mdll = abi.load("script.module.libnacl", "libsodium", None, True, True)

__SONAMES = (18, 17, 13, 10, 5, 4)


def _get_nacl():
    '''
    Locate the nacl c libs to use
    '''
    # Import libsodium
    if sys.platform.startswith('win'):
        try:
            return mdll
        except OSError:
            pass
        for soname_ver in __SONAMES:
            try:
                return ctypes.cdll.LoadLibrary(
Пример #3
0
"""
Plyvel, a fast and feature-rich Python interface to LevelDB.
"""

# Only import the symbols that are part of the public API
import abi
from ._version import __version__

_plyvel = abi.load("script.module.plyvel", "_plyvel")
__leveldb_version__ = _plyvel.__leveldb_version__
DB = _plyvel.DB
repair_db = _plyvel.repair_db
destroy_db = _plyvel.destroy_db
Error = _plyvel.Error
IOError = _plyvel.IOError
CorruptionError = _plyvel.CorruptionError
IteratorInvalidError = _plyvel.IteratorInvalidError
Пример #4
0
import abi
import sys

__m = abi.load("script.module.apsw", "apsw")
import sys
sys.modules[__name__] = __m
Пример #5
0
M2Crypto can also be used to provide SSL for Twisted. Smartcards supported
through the Engine interface.

Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved.

Portions created by Open Source Applications Foundation (OSAF) are
Copyright (C) 2004-2007 OSAF. All Rights Reserved.

Copyright 2008-2011 Heikki Toivonen. All rights reserved.
"""

version_info = (0, 21, 1)
version = '.'.join([str(_v) for _v in version_info])

import abi
__m2crypto = abi.load("script.module.m2crypto", "__m2crypto")
import m2
import ASN1
import AuthCookie
import BIO
import BN
import Rand
import DH
import DSA
if m2.OPENSSL_VERSION_NUMBER >= 0x90800F and m2.OPENSSL_NO_EC == 0:
    import EC
import Err
import Engine
import EVP
import RSA
import RC4
Пример #6
0
import abi

__m = abi.load("script.module.cffi", "_cffi_backend")
import sys
sys.modules[__name__] = __m
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.

from __future__ import absolute_import, division, print_function

import hmac
from cffi import _cffi_backend

import abi
lib = abi.load("script.module.cryptography", "_constant_time").lib

if hasattr(hmac, "compare_digest"):
    def bytes_eq(a, b):
        if not isinstance(a, bytes) or not isinstance(b, bytes):
            raise TypeError("a and b must be bytes.")

        return hmac.compare_digest(a, b)

else:
    def bytes_eq(a, b):
        if not isinstance(a, bytes) or not isinstance(b, bytes):
            raise TypeError("a and b must be bytes.")

        return lib.Cryptography_constant_time_bytes_eq(
            a, len(a), b, len(b)
        ) == 1
Пример #8
0
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.

from __future__ import absolute_import, division, print_function

import collections
import os
import threading
import types
import warnings
import abi

from cryptography.exceptions import InternalError
from _openssl import ffi, lib
_openssl = abi.load("script.module.cryptography", "_openssl")
_ffi = _openssl.ffi
lib = _openssl.lib
from cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES

_OpenSSLError = collections.namedtuple("_OpenSSLError",
                                       ["code", "lib", "func", "reason"])


def _consume_errors(lib):
    errors = []
    while True:
        code = lib.ERR_get_error()
        if code == 0:
            break
Пример #9
0
import abi
import sys

__m = abi.load("script.module.netifaces", "netifaces")
import sys
sys.modules[__name__] = __m