Skip to main content

AI 模型加密保护与授权系统

Project description

ModelLock - AI 模型加密保护与授权系统

ModelLock 是一个用于加密和授权机器学习模型的工具。它提供了基于密码的文件加密功能,以及基于设备指纹的许可证管理系统,确保只有授权设备才能解密和使用加密的模型。

功能特性

  • 基于密码的文件加密(使用 AES-GCM 算法)
  • 设备指纹识别(跨平台支持)
  • 许可证管理(带有效期控制)
  • 命令行界面(CLI)便于集成和使用
  • 安全的密钥派生(使用 PBKDF2)
  • Python API 接口便于程序集成
  • 支持直接提供主密钥进行解密(适用于特殊场景)
  • 支持创建无设备绑定的许可证
  • 增加from model.lock import lock 支持,用于程序快速加密

快速开始

安装

pip install modellock

或从源码安装:

git clone https://github.com/yaqiangsun/modellock.git
cd modellock
pip install -e .

使用流程示例

  1. 准备阶段

    # 生成服务器密钥(**必须妥善保管生成文件且不能分享给他人**)
    bash ./scripts/run0_generate_server_secret.sh
    
    # 生成密钥文件与master_key文件(**必须妥善保管生成文件且不能分享给他人**)
    bash ./scripts/run1_generate_keyfile.sh
    
    # 加密模型文件(**加密后的文件可以分享给授权使用**)
    bash ./scripts/run2_encrypt_file.sh
    
    # 收集目标设备信息 (**不限制使用**)
    bash ./scripts/run3_collect_device.sh
    
    # 为目标设备创建许可证(**生成文件可分享给授权使用**)
    bash ./scripts/run4_create_license.sh
    

    上述生成的文件 只将 加密后的模型文件、许可证文件分发给授权使用。

  2. 部署和使用

    # 在目标设备上解密模型 (**为保证模型安全,只能在内存中解密,且解密代码需编译以保证源码不可见**)
    ./scripts/run5_decrypt_file.sh
    

    解密形式包含两种:1.提供密钥文件与密码,自动生成master_key内容解密;2.直接提供master_key解密

所有中间文件和输出文件都会保存在 tmp/ 目录下。

重要安全提示

在使用 ModelLock 过程中会生成多个敏感文件,这些文件或内容必须妥善保管且不能分享给他人

  • password - 密码,用户自定义的密码
  • server_secret.key - 服务器密钥文件,用于许可证加密(步骤0生成服务密钥中生成的内容)
  • keyfile.json - 密钥文件,包含加密相关信息(步骤1生成密钥种子中生成的内容)

这些文件或内容能够授权使用可分享给授权的使用者

请务必遵循此安全提示,防止未授权访问。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

modellock-0.2.2-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

modellock-0.2.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

modellock-0.2.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

