Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoSign in
Socket

pygcrypt

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pygcrypt - pypi Package Compare versions

Comparing version
0.9.9.post34
to
1.0.0
+2
-2
PKG-INFO
Metadata-Version: 1.1
Name: pygcrypt
Version: 0.9.9.post34
Version: 1.0.0
Summary: libgcrypt in Python
Home-page: https://framagit.org/okhin.pygcrypt/
Home-page: https://framagit.org/okhin/pygcrypt/
Author: okhin

@@ -7,0 +7,0 @@ Author-email: okhin@okhin.fr

Metadata-Version: 1.1
Name: pygcrypt
Version: 0.9.9.post34
Version: 1.0.0
Summary: libgcrypt in Python
Home-page: https://framagit.org/okhin.pygcrypt/
Home-page: https://framagit.org/okhin/pygcrypt/
Author: okhin

@@ -7,0 +7,0 @@ Author-email: okhin@okhin.fr

@@ -1,4 +0,4 @@

cffi==1.1.2
cffi
[test]
pytest

@@ -6,3 +6,2 @@ DESCRIPTION.md

pygcrypt/_gcrypt.py
pygcrypt/_gerror.py
pygcrypt/build_gcrypt.py

@@ -9,0 +8,0 @@ pygcrypt/build_gerror.py

@@ -15,3 +15,6 @@ #!/usr/bin/env python

# I want to have the source in a _gcrypt module
gcrypt_ffi.set_source("pygcrypt._gcrypt", None)
gcrypt_ffi.set_source("pygcrypt._gcrypt", r"""
#include <gcrypt.h>
""",
libraries=['gcrypt'])

@@ -52,19 +55,2 @@ # Now, let's build the gcrypt lib

