started with python binding

This commit is contained in:
TLINDEN
2014-12-14 14:38:30 +01:00
parent 6f47b86f98
commit 9e71b84c85
9 changed files with 886 additions and 0 deletions

View 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)