{"id":22111714,"url":"https://github.com/agentmaker/agentencryption","last_synced_at":"2025-06-14T05:05:46.739Z","repository":{"id":46249296,"uuid":"421673195","full_name":"AgentMaker/AgentEncryption","owner":"AgentMaker","description":"飞桨模型加密库","archived":false,"fork":false,"pushed_at":"2021-11-13T12:01:44.000Z","size":160,"stargazers_count":10,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-05T01:48:36.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AgentMaker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-27T04:13:33.000Z","updated_at":"2024-04-16T08:00:13.000Z","dependencies_parsed_at":"2022-09-19T06:00:49.593Z","dependency_job_id":null,"html_url":"https://github.com/AgentMaker/AgentEncryption","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AgentMaker/AgentEncryption","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgentMaker%2FAgentEncryption","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgentMaker%2FAgentEncryption/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgentMaker%2FAgentEncryption/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgentMaker%2FAgentEncryption/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgentMaker","download_url":"https://codeload.github.com/AgentMaker/AgentEncryption/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgentMaker%2FAgentEncryption/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259763075,"owners_count":22907408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T10:51:24.937Z","updated_at":"2025-06-14T05:05:46.720Z","avatar_url":"https://github.com/AgentMaker.png","language":"Python","readme":"# AgentEncryption\n飞桨模型加密库 - EAP阶段  \n在分发加密模型时，请务必进行不限于以下的操作方可避免轻易破解    \n- [x] 加密深度学习框架以及其相关的Python库，至少为pyd格式\n- [x] 加密AgentEncryption库，至少为pyd格式\n- [x] 限制用户只能使用你提供的Python环境\n\n\n\n\u003e 飞桨推理模型加密可参考[从内存中加载加密飞桨推理模型](./example/paddlepaddle)\n\u003e 1. [加密飞桨模型](./example/paddlepaddle/make_model.py)\n\u003e 2. [借助PPQI推理加密的飞桨模型](./example/paddlepaddle/test_model_ppqi.py)\n\u003e 3. [借助PaddleInference推理加密的飞桨模型](./example/paddlepaddle/test_model_paddleinference.py)\n\n## 快速使用\n* 如下是几个简单的示例代码：\n    * 数据加密：\n\n        ```python\n        # 导入 RSA 加密器\n        from agentenc import RSAEncryptor\n\n        # 初始化 RSA 加密器\n        encryptor = RSAEncryptor(bits=1024)\n\n        # 构建原始数据\n        pure_data = {\n            'int': 100,\n            'float': 0.01,\n            'str': 'hello',\n            'list': [100, 0.01, 'hello']\n        }\n\n        # 数据加密\n        key = encryptor.encode(\n            input=pure_data, \n            output='out', \n            format='pkl', \n            keys_saving_path='key'\n        )\n\n        # 打印随机生成的密钥\n        print(key) \n\n        '''\n        {\n            'private_key': b'-----BEGIN RSA PRIVATE KEY-----\\nMIICXAIBAAKBgQ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2crNi/xSs2Wa6k1bN\\nkxNFUehEd4ExpYFwLQIDAQAB\\n-----END PUBLIC KEY-----'\n        }\n        '''\n\n        # 使用解密函数对文件进行解密\n        data = RSAEncryptor.decode(\n            inp='out.pkl', \n            private_key=key['private_key']\n        )\n\n        # 输入与输出数据对比\n        print(data == pure_data) \n        \n        '''\n        True\n        '''\n        ```\n\n    * 数据解密：\n\n        ```python\n        # 导入基础加密器\n        from agentenc import Encryptor\n\n        # 读取私钥\n        private_key = open('key.PRIVATE', 'rb').read() \n        \n        # 使用解密函数对文件进行解密\n        data = Encryptor.decode(\n            inp='out.pkl', \n            private_key=private_key\n        )\n\n        # 输入与输出数据对比\n        print(data)\n\n        '''\n        {\n            'int': 100, \n            'float': 0.01, \n            'str': 'hello', \n            'list': [100, 0.01, 'hello']\n        }\n        '''\n        ```\n\n## Contact us\nEmail : [agentmaker@163.com]()\u003cbr\u003e\nQQ Group : 1005109853\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentmaker%2Fagentencryption","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagentmaker%2Fagentencryption","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentmaker%2Fagentencryption/lists"}