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.1-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

modellock-0.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.1 MB view details)

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

modellock-0.2.1-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.1-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

modellock-0.2.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (2.3 MB view details)

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

modellock-0.2.1-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.1-cp311-cp311-win_amd64.whl (768.2 kB view details)

Uploaded CPython 3.11Windows x86-64

modellock-0.2.1-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.1-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.1-cp310-cp310-win_amd64.whl (385.4 kB view details)

Uploaded CPython 3.10Windows x86-64

modellock-0.2.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (735.7 kB view details)

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

modellock-0.2.1-cp310-cp310-macosx_11_0_universal2.whl (844.7 kB view details)

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

File details

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

File metadata

  • Download URL: modellock-0.2.1-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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bc8c4e9237343ecd985b22b94f2c5bb591e9bfcb049850d0aa36a116d64285e4
MD5 9b947aa00a7e41112831fc143db52493
BLAKE2b-256 abe76c055f6078abea90a707bc1a12ff0e75d251a78a56ff45419e47cc95d40d

See more details on using hashes here.

File details

Details for the file modellock-0.2.1-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.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9323ad63fd69eea492034ac6151ea3305a599c55698631f0dbe6b4b66d5e5d2c
MD5 2092dc09c2b193a2f97a3833c9bbfedb
BLAKE2b-256 d2af6baaf83be275d92625690864e1b45809163a4a0ab7deeee3b073cd4eb4ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modellock-0.2.1-cp313-cp313-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 1af891d209a20ab4a71cde7df980a44fdf1f3fcdc5ff2cdfe06c17a97a0c2d78
MD5 6f7a8db0c420241c920ac785293ceed9
BLAKE2b-256 c3a1f883c2048134880730bdef0a1ea8f4c8273ac3a34476983ebe4fa9af8cdc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: modellock-0.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.2 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b56bc438f739e0a817bfb28edc9f0dc54c8d29b6845d71c0d98fb6d7714d1b05
MD5 1b69b12434993f44c552048e858886a7
BLAKE2b-256 56c4ec3b0cf08e47a6be337688d41e42ce31476c6aa96164a77ddf825fca2153

See more details on using hashes here.

File details

Details for the file modellock-0.2.1-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.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f639415fcd31bfaf7ec94b1f917e8a38f91b99328236f98a28f829c7119ff5de
MD5 4da0081e49255fcf21e51cf7f038b6c7
BLAKE2b-256 9f5015b6345dba56117981c487c9308244d5e58a22750351715f07fcc39e0db0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modellock-0.2.1-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 3c8c4c061e97ad09df318342dbf462c16fc35cd5446ea29053513e21494b35a6
MD5 f9d7dc6e722737fb4f0136fc0d90f524
BLAKE2b-256 faf3ed8e74d55aa223a59765988145fd2178820378590315be792ec49f508948

See more details on using hashes here.

File details

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

File metadata

  • Download URL: modellock-0.2.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 768.2 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 25895b5a08c0abbf9e67e75f6f016c332c0d4a9241c893cecb44a93ab5173fe3
MD5 34529db21d46951b2f6da2a0b97cf72d
BLAKE2b-256 dee59e2fa85e128a0c961900e9fcac01d0060144d7805625dd6eb174e62737e5

See more details on using hashes here.

File details

Details for the file modellock-0.2.1-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.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5e72cbb178902a0fc75e1c464e1e634935ade57aaedee5c7d22be3555d8e3bb7
MD5 dc247527090607ffa73870b08c0a70bd
BLAKE2b-256 bcdd05f81d3255c6220b96c4f7a8b524adae9dc6635f0674e2e5643b9dd59ea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modellock-0.2.1-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 06ae8243b3ace597a965c910f2077b53c2d9560ec68a3a9907f24f3821728efa
MD5 57dd9954b7704f3019e33d3f8495c6b2
BLAKE2b-256 dbc47ce0cae550a57511632f950aaea8d516d81c437248cc03473f14fc1d7f12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: modellock-0.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 385.4 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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cd68cc30e03cf69d685ed06a71ba5865ec9bd30cf86c45f47e912a97401c338a
MD5 b56703ddabc9acbcb409fe71763755ee
BLAKE2b-256 f99782d2ac4127422b3b10ca1f90d0e8454eb7ebb570912174810876c70e4206

See more details on using hashes here.

File details

Details for the file modellock-0.2.1-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.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 26fb0608f03baf6e3b4371bc97ed74a812d8124df7e876d00c714111ea775cee
MD5 55c3d49aa5d1361d55480be23fedc7fc
BLAKE2b-256 aa2f14e9d380a67c559790bb8faa12166aa5fecedbb9f33a8fe2dce787db2e5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for modellock-0.2.1-cp310-cp310-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 9b234ff48e785d19934ba2548b41b3481738595ceb509af9fc690d0b68f0a7b1
MD5 b25a87412988ecc27b97b2724115db50
BLAKE2b-256 2984833965babc528959835a78f818fba813f31f5b8eb081447720881fffaff8

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