gcrypt_ffi.cdef("""
/* NOTE: Since Libgcrypt 1.6 the thread callbacks are not anymore
used. However we keep it to allow for some source code
compatibility if used in the standard way. */
/* Wrapper for struct ath_ops. */
struct gcry_thread_cbs
{
/* The OPTION field encodes the thread model and the version number
of this structure.
Bits 7 - 0 are used for the thread model
Bits 15 - 8 are used for the version number. */
unsigned int option;
} _GCRY_ATTR_INTERNAL;
""")
gcrypt_ffi.cdef("""
/* A generic context object as used by some functions. */

@@ -71,0 +57,0 @@ struct gcry_context;

@@ -8,16 +8,13 @@ #!/usr/bin/env python

gerror_ffi = FFI()
gerror_ffi.set_source("pygcrypt._gerror", None)
gerror_ffi.set_source("pygcrypt._gerror", r"""
#include <gpg-error.h>
""",
libraries=['gpg-error'])
gerror_ffi.cdef("""
/* The error source type gpg_err_source_t. */
typedef enum
{
...
} gpg_err_source_t;
typedef enum { ... } gpg_err_source_t;
/* The error code type gpg_err_code_t. */
typedef enum
{
...
} gpg_err_code_t;
typedef enum { ... } gpg_err_code_t;

@@ -24,0 +21,0 @@ /* The error value type gpg_error_t. */

@@ -7,6 +7,6 @@ #!/usr/bin/env python

from . import errors
from .cgtypes.sexpression import SExpression
from .cgtypes.ec_point import Point
from .cgtypes.mpi import MPIint
from .cgtypes.key import Key
from .gctypes.sexpression import SExpression
from .gctypes.ec_point import Point
from .gctypes.mpi import MPIint
from .gctypes.key import Key

@@ -13,0 +13,0 @@ lib = ffi.dlopen(find_library("gcrypt"))

@@ -118,4 +118,3 @@ #!/usr/bien/env python

"""
We will iterate through the S-expression, using a counter and get_sexp_nth.
Return the car and the cdr in a tuple. Usefull for key: value stuff)
We will iterate through the S-expression, retruning each item as a SExpression.
"""

@@ -158,3 +157,3 @@ i = 0

return lib.gcry_sexp_sprint(self.sexp, fmt, ffi.NULL, 0)
def __len__(self):

@@ -161,0 +160,0 @@ """

@@ -10,2 +10,3 @@ #!/usr/bin/env python

@pytest.mark.skip(reason="Generating key takes time, so skip it.")
def test_generate_keys(context):

@@ -12,0 +13,0 @@ (priv, pub) = create_keys()

@@ -216,7 +216,2 @@ #!/usr/bin/env python

def test_randomize(context):
# If we have the same value have an issue
assert utils.randomize(1024) != utils.randomize(1024)
assert len(utils.randomize(1024)) == 1024
def test_flags(context):

@@ -223,0 +218,0 @@ a = utils.randomize(512)

@@ -71,2 +71,6 @@ #!/usr/bin/env python

def test_length(context):
s_expr = SExpression(b'(test (a "123")(b "-123"))')
assert len(s_expr) == 3
def test_fromdict(context):

@@ -81,11 +85,1 @@ dict_a = {'a': MPIint(1)}

assert str(SExpression.from_dict(dict_d)) == str(SExpression(b'(a (b %b)(c %d))', 4, "Test", 123))
def test_todict(context):
dict_a = {'a': MPIint(1)}
dict_b = {'a': "123"}
dict_c = {'a': "Hello World"}
dict_d = {'a': {'b': "Test", 'c': 123}}
assert dict_a == SExpression(b'(a %m)', MPIint(1)).to_dict()
assert dict_b == SExpression(b'(a %s)', "123").to_dict()
assert dict_c == SExpression(b'(a %b)', 11, "Hello World").to_dict()
assert dict_d == SExpression(b'(a (b %b)(c %d))', 4, "Test", 123).to_dict()

@@ -21,7 +21,9 @@ #!/usr/bin/env python

def test_utils_random(context):
assert len(utils.rand(128)) == 128
# Random number might start with a 0, which doesn't count in length
assert len(utils.rand(128)) <= 128
assert utils.rand(128) != utils.rand(128)
def test_utils_srandom(context):
assert len(utils.srand(128)) == 128
# Random number might start with a 0, which doesn't count in length
assert len(utils.srand(128)) <= 128
assert utils.srand(128) != utils.srand(128)

@@ -118,6 +118,4 @@ #!/usr/bin/env python

"""
mpi_c = lib.gcry_mpi_new(8)
lib.gcry_mpi_randomize(mpi_c, length, getattr(lib, 'GCRY_{}_RANDOM'.format(strength)))
m = mpi.MPIint()
m.mpi = lib.gcry_mpi_copy(ffi.cast("const gcry_mpi_t", mpi_c))
lib.gcry_mpi_randomize(m.mpi, length, getattr(lib, 'GCRY_{}_RANDOM'.format(strength)))
return m

@@ -124,0 +122,0 @@

@@ -28,3 +28,3 @@ #!/usr/bin/env python

# https://packaging.python.org/en/latest/single_source_version.html
version='0.9.9-34',
version='1.0.0',

@@ -35,3 +35,3 @@ description='libgcrypt in Python',

# The project's main homepage.
url='https://framagit.org/okhin.pygcrypt/',
url='https://framagit.org/okhin/pygcrypt/',

@@ -80,5 +80,5 @@ # Author details

# https://packaging.python.org/en/latest/requirements.html
setup_requires=['cffi==1.1.2'],
setup_requires=['cffi'],
cffi_modules=['pygcrypt/build_gerror.py:gerror_ffi', 'pygcrypt/build_gcrypt.py:gcrypt_ffi'],
install_requires=['cffi==1.1.2'],
install_requires=['cffi'],

@@ -85,0 +85,0 @@ # List additional groups of dependencies here (e.g. development

# auto-generated file
import _cffi_backend
ffi = _cffi_backend.FFI('pygcrypt._gerror',
_version = 0x2601,
_types = b'\x00\x00\x01\x0D\x00\x00\x25\x03\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x08\x01\x00\x00\x00\x0F\x00\x00\x0C\x0D\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x0C\x0D\x00\x00\x00\x0F\x00\x00\x07\x0D\x00\x00\x00\x0B\x00\x00\x00\x0F\x00\x00\x07\x0D\x00\x00\x08\x01\x00\x00\x25\x03\x00\x00\x1C\x01\x00\x00\x00\x0F\x00\x00\x04\x0D\x00\x00\x00\x0F\x00\x00\x16\x0D\x00\x00\x27\x03\x00\x00\x1C\x01\x00\x00\x00\x0F\x00\x00\x27\x0D\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x27\x0D\x00\x00\x15\x03\x00\x00\x00\x0F\x00\x00\x27\x0D\x00\x00\x23\x03\x00\x00\x20\x11\x00\x00\x00\x0F\x00\x00\x27\x0D\x00\x00\x00\x0F\x00\x00\x02\x01\x00\x00\x01\x0B\x00\x00\x00\x01',
_globals = (b'\x00\x00\x06\x23gpg_err_code_from_errno',0,b'\x00\x00\x09\x23gpg_err_code_from_syserror',0,b'\x00\x00\x0B\x23gpg_err_code_to_errno',0,b'\x00\x00\x19\x23gpg_err_deinit',0,b'\x00\x00\x13\x23gpg_err_init',0,b'\x00\x00\x19\x23gpg_err_set_errno',0,b'\x00\x00\x00\x23gpg_error_check_version',0,b'\x00\x00\x03\x23gpg_strerror',0,b'\x00\x00\x0E\x23gpg_strerror_r',0,b'\x00\x00\x03\x23gpg_strsource',0,b'\x00\x00\x00\x23gpgrt_check_version',0,b'\x00\x00\x1C\x23gpgrt_set_alloc_func',0,b'\x00\x00\x1F\x23gpgrt_set_syscall_clamp',0,b'\x00\x00\x09\x23gpgrt_yield',0),
_enums = (b'\x00\x00\x00\x0C\x00\x00\x00\x16$gpg_err_code_t\x00',b'\x00\x00\x00\x26\x00\x00\x00\x16$gpg_err_source_t\x00'),
_typenames = (b'\x00\x00\x00\x0Cgpg_err_code_t',b'\x00\x00\x00\x26gpg_err_source_t',b'\x00\x00\x00\x04gpg_error_t'),
)