Exemple #1
0
    def init(self):
        # type: () -> int
        """Obtain a functional reference to the engine.

        @return: 0 on error, non-zero on success."""
        return m2.engine_init(self._ptr)
Exemple #2
0
# vim: sts=4 sw=4 et
"""
M2Crypto wrapper for OpenSSL ENGINE API.

Pavel Shramov
IMEC MSU
"""

from M2Crypto import m2, EVP, X509, Err

class EngineError(Exception): pass

m2.engine_init(EngineError)

class Engine:
    """Wrapper for ENGINE object."""

    m2_engine_free = m2.engine_free
    
    def __init__(self, id = None, _ptr = None, _pyfree = 1):
        """Create new Engine from ENGINE pointer or obtain by id"""
        if not _ptr and not id:
            raise ValueError("No engine id specified")
        self._ptr = _ptr
        if not self._ptr:
            self._ptr = m2.engine_by_id(id)
            if not self._ptr:
                raise ValueError("Unknown engine: %s" % id)
        self._pyfree = _pyfree

    def __del__(self):
Exemple #3
0
    def init(self):
        """Obtain a functional reference to the engine.

        @return: 0 on error, non-zero on success."""
        return m2.engine_init(self._ptr)