@@ -35,7 +35,7 @@ import pygit2
3535
3636plugin = ctypes .cdll .LoadLibrary (os .path .join (os .path .dirname (__file__ ),
3737 'incrypt-plugin.so' ))
38- plugin .setkey .argtypes = [ctypes .c_void_p ]
38+ plugin .setcryptkey .argtypes = [ctypes .c_void_p ]
3939plugin .encryptdata .argtypes = [
4040 ctypes .c_void_p , ctypes .c_size_t ,
4141 ctypes .c_void_p , ctypes .POINTER (ctypes .c_size_t )]
@@ -77,7 +77,7 @@ decrypt the repository using
7777
7878def encryptdata (data : bytes , key : bytes ) -> (bytes , bytes ):
7979 'encrypt raw data'
80- plugin .setkey (key )
80+ plugin .setcryptkey (key )
8181 output = ctypes .create_string_buffer (len (data ) + 16 )
8282 poutput = ctypes .c_void_p (ctypes .addressof (output ))
8383 outlen = ctypes .c_size_t (0 )
@@ -88,7 +88,7 @@ def encryptdata(data: bytes, key: bytes) -> (bytes, bytes):
8888
8989def decryptdata (ciphertext : bytes , key : bytes ) -> bytes :
9090 'decrypt raw data'
91- plugin .setkey (key )
91+ plugin .setcryptkey (key )
9292 output = ctypes .create_string_buffer (len (ciphertext ) + 16 )
9393 poutput = ctypes .c_void_p (ctypes .addressof (output ))
9494 outlen = ctypes .c_size_t (0 )
@@ -99,7 +99,7 @@ def decryptdata(ciphertext: bytes, key: bytes) -> bytes:
9999
100100def encryptrefname (ref , key ):
101101 'encrypt a refname'
102- plugin .setkey (key )
102+ plugin .setcryptkey (key )
103103 output = ctypes .create_string_buffer (
104104 math .ceil ((20 + len (ref ) + 16 ) * 4 / 3 ) + 1 )
105105 poutput = ctypes .c_void_p (ctypes .addressof (output ))
@@ -109,7 +109,7 @@ def encryptrefname(ref, key):
109109
110110def decryptrefname (ref , key ):
111111 'decrypt a refname'
112- plugin .setkey (key )
112+ plugin .setcryptkey (key )
113113 output = ctypes .create_string_buffer (math .floor (len (ref ) * 3 / 4 ) - 20 + 1 )
114114 poutput = ctypes .c_void_p (ctypes .addressof (output ))
115115 plugin .decryptrefname (ref .encode ('utf-8' ), poutput )
@@ -119,7 +119,7 @@ def decryptrefname(ref, key):
119119# pylint: disable=pointless-string-statement
120120'''
121121mykey = b'x123456789abcdefy123456789abcdefz123456789abcdef'
122- plugin.setkey (mykey)
122+ plugin.setcryptkey (mykey)
123123orig = 'o?o?o?~~~a'
124124print(orig)
125125encoded = encryptrefname(orig, mykey)
0 commit comments