mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 12:00:56 +01:00
started with python binding
This commit is contained in:
25
bindings/py/pypcp/__init__.py
Normal file
25
bindings/py/pypcp/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from cffi import FFI
|
||||
from pypcp.dll import *
|
||||
|
||||
__all__ = ('raw Key'.split() )
|
||||
|
||||
|
||||
class Key(object):
|
||||
def __init__(self, owner=None, mail=None, sk=None):
|
||||
self._sk = None
|
||||
if owner or mail:
|
||||
if not owner:
|
||||
owner=''
|
||||
if not mail:
|
||||
mail=''
|
||||
self.generate(owner, mail)
|
||||
|
||||
def generate(self, owner=None, mail=None):
|
||||
self._sk = libpcp.pcpkey_new()
|
||||
if owner:
|
||||
libpcp.pcpkey_setowner(self._sk, owner, mail)
|
||||
|
||||
def dump(self):
|
||||
if self._sk:
|
||||
libpcp.pcp_dumpkey(self._sk)
|
||||
|
||||
Reference in New Issue
Block a user