modellock-0.2.2-cp313-cp313-macosx_11_0_universal2.whl (3.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ universal2 (ARM64, x86-64)

modellock-0.2.2-cp312-cp312-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.12Windows x86-64

modellock-0.2.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

modellock-0.2.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (2.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

modellock-0.2.2-cp312-cp312-macosx_11_0_universal2.whl (2.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ universal2 (ARM64, x86-64)

modellock-0.2.2-cp311-cp311-win_amd64.whl (759.3 kB view details)

Uploaded CPython 3.11Windows x86-64

modellock-0.2.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

modellock-0.2.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

modellock-0.2.2-cp311-cp311-macosx_11_0_universal2.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

modellock-0.2.2-cp310-cp310-win_amd64.whl (380.2 kB view details)

Uploaded CPython 3.10Windows x86-64

modellock-0.2.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (731.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

modellock-0.2.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (677.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

modellock-0.2.2-cp310-cp310-macosx_11_0_universal2.whl (838.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file modellock-0.2.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: modellock-0.2.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for modellock-0.2.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 67617a9ece39378c363eeb286ff6729237f958bc81a484615f093004bc3ca504
MD5 fbb2e8b1247039b5df3ed1b14087e09f
BLAKE2b-256 3186395992359d4e39df1b08cfbdfab4830daa8090d6f45260d1240306546cb6

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2dcb156488beab339dc148222ecaf20dac057fc29f77cfd32f2612c573ee22c4
MD5 109ec143cb392049075ce27bce926d68
BLAKE2b-256 2544813cedb0424ccaef7c81fb3fbc894c3169efb4693c1a59fee58d495cba69

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3ece4290687c44cad24f5f13003d881d5df20a7357bc21494241fcf1d08b1b4a
MD5 3a6afb36c1a7908a09a945c0a292b61a
BLAKE2b-256 da854d633769253ad4ca36cc96cb598499f5994ffc3865bca5ef8c61941ff3b6

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp313-cp313-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp313-cp313-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 80d2d59fc72671f64d6095548f92a05c4c7958706a0cea55efd4f92d19e89098
MD5 7c993727f5c48e7f39c33ce01daf8502
BLAKE2b-256 bc41a8b0e3933f927c0e946194ca4fd5edccc90b230c1bb490e43e3538d63a24

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: modellock-0.2.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for modellock-0.2.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a94fc585c452df40fc3d4d1c7a7999fb3e12ba3413812b0db7e34cc14326931e
MD5 155c6d13cc002b615a696689565bdb28
BLAKE2b-256 c14759d2a7e4feab58505355c2b207f1bd8b2441c523b0457c6dcc7e1a8274e0

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 820cab8c2a18b2f5b9a94377566463af421bed3f8a907e9a26273085054127df
MD5 5b5bb8a220d6e5a904f7e56b1efaaf31
BLAKE2b-256 a37c07bc11c24575cf48809601a1e09f4f73fbc1476b7c7708f01f2568a5ac00

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ad2e9be55c92ddaccc4fbdc1c6fda62db0484a1374964b2eccfba041ef9c0f77
MD5 e34e01d07e7a19e959f2a7cca338ae45
BLAKE2b-256 37ee9630976c2b04072a8fc168150ff65ac21deb156b964561ba2e55f2dda9fc

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp312-cp312-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 45e52a9aa1bec1a2a85cef2ae11f3bc90b18bcfd570bc72adbd2892fec4c6bec
MD5 9bfbf11adc427e2ededef49dc7c59111
BLAKE2b-256 ab0d6b4ed3714d1a78c996a86a50b7cb6900bcc1aa88d41b5e67c3c6a3a55ef9

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: modellock-0.2.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 759.3 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for modellock-0.2.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 38ff5e0406202a42f9d93792c5cb5fc3aed54119b9278d0b7739bf309e05d63b
MD5 6c10edf57a0beb3d8ae5147978d44881
BLAKE2b-256 2411e2f1aa63e8f113c993a70d0640b33d186a593005e48fa2629c7a27f686c0

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fb098213b18713d551cf06c0a6f77ec76e1de5b8466aa9fa0771307625b5715d
MD5 ba3524a6167bf120141c4a07047c36cf
BLAKE2b-256 f4439e5a59ce38f3555ef6acc66951aee4ee63747bd91d84210c5d27f5455339

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b1de96a37aab9cbdd7d105286c189c098da1962045f02bf7e1b47878f6987336
MD5 5b4964d2f08e1af6e2d7a57ea87dc262
BLAKE2b-256 b474871a54c5a686d986cdaeb2ea68dc18bdf8b71e33c6d9675488420e628751

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 703424237309fb33f6d2285e4daa493118705958b5936460cc2606ab49fd561e
MD5 b7f9a6492603bb2940138f66e6325ec8
BLAKE2b-256 52c9c5d7e6e3401dfb5cf29ccbab4eec3c887d5ec9dd12bfb788b510cdf3525f

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: modellock-0.2.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 380.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for modellock-0.2.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 95ef0d69a6a723a4a4c6bbff4bee5691f5758dc4604045cf41dce46e2b207541
MD5 89191f74c223b61486883bbc100e8d59
BLAKE2b-256 0c9b8f8223e5cfc5ca38630fcf08883a168c9ab634e97e96f1d35bb72bea1700

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 129847b86a90693573bf1b509b73c8d4b49ba1f0cc33cf2ae6cb45d1a5c9abc8
MD5 446238e13a6d7cceb67e50fbcd8b82e2
BLAKE2b-256 26502e88d09178134a29f94bf2b3b17b809ca2ee1a97068448e46dc1ef2ec106

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 230cc3693ba6514357455e2fc46774a30db5b6bdb5cade7a12f411fb13b38919
MD5 1005e2fa24c17f8e228c10702d35a2bf
BLAKE2b-256 7fe9e0a8ceb37def655cffd4a71d1b75c79f524e2c31f324ca6751fa19d82b9a

See more details on using hashes here.

File details

Details for the file modellock-0.2.2-cp310-cp310-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for modellock-0.2.2-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 1f2abbe38118c7cf05e03850474b7103455fca4ae8159461ec6829212f8588ef
MD5 5d0b87a273315fdf4c5d98caafc28474
BLAKE2b-256 adc74ac6a77addeb8c07f61bac1c01f4e1b51c207779c7cc0bfb40a7e8159ead

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page