X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=ctypescrypto%2Fpkey.py;h=56e8746ecb919201bf5fcdde568c91f3225c24e7;hb=3ddc0864d900227434283bfc5956e0c4342a6b01;hp=a561ddf23df08bbb7daea0e777ffe00c690b9595;hpb=2f721f8751a08e35ae3a8a63dd53e2d9ab216c47;p=oss%2Fctypescrypto.git diff --git a/ctypescrypto/pkey.py b/ctypescrypto/pkey.py index a561ddf..56e8746 100644 --- a/ctypescrypto/pkey.py +++ b/ctypescrypto/pkey.py @@ -1,13 +1,27 @@ +""" +This module provides interface for low-level private/public keypair operation + +PKey object of this module is wrapper around OpenSSL EVP_PKEY object. +""" + + from ctypes import c_char_p,c_void_p,byref,c_int,c_long, c_longlong, create_string_buffer,CFUNCTYPE,POINTER from ctypescrypto import libcrypto from ctypescrypto.exception import LibCryptoError,clear_err_stack from ctypescrypto.bio import Membio import sys + +__all__ = ['PKeyError','password_callback','PKey'] class PKeyError(LibCryptoError): pass CALLBACK_FUNC=CFUNCTYPE(c_int,c_char_p,c_int,c_int,c_char_p) def password_callback(buf,length,rwflag,u): + """ + Example password callback for private key. Assumes that + password is store in the userdata parameter, so allows to pass password + from constructor arguments to the libcrypto keyloading functions + """ cnt=len(u) if length