charm-crypto-lite 0.61.1__tar.gz → 0.61.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/PKG-INFO +2 -1
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_crypto_lite.egg-info/PKG-INFO +2 -1
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_crypto_lite.egg-info/SOURCES.txt +2 -1
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/pyproject.toml +24 -1
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/setup.py +46 -4
- charm_crypto_lite-0.61.2/tests/test_basic.py +144 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/MANIFEST.in +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/README.md +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_crypto_lite.egg-info/dependency_links.txt +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_crypto_lite.egg-info/requires.txt +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_crypto_lite.egg-info/top_level.txt +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/__init__.py +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/__init__.py +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/benchmark/benchmark_util.c +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/benchmark/benchmark_util.h +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/benchmark/benchmarkmodule.c +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/benchmark/benchmarkmodule.h +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/math/__init__.py +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/math/elliptic_curve/ecmodule.c +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/math/elliptic_curve/ecmodule.h +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/utilities/base64.c +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/utilities/base64.h +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/toolbox/PKEnc.py +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/toolbox/__init__.py +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/toolbox/eccurve.py +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/toolbox/ecgroup.py +0 -0
- {charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: charm-crypto-lite
|
|
3
|
-
Version: 0.61.
|
|
3
|
+
Version: 0.61.2
|
|
4
4
|
Summary: Lightweight elliptic curve cryptography from the Charm framework (OpenSSL-only, no GMP/PBC)
|
|
5
5
|
Author-email: "J. Ayo Akinyele" <jakinye3@jhu.edu>
|
|
6
6
|
Maintainer-email: "J. Ayo Akinyele" <jakinye3@jhu.edu>
|
|
@@ -14,6 +14,7 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
15
15
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
16
|
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
18
|
Classifier: Programming Language :: Python :: 3
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.8
|
|
19
20
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: charm-crypto-lite
|
|
3
|
-
Version: 0.61.
|
|
3
|
+
Version: 0.61.2
|
|
4
4
|
Summary: Lightweight elliptic curve cryptography from the Charm framework (OpenSSL-only, no GMP/PBC)
|
|
5
5
|
Author-email: "J. Ayo Akinyele" <jakinye3@jhu.edu>
|
|
6
6
|
Maintainer-email: "J. Ayo Akinyele" <jakinye3@jhu.edu>
|
|
@@ -14,6 +14,7 @@ Classifier: Intended Audience :: Developers
|
|
|
14
14
|
Classifier: Intended Audience :: Science/Research
|
|
15
15
|
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
16
|
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
18
|
Classifier: Programming Language :: Python :: 3
|
|
18
19
|
Classifier: Programming Language :: Python :: 3.8
|
|
19
20
|
Classifier: Programming Language :: Python :: 3.9
|
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
|
|
8
8
|
[project]
|
|
9
9
|
name = "charm-crypto-lite"
|
|
10
|
-
version = "0.61.
|
|
10
|
+
version = "0.61.2"
|
|
11
11
|
description = "Lightweight elliptic curve cryptography from the Charm framework (OpenSSL-only, no GMP/PBC)"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.8"
|
|
@@ -30,6 +30,7 @@ classifiers = [
|
|
|
30
30
|
"Intended Audience :: Science/Research",
|
|
31
31
|
"Operating System :: MacOS :: MacOS X",
|
|
32
32
|
"Operating System :: POSIX :: Linux",
|
|
33
|
+
"Operating System :: Microsoft :: Windows",
|
|
33
34
|
"Programming Language :: Python :: 3",
|
|
34
35
|
"Programming Language :: Python :: 3.8",
|
|
35
36
|
"Programming Language :: Python :: 3.9",
|
|
@@ -77,3 +78,25 @@ python_files = ["test_*.py"]
|
|
|
77
78
|
python_functions = ["test_*"]
|
|
78
79
|
addopts = "-v --tb=short"
|
|
79
80
|
|
|
81
|
+
[tool.cibuildwheel]
|
|
82
|
+
# Build for Python 3.8-3.13
|
|
83
|
+
build = "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*"
|
|
84
|
+
|
|
85
|
+
# Skip musllinux and PyPy
|
|
86
|
+
skip = "*-musllinux_* pp*"
|
|
87
|
+
|
|
88
|
+
# Test command to verify wheels work
|
|
89
|
+
test-command = "python -c \"from charm_lite.toolbox.ecgroup import ECGroup; print('OK')\""
|
|
90
|
+
|
|
91
|
+
[tool.cibuildwheel.linux]
|
|
92
|
+
archs = ["x86_64", "aarch64"]
|
|
93
|
+
before-all = "yum install -y openssl-devel || apt-get update && apt-get install -y libssl-dev"
|
|
94
|
+
|
|
95
|
+
[tool.cibuildwheel.macos]
|
|
96
|
+
archs = ["x86_64", "arm64"]
|
|
97
|
+
before-all = "brew install openssl@3"
|
|
98
|
+
|
|
99
|
+
[tool.cibuildwheel.windows]
|
|
100
|
+
archs = ["AMD64"]
|
|
101
|
+
before-all = "choco install openssl -y"
|
|
102
|
+
|
|
@@ -22,7 +22,7 @@ def get_openssl_paths():
|
|
|
22
22
|
system = platform.system()
|
|
23
23
|
inc_dirs = []
|
|
24
24
|
lib_dirs = []
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
if system == 'Darwin':
|
|
27
27
|
# macOS: Check for Homebrew installation (both Apple Silicon and Intel)
|
|
28
28
|
homebrew_prefixes = ['/opt/homebrew', '/usr/local']
|
|
@@ -49,10 +49,42 @@ def get_openssl_paths():
|
|
|
49
49
|
for inc_path in ['/usr/include', '/usr/local/include']:
|
|
50
50
|
if os.path.isdir(inc_path):
|
|
51
51
|
inc_dirs.append(inc_path)
|
|
52
|
-
for lib_path in ['/usr/lib', '/usr/local/lib', '/usr/lib/x86_64-linux-gnu'
|
|
52
|
+
for lib_path in ['/usr/lib', '/usr/local/lib', '/usr/lib/x86_64-linux-gnu',
|
|
53
|
+
'/usr/lib/aarch64-linux-gnu']:
|
|
53
54
|
if os.path.isdir(lib_path):
|
|
54
55
|
lib_dirs.append(lib_path)
|
|
55
|
-
|
|
56
|
+
elif system == 'Windows':
|
|
57
|
+
# Windows: Check common OpenSSL installation paths
|
|
58
|
+
openssl_paths = [
|
|
59
|
+
os.environ.get('OPENSSL_ROOT_DIR', ''),
|
|
60
|
+
r'C:\Program Files\OpenSSL-Win64',
|
|
61
|
+
r'C:\Program Files\OpenSSL',
|
|
62
|
+
r'C:\OpenSSL-Win64',
|
|
63
|
+
r'C:\OpenSSL',
|
|
64
|
+
]
|
|
65
|
+
for openssl_path in openssl_paths:
|
|
66
|
+
if openssl_path and os.path.exists(openssl_path):
|
|
67
|
+
inc_path = os.path.join(openssl_path, 'include')
|
|
68
|
+
lib_path = os.path.join(openssl_path, 'lib')
|
|
69
|
+
if os.path.isdir(inc_path):
|
|
70
|
+
inc_dirs.append(inc_path)
|
|
71
|
+
if os.path.isdir(lib_path):
|
|
72
|
+
lib_dirs.append(lib_path)
|
|
73
|
+
# Also check for VC subdirectory (some installers use this)
|
|
74
|
+
vc_lib = os.path.join(lib_path, 'VC')
|
|
75
|
+
if os.path.isdir(vc_lib):
|
|
76
|
+
lib_dirs.append(vc_lib)
|
|
77
|
+
break
|
|
78
|
+
# Also check environment variables
|
|
79
|
+
if 'INCLUDE' in os.environ:
|
|
80
|
+
for path in os.environ['INCLUDE'].split(';'):
|
|
81
|
+
if path and os.path.isdir(path) and path not in inc_dirs:
|
|
82
|
+
inc_dirs.append(path)
|
|
83
|
+
if 'LIB' in os.environ:
|
|
84
|
+
for path in os.environ['LIB'].split(';'):
|
|
85
|
+
if path and os.path.isdir(path) and path not in lib_dirs:
|
|
86
|
+
lib_dirs.append(path)
|
|
87
|
+
|
|
56
88
|
return inc_dirs, lib_dirs
|
|
57
89
|
|
|
58
90
|
# Get platform-specific paths
|
|
@@ -71,6 +103,16 @@ inc_dirs = [ec_path, utils_path, benchmark_path] + inc_dirs
|
|
|
71
103
|
# Benchmark enabled by default
|
|
72
104
|
_macros = [('BENCHMARK_ENABLED', '1')]
|
|
73
105
|
|
|
106
|
+
# Platform-specific library names
|
|
107
|
+
if platform.system() == 'Windows':
|
|
108
|
+
# Windows uses different library names
|
|
109
|
+
crypto_libs = ['libcrypto', 'libssl']
|
|
110
|
+
# Try alternative names if the above don't work
|
|
111
|
+
# Some OpenSSL builds use: libeay32, ssleay32 (older)
|
|
112
|
+
# Or: libcrypto-3-x64, libssl-3-x64 (OpenSSL 3.x)
|
|
113
|
+
else:
|
|
114
|
+
crypto_libs = ['crypto']
|
|
115
|
+
|
|
74
116
|
# EC module - OpenSSL ONLY, no GMP!
|
|
75
117
|
ecc_module = Extension(
|
|
76
118
|
'charm_lite.core.math.elliptic_curve',
|
|
@@ -79,7 +121,7 @@ ecc_module = Extension(
|
|
|
79
121
|
math_path + 'elliptic_curve/ecmodule.c',
|
|
80
122
|
utils_path + 'base64.c'
|
|
81
123
|
],
|
|
82
|
-
libraries=
|
|
124
|
+
libraries=crypto_libs, # OpenSSL only - NO GMP!
|
|
83
125
|
library_dirs=lib_dirs,
|
|
84
126
|
define_macros=_macros
|
|
85
127
|
)
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Basic tests for charm-crypto-lite wheel verification.
|
|
3
|
+
|
|
4
|
+
These tests verify that the core functionality works after installation.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def test_import_ecgroup():
|
|
11
|
+
"""Test that ECGroup can be imported."""
|
|
12
|
+
from charm_lite.toolbox.ecgroup import ECGroup, ZR, G
|
|
13
|
+
assert ECGroup is not None
|
|
14
|
+
assert ZR is not None
|
|
15
|
+
assert G is not None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_import_eccurve():
|
|
19
|
+
"""Test that eccurve module can be imported."""
|
|
20
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
21
|
+
assert secp256k1 is not None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_import_pkenc():
|
|
25
|
+
"""Test that PKEnc base class can be imported."""
|
|
26
|
+
from charm_lite.toolbox.PKEnc import PKEnc
|
|
27
|
+
assert PKEnc is not None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_ecgroup_initialization():
|
|
31
|
+
"""Test ECGroup initialization with secp256k1."""
|
|
32
|
+
from charm_lite.toolbox.ecgroup import ECGroup
|
|
33
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
34
|
+
|
|
35
|
+
group = ECGroup(secp256k1)
|
|
36
|
+
assert group is not None
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_generator():
|
|
40
|
+
"""Test getting the generator point."""
|
|
41
|
+
from charm_lite.toolbox.ecgroup import ECGroup
|
|
42
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
43
|
+
|
|
44
|
+
group = ECGroup(secp256k1)
|
|
45
|
+
g = group.generator()
|
|
46
|
+
assert g is not None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_random_scalar():
|
|
50
|
+
"""Test generating random scalars."""
|
|
51
|
+
from charm_lite.toolbox.ecgroup import ECGroup, ZR
|
|
52
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
53
|
+
|
|
54
|
+
group = ECGroup(secp256k1)
|
|
55
|
+
x = group.random(ZR)
|
|
56
|
+
assert x is not None
|
|
57
|
+
|
|
58
|
+
# Two random scalars should be different (with overwhelming probability)
|
|
59
|
+
y = group.random(ZR)
|
|
60
|
+
assert x != y
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_scalar_multiplication():
|
|
64
|
+
"""Test scalar multiplication (g ** x)."""
|
|
65
|
+
from charm_lite.toolbox.ecgroup import ECGroup, ZR
|
|
66
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
67
|
+
|
|
68
|
+
group = ECGroup(secp256k1)
|
|
69
|
+
g = group.generator()
|
|
70
|
+
x = group.random(ZR)
|
|
71
|
+
|
|
72
|
+
# Scalar multiplication
|
|
73
|
+
pk = g ** x
|
|
74
|
+
assert pk is not None
|
|
75
|
+
|
|
76
|
+
# Result should be different from generator
|
|
77
|
+
assert pk != g
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_point_addition():
|
|
81
|
+
"""Test point addition (p1 * p2)."""
|
|
82
|
+
from charm_lite.toolbox.ecgroup import ECGroup, ZR
|
|
83
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
84
|
+
|
|
85
|
+
group = ECGroup(secp256k1)
|
|
86
|
+
g = group.generator()
|
|
87
|
+
x = group.random(ZR)
|
|
88
|
+
y = group.random(ZR)
|
|
89
|
+
|
|
90
|
+
p1 = g ** x
|
|
91
|
+
p2 = g ** y
|
|
92
|
+
|
|
93
|
+
# Point addition
|
|
94
|
+
p3 = p1 * p2
|
|
95
|
+
assert p3 is not None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def test_serialization():
|
|
99
|
+
"""Test serialization and deserialization."""
|
|
100
|
+
from charm_lite.toolbox.ecgroup import ECGroup, ZR
|
|
101
|
+
from charm_lite.toolbox.eccurve import secp256k1
|
|
102
|
+
|
|
103
|
+
group = ECGroup(secp256k1)
|
|
104
|
+
g = group.generator()
|
|
105
|
+
x = group.random(ZR)
|
|
106
|
+
pk = g ** x
|
|
107
|
+
|
|
108
|
+
# Serialize
|
|
109
|
+
data = group.serialize(pk)
|
|
110
|
+
assert data is not None
|
|
111
|
+
assert len(data) > 0
|
|
112
|
+
|
|
113
|
+
# Deserialize
|
|
114
|
+
pk2 = group.deserialize(data)
|
|
115
|
+
assert pk2 is not None
|
|
116
|
+
|
|
117
|
+
# Should be equal
|
|
118
|
+
assert pk == pk2
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def test_pkenc_subclass():
|
|
122
|
+
"""Test that PKEnc can be subclassed."""
|
|
123
|
+
from charm_lite.toolbox.PKEnc import PKEnc
|
|
124
|
+
|
|
125
|
+
class MyScheme(PKEnc):
|
|
126
|
+
def __init__(self):
|
|
127
|
+
super().__init__()
|
|
128
|
+
|
|
129
|
+
def keygen(self):
|
|
130
|
+
return None
|
|
131
|
+
|
|
132
|
+
def encrypt(self, pk, msg):
|
|
133
|
+
return None
|
|
134
|
+
|
|
135
|
+
def decrypt(self, sk, ct):
|
|
136
|
+
return None
|
|
137
|
+
|
|
138
|
+
scheme = MyScheme()
|
|
139
|
+
assert scheme is not None
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
if __name__ == '__main__':
|
|
143
|
+
pytest.main([__file__, '-v'])
|
|
144
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_crypto_lite.egg-info/requires.txt
RENAMED
|
File without changes
|
{charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_crypto_lite.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/benchmark/benchmark_util.c
RENAMED
|
File without changes
|
{charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/benchmark/benchmark_util.h
RENAMED
|
File without changes
|
{charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/benchmark/benchmarkmodule.c
RENAMED
|
File without changes
|
{charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/benchmark/benchmarkmodule.h
RENAMED
|
File without changes
|
|
File without changes
|
{charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/math/elliptic_curve/ecmodule.c
RENAMED
|
File without changes
|
{charm_crypto_lite-0.61.1 → charm_crypto_lite-0.61.2}/charm_lite/core/math/elliptic_curve/ecmodule.h
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|