CN106686407A - Automatic identification encryption and decryption method and system for video data transmission - Google Patents
Automatic identification encryption and decryption method and system for video data transmission Download PDFInfo
- Publication number
- CN106686407A CN106686407A CN201611149596.7A CN201611149596A CN106686407A CN 106686407 A CN106686407 A CN 106686407A CN 201611149596 A CN201611149596 A CN 201611149596A CN 106686407 A CN106686407 A CN 106686407A
- Authority
- CN
- China
- Prior art keywords
- encryption
- decryption
- video file
- transmitted
- state
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/4405—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving video stream decryption
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/2347—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving video stream encryption
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
本发明公开了一种用于视频数据传输的自动识别加密解密方法,该方法的步骤包括:获取待传输视频文件的传递参数,确认待传输视频文件路径和待传输视频文件的当前状态S1、根据用户加密或解密指令,对当前待传输视频文件进行加密或解密处理S2、判断加密或解密处理操作是否成功,并将最终的操作状态返回给用户,完成自动识别加密操作S3。本发明所述技术方案占用数据空间小,只有30KB左右,能够实现服务器或其他相关视频播放软件调用;通过采用文件局部加密方式,能够快速实现加密或解密,并且能够对视频文件设置加密或解密状态,同时能够判断视频文件状态。
The invention discloses an automatic identification, encryption and decryption method for video data transmission. The steps of the method include: obtaining the transmission parameters of the video file to be transmitted, confirming the path of the video file to be transmitted and the current state S1 of the video file to be transmitted, according to The user encrypts or decrypts instructions, encrypts or decrypts the current video file to be transmitted S2, judges whether the encryption or decryption operation is successful, and returns the final operation status to the user to complete the automatic identification encryption operation S3. The technical solution of the present invention occupies a small data space, only about 30 KB, and can be called by a server or other related video playback software; by adopting a partial file encryption method, encryption or decryption can be quickly realized, and the encryption or decryption state can be set for the video file , and can judge the status of the video file at the same time.
Description
技术领域technical field
本发明涉及信息加密技术领域,特别是涉及一种用于视频数据传输的自动识别加密解密方法及系统。The invention relates to the technical field of information encryption, in particular to an automatic identification encryption and decryption method and system for video data transmission.
背景技术Background technique
随着科技飞速发展,电子数据的传播已经广泛融入到人们的日常生活中,例如,视频、音频等数据等电子数据。With the rapid development of science and technology, the dissemination of electronic data has been widely integrated into people's daily life, for example, electronic data such as video, audio and other data.
人们可以利用通讯设备来存储电子数据,有些涉及个人隐私的资料(例如,部分照片、视频、手机银行的资料)不希望被其它人轻易访问,可以对不希望被其它人访问的资料进行加密。相关技术中,加密方式通常是密码加密,加密的密码可以是字符、数字或图案等;当访问加密的资料时需要输入正确的密码。People can use communication devices to store electronic data. Some personal privacy information (for example, some photos, videos, mobile banking information) do not want to be easily accessed by others, and the information that does not want to be accessed by others can be encrypted. In related technologies, the encryption method is usually password encryption, and the encrypted password can be characters, numbers, or patterns; when accessing encrypted data, it is necessary to input the correct password.
现今,常用的视频加密解密工具通常是面向用户手动操作的软件工具,主要类型如下:Nowadays, commonly used video encryption and decryption tools are usually software tools for users to manually operate, and the main types are as follows:
1)用户需手动打开软件后选择需要加密或解密的视频文件,之后选择相应加密或解密操作;1) The user needs to manually open the software and select the video file to be encrypted or decrypted, and then select the corresponding encryption or decryption operation;
2)用户需人为判断该视频是否已被加密,如尝试播放视频文件,若无法正常播放则该视频文件可能被加密。2) The user needs to manually judge whether the video has been encrypted, such as trying to play the video file, if it cannot be played normally, the video file may be encrypted.
常规的加解密软件工具的加密或解密的操作需要人为执行,不便于用户的使用,加密和解密的过程缓慢。将文件的所有部分加密虽然安全性高,但是极大的占用内存空间,不利于文件的存储和传输。并且无法对指定位置进行加密或解密操作,使用不灵活。The encryption or decryption operation of conventional encryption and decryption software tools needs to be performed manually, which is not convenient for users to use, and the encryption and decryption process is slow. Encrypting all parts of the file is highly secure, but it takes up a lot of memory space, which is not conducive to file storage and transmission. And it cannot encrypt or decrypt the specified location, so it is not flexible to use.
发明内容Contents of the invention
为解决上述技术问题,本发明采用下述技术方案In order to solve the above technical problems, the present invention adopts the following technical solutions
一种用于视频数据传输的自动识别加密解密方法,该方法的步骤包括:An automatic identification encryption and decryption method for video data transmission, the steps of the method include:
S1、获取待传输视频文件的传递参数,确认待传输视频文件路径和待传输视频文件的当前状态;S1. Obtain the transmission parameters of the video file to be transmitted, confirm the path of the video file to be transmitted and the current state of the video file to be transmitted;
S2、根据用户加密或解密指令,对当前待传输视频文件进行加密或解密处理;S2. Encrypt or decrypt the current video file to be transmitted according to the user's encryption or decryption instruction;
S3、判断加密或解密处理操作是否成功,并将最终的操作状态返回给用户,完成自动识别加密操作。S3. Judging whether the encryption or decryption processing operation is successful, and returning the final operation status to the user to complete the automatic identification encryption operation.
优选地,所述待传输视频文件的当前状态包括:已加密、已解密和未处理三种状态。Preferably, the current status of the video file to be transmitted includes three statuses: encrypted, decrypted and unprocessed.
优选地,所述步骤S2包括:Preferably, said step S2 includes:
S21、对最大尝试加密或解密操作次数maxCount、当前加密或解密操作次数count和视频加密或解密结果的初始状态进行初始化设定;S21. Initialize the maximum number of encryption or decryption operations maxCount, the current number of encryption or decryption operations count, and the initial state of the video encryption or decryption result;
S22、通过判断条件:加密或解密状态是否为操作失败状态且当前加密或解密次数count小于最大尝试加密或解密操作次数maxCount,决定是否可以尝试为待传输视频文件加密;若满足判断条件,则执行步骤S23,若不满足判断条件,则执行步骤S3;S22. Pass the judgment condition: whether the encryption or decryption status is an operation failure state and the current encryption or decryption times count is less than the maximum number of attempts to encrypt or decrypt operations maxCount, determine whether it is possible to try to encrypt the video file to be transmitted; if the judgment condition is met, then execute Step S23, if the judgment condition is not met, then execute step S3;
S23、为视频文件设置加密或解密操作的操作标识,并判断操作标识设置是否成功,若成功,则执行步骤S24,若失败,则尝试加密或解密操作次数count加1,并重复步骤S22和S23,直至标识成功或不满足步骤S22的判断条件为止;S23, set the operation identification of encryption or decryption operation for the video file, and judge whether the operation identification setting is successful, if successful, then perform step S24, if failed, then try to add 1 to the count of times of encryption or decryption operations, and repeat steps S22 and S23 , until the identification is successful or the judgment condition of step S22 is not satisfied;
S24、根据用户需求,对待传输视频文件指定位置的内容进行加密或解密操作;S24. Encrypt or decrypt the content at the specified location of the video file to be transmitted according to user requirements;
S25、判断加密或解密操作是否成功,若成功,则完成待传输视频文件的加密或解密操作,若失败,则执行步骤S22至S25,直至操作成功或不满足步骤S22的判断条件为止。S25. Determine whether the encryption or decryption operation is successful. If successful, complete the encryption or decryption operation of the video file to be transmitted. If it fails, perform steps S22 to S25 until the operation succeeds or the judgment condition of step S22 is not satisfied.
优选地,所述S24包括:Preferably, said S24 includes:
S241、将待传输视频文件的头部1024字节作为加密或解密的对象;S241. Taking the header 1024 bytes of the video file to be transmitted as the object of encryption or decryption;
S242、设初始位置为site=0;S242. Set the initial position as site=0;
S243、判断当前待传输视频文件的头部1024字节是否加密完成,若未完成,则从1024字节中取出16字节的数据,并对这16个字节数据进行加密处理,若已完成加密,则从1024字节中取出16字节的数据,并对这16个字节数据进行解密处理;S243, judging whether the encryption of the header 1024 bytes of the currently to-be-transmitted video file is completed, if not completed, then take out 16 bytes of data from the 1024 bytes, and encrypt the 16 bytes of data, if completed Encryption, take 16 bytes of data from 1024 bytes, and decrypt the 16 bytes of data;
S244、将加密或解密后的数据写入site处,若写失败则退出;S244. Write the encrypted or decrypted data into the site, and exit if the writing fails;
S245、再在所述1024字节中取16字节,即为site=site+16,并重复执行步骤S243至步骤S245,直至所述1024字节数据全部加密或解密完成。S245. Then take 16 bytes out of the 1024 bytes, that is, site=site+16, and repeat step S243 to step S245 until all the 1024 bytes of data are encrypted or decrypted.
优选地,所述步骤S243中若读取数据失败或加密/解密操作失败,则直接退出。Preferably, in the step S243, if the data reading fails or the encryption/decryption operation fails, exit directly.
优选地,所述步骤S3包括:Preferably, said step S3 includes:
S31、若加密或解密操作成功,则返回操作成功状态;S31. If the encryption or decryption operation is successful, return the operation success state;
S32、若加密或解密操作失败,则尝试回滚到视频文件进行加密或解密操作前的状态;S32. If the encryption or decryption operation fails, try to roll back to the state before the video file is encrypted or decrypted;
S33、若回滚操作成功,则返回操作失败状态,若回滚操作失败,则返回无法复原状态。S33. If the rollback operation is successful, return the operation failure state, and if the rollback operation fails, return the unrecoverable state.
一种用于视频数据传输的自动识别加密系统,该系统包括:An automatic identification and encryption system for video data transmission, the system includes:
文件识别单元,获取视频文件传输请求,确认待传输视频文件路径和待传输视频文件的当前状态;The file identification unit obtains the video file transmission request, confirms the path of the video file to be transmitted and the current state of the video file to be transmitted;
加密单元,根据用户加密或解密指令,对当前待传输视频文件进行加密或解密处理;An encryption unit, which encrypts or decrypts the current video file to be transmitted according to user encryption or decryption instructions;
状态反馈单元,判断加密或解密处理操作是否成功,并将最终的操作状态返回给用户,完成自动识别加密操作。The state feedback unit judges whether the encryption or decryption processing operation is successful, and returns the final operation state to the user to complete the automatic identification encryption operation.
优选地,所述待传输视频文件的当前状态包括:已加密、已解密和未处理三种状态。Preferably, the current status of the video file to be transmitted includes three statuses: encrypted, decrypted and unprocessed.
优选地,所述加密单元内包括:Preferably, the encryption unit includes:
初始化模块,对最大尝试加密或解密操作次数maxCount、当前加密或解密操作次数count和视频加密或解密结果的初始状态进行初始化设定;The initialization module initializes the initial state of the maximum number of encryption or decryption operations maxCount, the current number of encryption or decryption operations count, and the video encryption or decryption results;
第一判断模块,通过判断条件:加密或解密状态是否为操作失败状态且当前加密或解密次数count小于最大尝试加密或解密操作次数maxCount,决定是否可以尝试为待传输视频文件加密;若满足判断条件,则为视频文件设置加密或解密操作的操作标识,若不满足判断条件,则向用户返回状态反馈单元确定的操作状态;The first judging module, by judging conditions: whether the encryption or decryption state is an operation failure state and the current encryption or decryption times count is less than the maximum number of attempts to encrypt or decrypt operations maxCount, to determine whether to try to encrypt the video file to be transmitted; if the judging condition is met , the operation identification of the encryption or decryption operation is set for the video file, if the judgment condition is not satisfied, the operation state determined by the state feedback unit is returned to the user;
操作标识设定模块,为视频文件设置加密或解密操作的操作标识,并判断操作标识设置是否成功,若成功,则进行用户指定内容加密或解密操作,若失败,则尝试加密或解密操作次数count加1,并重复步骤第一判断模块和操作标识设定模块的操作,直至标识成功或不满足第一判断模块的判断条件为止;The operation identification setting module is used to set the operation identification of the encryption or decryption operation for the video file, and judge whether the operation identification setting is successful, if successful, perform the user-specified content encryption or decryption operation, and if it fails, try the encryption or decryption operation times count Add 1, and repeat the operations of the step first judging module and the operation identification setting module, until the identification succeeds or the judging condition of the first judging module is not met;
指定内容处理模块,根据用户需求,对待传输视频文件指定位置的内容进行加密或解密操作;Specify the content processing module to encrypt or decrypt the content at the specified location of the video file to be transmitted according to user needs;
第二判断模块,判断加密或解密操作是否成功,若成功,则完成待传输视频文件的加密或解密操作,若失败,则执行第一判断模块、操作标识设定模块、指定内容处理模块和第二判断模块的操作,直至操作成功或不满足第一判断模块的判断条件为止。The second judgment module judges whether the encryption or decryption operation is successful. If successful, the encryption or decryption operation of the video file to be transmitted is completed. If it fails, the first judgment module, the operation identification setting module, the designated content processing module and the second judgment module are executed. The operation of the second judging module until the operation succeeds or the judging condition of the first judging module is not met.
优选地,所述状态反馈单元包括:Preferably, the state feedback unit includes:
加密结果判断模块,若加密或解密操作成功,则返回操作成功状态,若加密或解密操作失败,则尝试回滚到视频文件进行加密或解密操作前的状态;The encryption result judging module, if the encryption or decryption operation is successful, then returns the operation success state, if the encryption or decryption operation fails, then tries to roll back to the state before the video file is encrypted or decrypted;
回滚结果判断模块,若回滚操作成功,则返回操作失败状态,若回滚操作失败,则返回无法复原状态。The rollback result judging module, if the rollback operation is successful, returns the operation failure state, and if the rollback operation fails, returns the unrecoverable state.
本发明的有益效果如下:The beneficial effects of the present invention are as follows:
本发明所述技术方案通过调用方式运行,而非界面式手动操作,方便系统或程序调用执行。增加加密或解密状态标识,方便系统或程序判断文件加密或解密状态。利用本方案生成库文件,大大降低了该工具插件的存储空间,极大的提高了加解密的速度。The technical solution of the present invention is operated by calling, rather than interface-based manual operation, which is convenient for system or program calling and execution. Increase the encryption or decryption status identification, which is convenient for the system or program to judge the file encryption or decryption status. Using this scheme to generate library files greatly reduces the storage space of the tool plug-in and greatly improves the speed of encryption and decryption.
附图说明Description of drawings
下面结合附图对本发明的具体实施方式作进一步详细的说明;Below in conjunction with accompanying drawing, specific embodiment of the present invention is described in further detail;
图1示出本方案所述自动识别加密解密方法的示意图;Fig. 1 shows the schematic diagram of automatic identification encryption decryption method described in this scheme;
图2示出本方案所述局部循环加密或解密方法的示意图。Fig. 2 shows a schematic diagram of the local loop encryption or decryption method described in this solution.
具体实施方式detailed description
为了更清楚地说明本发明,下面结合优选实施例和附图对本发明做进一步的说明。附图中相似的部件以相同的附图标记进行表示。本领域技术人员应当理解,下面所具体描述的内容是说明性的而非限制性的,不应以此限制本发明的保护范围。In order to illustrate the present invention more clearly, the present invention will be further described below in conjunction with preferred embodiments and accompanying drawings. Similar parts in the figures are denoted by the same reference numerals. Those skilled in the art should understand that the content specifically described below is illustrative rather than restrictive, and should not limit the protection scope of the present invention.
如图1所示,本发明公开了一种用于视频数据传输的自动识别加密解密方法,该方法的步骤包括:As shown in Figure 1, the present invention discloses a method for automatic identification encryption and decryption for video data transmission, the steps of the method include:
步骤S1、获取待传输视频文件的传递参数,确认待传输视频文件路径和待传输视频文件的当前状态;其中,所述待传输视频文件的当前状态包括:已加密、已解密和未处理三种状态。其中,该步骤中需调用两个参数,第一参数为待加密视频文件路径,第二参数为操作参数,并通过以下代码表示:Step S1, obtain the transmission parameters of the video file to be transmitted, confirm the path of the video file to be transmitted and the current state of the video file to be transmitted; wherein, the current state of the video file to be transmitted includes: encrypted, decrypted and unprocessed state. Among them, two parameters need to be called in this step, the first parameter is the path of the video file to be encrypted, and the second parameter is an operation parameter, which is represented by the following code:
数字0代表解密,传递此参数,方法会对视频进行解密操作;The number 0 represents decryption, pass this parameter, and the method will decrypt the video;
数字1代表加密,传递此参数,方法会对视频进行加密操作;The number 1 represents encryption, pass this parameter, and the method will encrypt the video;
数字2代表获取视频文件状态,传递此参数,方法只检查文件当前状态,会返回三种状态,即数字0代表文件未进行任何处理;数字1代表文件已加密;数字2代表文件已解密。The number 2 means to get the status of the video file, pass this parameter, the method only checks the current status of the file, and will return three states, that is, the number 0 means that the file has not been processed; the number 1 means that the file has been encrypted; the number 2 means that the file has been decrypted.
步骤S2、根据用户加密或解密指令,对当前待传输视频文件进行加密或解密处理。该步骤S2包括:Step S2, encrypt or decrypt the current video file to be transmitted according to the user's encryption or decryption instruction. This step S2 includes:
S21、对最大尝试加密或解密操作次数maxCount、当前加密或解密操作次数count和视频加密或解密结果的初始状态进行初始化设定;S21. Initialize the maximum number of encryption or decryption operations maxCount, the current number of encryption or decryption operations count, and the initial state of the video encryption or decryption result;
S22、通过判断条件:加密或解密状态是否为操作失败状态且当前加密或解密次数count小于最大尝试加密或解密操作次数maxCount,决定是否可以尝试为待传输视频文件加密;若满足判断条件,则执行步骤S23,若不满足判断条件,则执行步骤S3;S22. Pass the judgment condition: whether the encryption or decryption status is an operation failure state and the current encryption or decryption times count is less than the maximum number of attempts to encrypt or decrypt operations maxCount, determine whether it is possible to try to encrypt the video file to be transmitted; if the judgment condition is met, then execute Step S23, if the judgment condition is not met, then execute step S3;
S23、为视频文件设置加密或解密操作的操作标识,并判断操作标识设置是否成功,若成功,则执行步骤S24,若失败,则尝试加密或解密操作次数count加1,并重复步骤S22和S23,直至标识成功或不满足步骤S22的判断条件为止;S23, set the operation identification of encryption or decryption operation for the video file, and judge whether the operation identification setting is successful, if successful, then perform step S24, if failed, then try to add 1 to the count of times of encryption or decryption operations, and repeat steps S22 and S23 , until the identification is successful or the judgment condition of step S22 is not satisfied;
S24、根据用户需求,对待传输视频文件指定位置的内容进行加密或解密操作;其中,如图2所示,该步骤S24包括:S24. According to the needs of the user, encrypt or decrypt the content of the specified location of the video file to be transmitted; wherein, as shown in Figure 2, this step S24 includes:
S241、将待传输视频文件的头部1024字节作为加密或解密的对象;S241. Taking the header 1024 bytes of the video file to be transmitted as the object of encryption or decryption;
S242、设初始位置为site=0;S242. Set the initial position as site=0;
S243、判断当前待传输视频文件的头部1024字节是否加密完成,若未完成,则从1024字节中取出16字节的数据,并对这16个字节数据进行加密处理,若已完成加密,则从1024字节中取出16字节的数据,并对这16个字节数据进行解密处理;该步骤中若读取数据失败或加密/解密操作失败,则直接退出S243, judging whether the encryption of the header 1024 bytes of the currently to-be-transmitted video file is completed, if not completed, then take out 16 bytes of data from the 1024 bytes, and encrypt the 16 bytes of data, if completed Encryption, take out 16 bytes of data from 1024 bytes, and decrypt the 16 bytes of data; if the reading of data fails or the encryption/decryption operation fails in this step, exit directly
S244、将加密或解密后的数据写入site处,若写失败则退出;S244. Write the encrypted or decrypted data into the site, and exit if the writing fails;
S245、再在所述1024字节中取16字节,即为site=site+16,并重复执行步骤S243至步骤S245,直至所述1024字节数据全部加密或解密完成;S245, taking 16 bytes out of the 1024 bytes, which is site=site+16, and repeatedly executing steps S243 to S245 until all the 1024 bytes of data are encrypted or decrypted;
S25、判断加密或解密操作是否成功,若成功,则完成待传输视频文件的加密或解密操作,若失败,则执行步骤S22至S25,直至操作成功或不满足步骤S22的判断条件为止。S25. Determine whether the encryption or decryption operation is successful. If successful, complete the encryption or decryption operation of the video file to be transmitted. If it fails, perform steps S22 to S25 until the operation succeeds or the judgment condition of step S22 is not satisfied.
S3、判断加密或解密处理操作是否成功,并将最终的操作状态返回给用户,完成自动识别加密操作。所述步骤S3包括:S3. Judging whether the encryption or decryption processing operation is successful, and returning the final operation status to the user to complete the automatic identification encryption operation. Described step S3 comprises:
S31、若加密或解密操作成功,则返回操作成功状态;S31. If the encryption or decryption operation is successful, return the operation success state;
S32、若加密或解密操作失败,则尝试回滚到视频文件进行加密或解密操作前的状态;S32. If the encryption or decryption operation fails, try to roll back to the state before the video file is encrypted or decrypted;
S33、若回滚操作成功,则返回操作失败状态,若回滚操作失败,则返回无法复原状态。S33. If the rollback operation is successful, return the operation failure state, and if the rollback operation fails, return the unrecoverable state.
本方案进一步公开了一种用于视频数据传输的自动识别加密系统,该系统包括:This scheme further discloses an automatic identification and encryption system for video data transmission, the system includes:
文件识别单元,获取视频文件传输请求,确认待传输视频文件路径和待传输视频文件的当前状态,即已加密、已解密或未处理三种状态;The file identification unit obtains the video file transmission request, confirms the path of the video file to be transmitted and the current state of the video file to be transmitted, that is, encrypted, decrypted or unprocessed;
加密单元,根据用户加密或解密指令,对当前待传输视频文件进行加密或解密处理;所述加密单元内包括:The encryption unit encrypts or decrypts the current video file to be transmitted according to user encryption or decryption instructions; the encryption unit includes:
初始化模块,对最大尝试加密或解密操作次数maxCount、当前加密或解密操作次数count和视频加密或解密结果的初始状态进行初始化设定;The initialization module initializes the initial state of the maximum number of encryption or decryption operations maxCount, the current number of encryption or decryption operations count, and the video encryption or decryption results;
第一判断模块,通过判断条件:加密或解密状态是否为操作失败状态且当前加密或解密次数count小于最大尝试加密或解密操作次数maxCount,决定是否可以尝试为待传输视频文件加密;若满足判断条件,则为视频文件设置加密或解密操作的操作标识,若不满足判断条件,则向用户返回状态反馈单元确定的操作状态;The first judging module, by judging conditions: whether the encryption or decryption state is an operation failure state and the current encryption or decryption times count is less than the maximum number of attempts to encrypt or decrypt operations maxCount, to determine whether to try to encrypt the video file to be transmitted; if the judging condition is satisfied , the operation identification of the encryption or decryption operation is set for the video file, if the judgment condition is not satisfied, the operation state determined by the state feedback unit is returned to the user;
操作标识设定模块,为视频文件设置加密或解密操作的操作标识,并判断操作标识设置是否成功,若成功,则进行用户指定内容加密或解密操作,若失败,则尝试加密或解密操作次数count加1,并重复步骤第一判断模块和操作标识设定模块的操作,直至标识成功或不满足第一判断模块的判断条件为止;The operation identification setting module is used to set the operation identification of the encryption or decryption operation for the video file, and judge whether the operation identification setting is successful, if successful, perform the user-specified content encryption or decryption operation, and if it fails, try the encryption or decryption operation times count Add 1, and repeat the operations of the step first judging module and the operation identification setting module, until the identification succeeds or the judging condition of the first judging module is not met;
指定内容处理模块,根据用户需求,对待传输视频文件指定位置的内容进行加密或解密操作;Specify the content processing module to encrypt or decrypt the content at the specified location of the video file to be transmitted according to user needs;
第二判断模块,判断加密或解密操作是否成功,若成功,则完成待传输视频文件的加密或解密操作,若失败,则执行第一判断模块、操作标识设定模块、指定内容处理模块和第二判断模块的操作,直至操作成功或不满足第一判断模块的判断条件为止。The second judgment module judges whether the encryption or decryption operation is successful. If successful, the encryption or decryption operation of the video file to be transmitted is completed. If it fails, the first judgment module, the operation identification setting module, the designated content processing module and the second judgment module are executed. The operation of the second judging module until the operation succeeds or the judging condition of the first judging module is not met.
状态反馈单元,判断加密或解密处理操作是否成功,并将最终的操作状态返回给用户,完成自动识别加密操作。所述状态反馈单元包括:The state feedback unit judges whether the encryption or decryption processing operation is successful, and returns the final operation state to the user to complete the automatic identification encryption operation. The state feedback unit includes:
加密结果判断模块,若加密或解密操作成功,则返回操作成功状态,若加密或解密操作失败,则尝试回滚到视频文件进行加密或解密操作前的状态;The encryption result judging module, if the encryption or decryption operation is successful, then returns the operation success state, if the encryption or decryption operation fails, then tries to roll back to the state before the video file is encrypted or decrypted;
回滚结果判断模块,若回滚操作成功,则返回操作失败状态,若回滚操作失败,则返回无法复原状态。The rollback result judging module, if the rollback operation is successful, returns the operation failure state, and if the rollback operation fails, returns the unrecoverable state.
本方案可以采用C/C++语言编写,生成系统环境下能够调用的动态库,供视频软件调用。例如,生成Android环境下可以调用的动态库so文件,供Android环境的视频软件调用。本方案如采用常规代码占用存储空间大小为104k,若编译生成库文件占用存储空间30k左右,更加适合服务器或其他相关视频播放软件的快速调用。This program can be written in C/C++ language to generate a dynamic library that can be called in the system environment for calling by video software. For example, a dynamic library so file that can be called in the Android environment is generated for calling by video software in the Android environment. If the solution uses conventional code, the storage space occupied is 104k, and if the library file is compiled and generated, the storage space is about 30k, which is more suitable for the quick call of the server or other related video playback software.
下面通过一组实施例对本发明做进一步说明:The present invention will be further described below by a group of embodiment:
如图1所示,本发明提供了一种用于视频数据传输的自动识别加密解密方法。该方法的具体步骤如下:As shown in Fig. 1, the present invention provides an automatic identification encryption and decryption method for video data transmission. The concrete steps of this method are as follows:
在步骤S1中,获取并处理传递的参数,包括需加密或解密的视频文件路径、具体操作指令;其中,具体操作指令为查看视频文件的加解密状态、加密操作和解密操作。如果操作指令为查看视频文件的加解密状态,则执行步骤S2。In step S1, the transmitted parameters are obtained and processed, including the path of the video file to be encrypted or decrypted, and specific operation instructions; wherein, the specific operation instructions are to check the encryption and decryption status of the video file, encryption operation and decryption operation. If the operation instruction is to check the encryption and decryption status of the video file, step S2 is executed.
S2步骤中会对视频文件进行状态判断,返回状态有已加密、已解密和未处理三种状态。已加密状态表示目标视频现在为加密状态,需进行解密才能正常浏览;已解密状态表示目标视频现在为解密状态,可以进行浏览;未处理状态表示该视频从未进行过加密或解密操作。In step S2, the status of the video file will be judged, and the returned status has three statuses: encrypted, decrypted and unprocessed. Encrypted state means that the target video is currently encrypted and needs to be decrypted to browse normally; Decrypted state means that the target video is now decrypted and can be viewed; Unprocessed state means that the video has never been encrypted or decrypted.
如果操作指令为加密或解密视频视频文件,则执行步骤S3。If the operation instruction is to encrypt or decrypt the video file, step S3 is executed.
S2步骤会根据指令对视频文件进行加密或解密操作,操作完成后执行S3返回加密/解密操作的执行结果,结果分为加密或解密成功能;加密或解密失败,如果加密或解密失败程序会尝试回滚视频文件操作前状态;视频文件无法复原,当加密或解密失败后,回滚操作也同样失败时,会返回该状态标识。当操作指令为加密或解密视频文件时,执行步骤S3。Step S2 will encrypt or decrypt the video file according to the instruction. After the operation is completed, execute S3 to return the execution result of the encryption/decryption operation. The result is divided into encryption or decryption. If the encryption or decryption fails, the program will try Roll back the state before the operation of the video file; the video file cannot be restored, and when the encryption or decryption fails, and the rollback operation also fails, this status indicator will be returned. When the operation instruction is to encrypt or decrypt a video file, step S3 is performed.
对于步骤S2中具体的加密或解密流程是通过本方案构建的局部循环加密或解密方法,该方法的具体执行步骤包括:For the specific encryption or decryption process in step S2 is a local loop encryption or decryption method constructed by this scheme, the specific execution steps of the method include:
S21、对最大尝试加密或解密操作次数maxCount、当前加密或解密操作次数count和视频加密或解密结果的初始状态进行初始化设定;S21. Initialize the maximum number of encryption or decryption operations maxCount, the current number of encryption or decryption operations count, and the initial state of the video encryption or decryption result;
S22、通过判断条件:加密或解密状态是否为操作失败状态且当前加密或解密次数count小于最大尝试加密或解密操作次数maxCount,决定是否可以尝试为待传输视频文件加密;若满足判断条件,则执行步骤S23,若不满足判断条件,则执行步骤S3;S22. Pass the judgment condition: whether the encryption or decryption status is an operation failure state and the current encryption or decryption times count is less than the maximum number of attempts to encrypt or decrypt operations maxCount, determine whether it is possible to try to encrypt the video file to be transmitted; if the judgment condition is met, then execute Step S23, if the judgment condition is not met, then execute step S3;
S23、为视频文件设置加密或解密操作的操作标识,并判断操作标识设置是否成功,若成功,则执行步骤S24,若失败,则尝试加密或解密操作次数count加1,并重复步骤S22和S23,直至标识成功或不满足步骤S22的判断条件为止;S23, set the operation identification of encryption or decryption operation for the video file, and judge whether the operation identification setting is successful, if successful, then perform step S24, if failed, then try to add 1 to the count of times of encryption or decryption operations, and repeat steps S22 and S23 , until the identification is successful or the judgment condition of step S22 is not satisfied;
S24、根据用户需求,对待传输视频文件指定位置的内容进行加密或解密操作;S24. Encrypt or decrypt the content at the specified location of the video file to be transmitted according to user requirements;
S25、判断加密或解密操作是否成功,若成功,则完成待传输视频文件的加密或解密操作,若失败,则执行步骤S22至S25,直至操作成功或不满足步骤S22的判断条件为止。S25. Determine whether the encryption or decryption operation is successful. If successful, complete the encryption or decryption operation of the video file to be transmitted. If it fails, perform steps S22 to S25 until the operation succeeds or the judgment condition of step S22 is not satisfied.
4、根据权利要求1所述的自动识别加密方法,其特征在于,所述S24包括:4. The automatic identification and encryption method according to claim 1, wherein said S24 includes:
S241、将待传输视频文件的头部1024字节作为加密或解密的对象;S241. Taking the header 1024 bytes of the video file to be transmitted as the object of encryption or decryption;
S242、设初始位置为site=0;S242. Set the initial position as site=0;
S243、判断当前待传输视频文件的头部1024字节是否加密完成,若未完成,则从1024字节中取出16字节的数据,并对这16个字节数据进行加密处理,若已完成加密,则从1024字节中取出16字节的数据,并对这16个字节数据进行解密处理;若读取数据失败或加密/解密操作失败,则直接退出;S243, judging whether the encryption of the header 1024 bytes of the currently to-be-transmitted video file is completed, if not completed, then take out 16 bytes of data from the 1024 bytes, and encrypt the 16 bytes of data, if completed Encryption, take out 16 bytes of data from 1024 bytes, and decrypt the 16 bytes of data; if the read data fails or the encryption/decryption operation fails, it exits directly;
S244、将加密或解密后的数据写入site处,若写失败则退出;S244. Write the encrypted or decrypted data into the site, and exit if the writing fails;
S245、再在所述1024字节中取16字节,即为site=site+16,并重复执行步骤S243至步骤S245,直至所述1024字节数据全部加密或解密完成。S245. Then take 16 bytes out of the 1024 bytes, that is, site=site+16, and repeat step S243 to step S245 until all the 1024 bytes of data are encrypted or decrypted.
在state为操作成功状态,或者已加密或解密操作次数大于等于最大尝试加密或解密操作次数后会进入步骤S3。Step S3 will be entered after the state is the operation success state, or the number of encrypted or decrypted operations is greater than or equal to the maximum number of attempted encryption or decrypted operations.
步骤S3中根据最终结果会做如下操作,当加密或解密操作成功时,返回操作成功状态;当加密或解密操作失败后,尝试回滚到视频文件操作前状态,如果成功回滚,返回操作失败状态;如果回滚操作也失败,则返回无法复原状态。In step S3, the following operations will be performed according to the final result. When the encryption or decryption operation is successful, return to the operation success state; when the encryption or decryption operation fails, try to roll back to the state before the video file operation. If the rollback is successful, the return operation fails status; if the rollback operation also fails, the unrecoverable status is returned.
整体视频加密或解密视频文件操作完成。Entire video encryption or decryption of video files is complete.
显然,本发明的上述实施例仅仅是为清楚地说明本发明所作的举例,而并非是对本发明的实施方式的限定,对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动,这里无法对所有的实施方式予以穷举,凡是属于本发明的技术方案所引伸出的显而易见的变化或变动仍处于本发明的保护范围之列。Obviously, the above-mentioned embodiments of the present invention are only examples for clearly illustrating the present invention, rather than limiting the implementation of the present invention. For those of ordinary skill in the art, on the basis of the above description, they can also make It is not possible to exhaustively list all the implementation methods here, and all obvious changes or changes derived from the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201611149596.7A CN106686407B (en) | 2016-12-13 | 2016-12-13 | A kind of automatic identification encryption and decryption method and system for video data transmission |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201611149596.7A CN106686407B (en) | 2016-12-13 | 2016-12-13 | A kind of automatic identification encryption and decryption method and system for video data transmission |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN106686407A true CN106686407A (en) | 2017-05-17 |
| CN106686407B CN106686407B (en) | 2019-07-23 |
Family
ID=58868302
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201611149596.7A Active CN106686407B (en) | 2016-12-13 | 2016-12-13 | A kind of automatic identification encryption and decryption method and system for video data transmission |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106686407B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112100631A (en) * | 2020-08-11 | 2020-12-18 | 福建天泉教育科技有限公司 | Processing method and terminal for judging encryption of PPTX (Power Point X) document |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1689268A (en) * | 2003-05-22 | 2005-10-26 | 富士通株式会社 | Encrypted data reception device and decryption key updating method |
| CN102236607A (en) * | 2010-04-23 | 2011-11-09 | 国民技术股份有限公司 | Data security protection method and data security protection device |
| CN103731654A (en) * | 2013-12-23 | 2014-04-16 | 华中科技大学 | Information embedding system and information extracting system using 2D/3D videos |
| US20140298021A1 (en) * | 2011-10-10 | 2014-10-02 | Korea University Research And Business Foundation | Method and system for storing information by using tcp communication |
| CN104320420A (en) * | 2014-11-17 | 2015-01-28 | 国电南京自动化股份有限公司 | SCADA file encryption method based on AES algorithm |
| CN105939491A (en) * | 2016-05-25 | 2016-09-14 | 乐视控股(北京)有限公司 | Video playing method and device |
-
2016
- 2016-12-13 CN CN201611149596.7A patent/CN106686407B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1689268A (en) * | 2003-05-22 | 2005-10-26 | 富士通株式会社 | Encrypted data reception device and decryption key updating method |
| CN102236607A (en) * | 2010-04-23 | 2011-11-09 | 国民技术股份有限公司 | Data security protection method and data security protection device |
| US20140298021A1 (en) * | 2011-10-10 | 2014-10-02 | Korea University Research And Business Foundation | Method and system for storing information by using tcp communication |
| CN103731654A (en) * | 2013-12-23 | 2014-04-16 | 华中科技大学 | Information embedding system and information extracting system using 2D/3D videos |
| CN104320420A (en) * | 2014-11-17 | 2015-01-28 | 国电南京自动化股份有限公司 | SCADA file encryption method based on AES algorithm |
| CN105939491A (en) * | 2016-05-25 | 2016-09-14 | 乐视控股(北京)有限公司 | Video playing method and device |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112100631A (en) * | 2020-08-11 | 2020-12-18 | 福建天泉教育科技有限公司 | Processing method and terminal for judging encryption of PPTX (Power Point X) document |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106686407B (en) | 2019-07-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9853953B2 (en) | Method of transferring rights object and electronic device | |
| CN100565457C (en) | The system and method for safety input is provided to the system with high-security execution environment | |
| JP4763368B2 (en) | COMMUNICATION CARD, CONFIDENTIAL INFORMATION PROCESSING SYSTEM, CONFIDENTIAL INFORMATION TRANSFER METHOD, AND PROGRAM | |
| US8495365B2 (en) | Content processing apparatus and encryption processing method | |
| JP2002229861A (en) | Recording device with copyright protection function | |
| CN104794388B (en) | application program access protection method and application program access protection device | |
| CN108763917A (en) | A kind of data encryption/decryption method and device | |
| CN105468940A (en) | Software protection method and apparatus | |
| CN101815292B (en) | Device and method for protecting data of mobile terminal | |
| CN110659506A (en) | Replay protection of memory based on key refresh | |
| CN113591107A (en) | System and method for realizing file redirection encryption and decryption | |
| CN105915541A (en) | Mobile terminal password preservation and recovery processing method based on NFC and system thereof | |
| CN100405335C (en) | Memory information protection system, semiconductor memory and method for protecting memory information | |
| CN106686407A (en) | Automatic identification encryption and decryption method and system for video data transmission | |
| JP3984951B2 (en) | Content usage frequency limiting method, content usage terminal device, content usage system, computer program, and computer-readable recording medium | |
| JP4592337B2 (en) | Data storage | |
| JP4222132B2 (en) | Software providing method and system | |
| CN110909318B (en) | Operating system anti-theft method and device for user equipment and terminal | |
| CN117592069A (en) | Encryption and decryption method and system for external mobile storage medium | |
| CN115017927B (en) | Card simulation method, electronic device, and storage medium | |
| CN209103293U (en) | Electronic equipment | |
| CN117176325A (en) | Encryption processing method, decryption processing method and related devices | |
| JPWO2006118101A1 (en) | CONFIDENTIAL INFORMATION PROCESSING HOST DEVICE AND CONFIDENTIAL INFORMATION PROCESSING METHOD | |
| JP2008287689A (en) | Group encryption and decryption system and method, and program | |
| TWI887740B (en) | Micro-controller, secure system, and protection method |
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 | ||
| CP01 | Change in the name or title of a patent holder |
Address after: 100085, Beijing, Haidian District information road, No. 28, information building, block A, seven Patentee after: Beijing Interactive Encyclopedia Network Technology Co.,Ltd. Address before: 100085, Beijing, Haidian District information road, No. 28, information building, block A, seven Patentee before: BEIJING HUDONG BAIKE NETWORK TECHNOLOGY CO.,LTD. |
|
| CP01 | Change in the name or title of a patent holder | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20190924 Address after: 100041, room 2, building 3, building 30, Xing Xing street, Shijingshan District, Beijing, Patentee after: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd. Address before: 100085, Beijing, Haidian District information road, No. 28, information building, block A, seven Patentee before: Beijing Interactive Encyclopedia Network Technology Co.,Ltd. |
|
| TR01 | Transfer of patent right | ||
| CP03 | Change of name, title or address |
Address after: Room 2, room 3, building No. 3, courtyard 30, Shixing Avenue, Shijingshan District, Beijing, Beijing Patentee after: Douyin Vision Co.,Ltd. Country or region after: China Address before: Room 2, room 3, building No. 3, courtyard 30, Shixing Avenue, Shijingshan District, Beijing, Beijing Patentee before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd. Country or region before: China |
|
| CP03 | Change of name, title or address |