CN107808101B - 一种通过加密Python明文源码token的知识产权保护系统 - Google Patents
一种通过加密Python明文源码token的知识产权保护系统 Download PDFInfo
- Publication number
- CN107808101B CN107808101B CN201711079318.3A CN201711079318A CN107808101B CN 107808101 B CN107808101 B CN 107808101B CN 201711079318 A CN201711079318 A CN 201711079318A CN 107808101 B CN107808101 B CN 107808101B
- Authority
- CN
- China
- Prior art keywords
- python
- interpreter
- source code
- encryption
- ciphertext
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 241001521293 Python Species 0.000 claims description 103
- 238000000034 method Methods 0.000 abstract description 2
- 230000006870 function Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/10—Services
- G06Q50/18—Legal services
- G06Q50/184—Intellectual property management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/321—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
- H04L9/3213—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority using tickets or tokens, e.g. Kerberos
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3234—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving additional secure or trusted devices, e.g. TPM, smartcard, USB or software token
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Business, Economics & Management (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Tourism & Hospitality (AREA)
- Physics & Mathematics (AREA)
- Technology Law (AREA)
- General Physics & Mathematics (AREA)
- Operations Research (AREA)
- Bioethics (AREA)
- Entrepreneurship & Innovation (AREA)
- Computer Hardware Design (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Economics (AREA)
- Human Resources & Organizations (AREA)
- Marketing (AREA)
- Primary Health Care (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Storage Device Security (AREA)
Abstract
本发明公开了一种通过加密Python明文源码token的知识产权保护系统,保护系统包括加密系统和运行系统;所述加密系统包括Python明文源码token加密模块,所述Python明文源码token加密模块通过自定义的对称密钥加密算法对Python明文源码文件进行加密;所述运行系统包括新Python解释器,所述新Python解释器用来对Python密文代码文件进行解密;所述新Python解释器内添加有Python密文代码token解密运行模块,所述新Python解释器为Python原生解释器通过Python密文代码token解密运行模块修改得到。本发明可以有效的保护Python文件,无法被更改、阅读、分析,从而达到保护知识产权目的。
Description
技术领域
本发明涉及软件保护技术领域,具体为一种通过加密Python明文源码token的知识产权保护系统。
背景技术
Python,是一种面向对象的解释型,面向对象、动态数据类型的高级程序设计语言,由荷兰人Guido van Rossum于1989年发明,第一个公开发行版发行于1991年。它的领域非常的广泛,包括游戏、图像、云计算、大数据、机器学习、人工智能、XML以及机器人等等。Python可以完成现实中的各种任务,减少开发者们日复一日所做的重复事情,Python是一种通用语言,Python在各领域的应用角色几乎是没有限制,无论是从网站、游戏开发、机器人或是一些高科技的航天飞机控制都可以看到python代码的出现。
但是作为一种解释型脚本语言,可执行的代码一般以明文源码文件格式(.py后缀)、或者编译字节码文件格式(.pyc后缀)存在。明文源码文件格式(py文件)里面的文件内容,可以很容易被阅读、分析,即使使用编译工具进行一次编译后生成字节码格式文件(pyc文件),仍然可以被很轻易的反编译出来一个明文源码文件。
因此现有的代码保护具有如下的缺陷:1、明文形式的代码,易被阅读、分析,无法提供有力的知识产权保护机制。
发明内容
本发明的目的在于提供一种通过加密Python明文源码token的知识产权保护系统,以解决上述背景技术中提出的问题。
为实现上述目的,本发明提供如下技术方案:
一种通过加密Python明文源码token的知识产权保护系统,保护系统包括加密系统和运行系统;
所述加密系统包括Python明文源码token加密模块,所述Python明文源码token加密模块通过自定义的对称密钥加密算法对Python明文源码文件进行加密;
所述运行系统包括新Python解释器,所述新Python解释器用来对Python密文代码文件进行解密;
所述新Python解释器内添加有Python密文代码token解密运行模块。
优选的,所述新Python解释器为Python原生解释器通过Python密文代码token解密运行模块修改得到。
优选的,对Python原生解释器的修改内容包括:
(1)、修改原生Python解释器中tokenizer机制,具体为修改tokenizer.c源码中的decoding_fgets函数,增加识别加密标签功能;
(2)、禁用自动生成pyc文件功能。
优选的,保护系统的工作流程包括以下步骤:
步骤一、将Python明文源码文件通过Python明文源码token加密模块进行加密:
1.1、Python明文源码token加密模块根据行号生成一个对称密钥,并用这个对称密钥加密替换Python明文源码文件中的可见字符,形成密文;
1.2、Python明文源码token加密模块生成一个加密标签添加到密文中,从而生成一个Python密文代码文件;
步骤二、将Python密文代码文件通过新Python解释器进行解密:
2.1、将Python密文代码token解密运行模块添加入Python原生解释器中,从而修改Python原生解释器,生成一个新Python解释器;
2.2、通过新Python解释器对Python密文代码文件进行解密。
优选的,步骤一中,可见字符包括英文字母字符、标点符号字符以及阿拉伯数字字符。
与现有技术相比,本发明的有益效果是:
本发明可以有效的保护Python文件,无法被更改、阅读、分析,从而达到保护知识产权目的。
附图说明
图1为本发明系统的结构示意图;
图2为本发明系统中加密系统的工作流程示意图;
图3为本发明系统中运行系统的工作流程示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
请参阅图1-3,本发明提供一种技术方案:
一种通过加密Python明文源码token的知识产权保护系统,保护系统包括加密系统和运行系统,加密系统用来对Python明文源码文件进行加密,运行系统用来对Python密文代码文件进行解密。
加密系统包括Python明文源码token加密模块,Python明文源码token加密模块通过自定义的对称密钥加密算法对Python明文源码文件进行加密。
将Python明文源码文件通过Python明文源码token加密模块进行加密:
1.1、Python明文源码token加密模块根据行号生成一个对称密钥,并用这个对称密钥加密替换Python明文源码文件中的可见字符,可见字符包括英文字母字符、标点符号字符以及阿拉伯数字字符,替换后形成密文,达到加密python代码中token的效果;
1.2、同时,Python明文源码token加密模块生成一个加密标签添加到密文中,从而生成一个Python密文代码文件,实现加密效果。
运行系统包括新Python解释器,新Python解释器用来对Python密文代码文件进行解密。
新Python解释器内添加有Python密文代码token解密运行模块,新Python解释器为Python原生解释器通过Python密文代码token解密运行模块修改得到。
Python原生解释器为Python计算机程序设计语言的无需加密解密的一个最原始的解释器,很显然无法对加密后的Python密文代码文件进行解密,所以通过添加该Python密文代码token解密运行模块,修改Python原生解释器,生成一个新Python解释器。
对Python原生解释器的修改内容主要为两点:
(1)、修改原生Python解释器中tokenizer机制,具体为修改tokenizer.c源码中的decoding_fgets函数,增加识别加密标签功能,如果发现有加密标签,会根据当前行号生成对称密钥,解密当前行内token数据,如果没有加密标签就按照以前逻辑处理;
(2)、禁用自动生成pyc文件功能。
实施例:
本发明具体实施案例如下:
pyenrypt是Python代码加密模块,python是添加了Python加密运行模块的的新Python解释器。
1.Python明文源码内容如下:
#!/usr/bin/python
print'helloworld';
2.使用pyenrypt进行加密:
./pyencrypt helloworld.py helloworld.py.encry;
3.Python密文源码内容如下:
#!/usr/bin/python
#encrypted
13j1vB()&m/q:p3-eI;
4.使用具有解密功能python解释器运行密文源码:
python helloworld.py.encry;
5.运行结果如下,与明文源码一致:
Helloworld。
尽管已经示出和描述了本发明的实施例,对于本领域的普通技术人员而言,可以理解在不脱离本发明的原理和精神的情况下可以对这些实施例进行多种变化、修改、替换和变型,本发明的范围由所附权利要求及其等同物限定。
Claims (2)
1.一种通过加密Python明文源码token的知识产权保护系统,保护系统包括加密系统和运行系统,其特征在于:
所述加密系统包括Python明文源码token加密模块,所述Python明文源码token加密模块通过自定义的对称密钥加密算法对Python明文源码文件进行加密;
所述运行系统包括新Python解释器,所述新Python解释器用来对Python密文代码文件进行解密,所述新Python解释器为Python原生解释器通过Python密文代码token解密运行模块修改得到,对Python原生解释器的修改内容包括:
(1)、修改原生Python解释器中tokenizer机制,具体为修改tokenizer.c源码中的decoding_fgets函数,增加识别加密标签功能;
(2)、禁用自动生成pyc文件功能;
所述新Python解释器内添加有Python密文代码token解密运行模块;
保护系统的工作流程包括以下步骤:
步骤一、将Python明文源码文件通过Python明文源码token加密模块进行加密:
1.1、Python明文源码token加密模块根据行号生成一个对称密钥,并用这个对称密钥加密替换Python明文源码文件中的可见字符,形成密文;
1.2、Python明文源码token加密模块生成一个加密标签添加到密文中,从而生成一个Python密文代码文件;
步骤二、将Python密文代码文件通过新Python解释器进行解密:
2.1、将Python密文代码token解密运行模块添加入Python原生解释器中,从而修改Python原生解释器,生成一个新Python解释器;
2.2、通过新Python解释器对Python密文代码文件进行解密。
2.根据权利要求1所述的一种通过加密Python明文源码token的知识产权保护系统,其特征在于:步骤一中,可见字符包括英文字母字符、标点符号字符以及阿拉伯数字字符。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711079318.3A CN107808101B (zh) | 2017-11-06 | 2017-11-06 | 一种通过加密Python明文源码token的知识产权保护系统 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711079318.3A CN107808101B (zh) | 2017-11-06 | 2017-11-06 | 一种通过加密Python明文源码token的知识产权保护系统 |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107808101A CN107808101A (zh) | 2018-03-16 |
CN107808101B true CN107808101B (zh) | 2020-11-06 |
Family
ID=61583459
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711079318.3A Active CN107808101B (zh) | 2017-11-06 | 2017-11-06 | 一种通过加密Python明文源码token的知识产权保护系统 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107808101B (zh) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110929234B (zh) * | 2019-11-28 | 2023-03-24 | 施羊梦燊 | 一种基于代码虚拟化的Python程序加密保护系统与方法 |
CN111523120A (zh) * | 2020-04-30 | 2020-08-11 | 广州锦行网络科技有限公司 | 一种 Python 源码安全防护的实现方法及系统 |
CN113434874B (zh) * | 2021-06-11 | 2022-05-20 | 湖南大学 | 一种基于pyc加密的Python源代码保护方法和系统 |
CN113946801B (zh) * | 2021-11-01 | 2024-06-04 | 苏州浪潮智能科技有限公司 | 基于SGX的Python源码的保护方法和装置 |
CN114154123B (zh) * | 2022-02-09 | 2022-05-17 | 北京天防安全科技有限公司 | 应用于Python项目的加密保护方法 |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102971712A (zh) * | 2010-05-19 | 2013-03-13 | 阿卡麦科技公司 | 边缘服务器http post消息处理 |
CN104657162A (zh) * | 2013-11-21 | 2015-05-27 | 腾讯科技(深圳)有限公司 | 一种服务环境修改方法和装置 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080162652A1 (en) * | 2005-02-14 | 2008-07-03 | Inboxer, Inc. | System for Applying a Variety of Policies and Actions to Electronic Messages Before they Leave the Control of the Message Originator |
WO2015012782A1 (en) * | 2009-12-16 | 2015-01-29 | Robert Kulakowski | Dynamic obfuscation processing |
CN104063225B (zh) * | 2014-06-27 | 2017-09-22 | 广州华多网络科技有限公司 | 锁屏主题开发方法及装置 |
CN104573425B (zh) * | 2014-12-31 | 2018-01-30 | 上海格尔软件股份有限公司 | 一种基于对称算法和专用加载模块的Python程序模块加密方法 |
CN105574368B (zh) * | 2015-12-10 | 2018-05-04 | 华青融天(北京)技术股份有限公司 | 一种Python程序模块的安全调用方法和装置 |
CN106599628B (zh) * | 2016-12-08 | 2019-04-02 | 合肥康捷信息科技有限公司 | 一种基于模块钩子的Python字节码文件保护方法 |
-
2017
- 2017-11-06 CN CN201711079318.3A patent/CN107808101B/zh active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102971712A (zh) * | 2010-05-19 | 2013-03-13 | 阿卡麦科技公司 | 边缘服务器http post消息处理 |
CN104657162A (zh) * | 2013-11-21 | 2015-05-27 | 腾讯科技(深圳)有限公司 | 一种服务环境修改方法和装置 |
Non-Patent Citations (2)
Title |
---|
Python中的编码;NoneSec;《https://blog.csdn.net/liuxingen/article/details/48930527?locationNum=4&fps=1》;20151018;第1-8页 * |
面向Python的信息流控制模型及其实现;邵婧 等;《计算机应用研究》;20150420;第32卷(第10期);第3065-3069页 * |
Also Published As
Publication number | Publication date |
---|---|
CN107808101A (zh) | 2018-03-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107808101B (zh) | 一种通过加密Python明文源码token的知识产权保护系统 | |
CN106599628B (zh) | 一种基于模块钩子的Python字节码文件保护方法 | |
CN103218549B (zh) | 一种Java源代码加解密的方法及装置 | |
CN108363911B (zh) | 一种Python脚本混淆、水印的方法及装置 | |
US20210034788A1 (en) | Secure Collaboration Between Processors And Processing Accelerators In Enclaves | |
CN106548046B (zh) | 一种保护代码的装置和方法 | |
KR101687439B1 (ko) | 소프트웨어 무결성을 보장하기위한 프로세서 실행 방법 | |
US20090138863A1 (en) | Method And Apparatus For Protecting .NET Programs | |
CN111240654B (zh) | 一种Python代码加固保护的方法及其系统 | |
CN111512307B (zh) | 编译设备和方法 | |
CN110704854B (zh) | 针对文本数据保留格式的流式加密方法 | |
CN108399319A (zh) | 源代码保护方法、应用服务器及计算机可读存储介质 | |
CN107528695A (zh) | 一种基于包含摘要信息二维码的电子签名方法 | |
FI3844647T3 (fi) | Järjestelmä ja menetelmä suojatun tietojen tallennuksen tarjoamiseksi datamuistiin | |
US10296765B2 (en) | Multi-level security enforcement | |
US8694548B2 (en) | Defense-in-depth security for bytecode executables | |
CN108829396A (zh) | 脚本编译的方法、脚本执行的方法、相关装置及系统 | |
CN111523120A (zh) | 一种 Python 源码安全防护的实现方法及系统 | |
Seo et al. | Low-power encryption algorithm block cipher in JavaScript | |
Sultan et al. | Hybrid obfuscation technique to protect source code from prohibited software reverse engineering | |
US8819420B1 (en) | Encryption and decryption approach that prevents exposing clear-text in memory | |
CN109478212A (zh) | 按需代码解密 | |
CN106372464A (zh) | 一种嵌入式系统中静态库文件的防盗版加密方法 | |
CN105426702A (zh) | 基于安卓操作系统的应用程序加密解密方法和装置 | |
Gautam et al. | A novel software protection approach for code obfuscation to enhance software security |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |