WO2019061185A1 - 对图片进行数字签名的方法及终端 - Google Patents

对图片进行数字签名的方法及终端 Download PDF

Info

Publication number
WO2019061185A1
WO2019061185A1 PCT/CN2017/104065 CN2017104065W WO2019061185A1 WO 2019061185 A1 WO2019061185 A1 WO 2019061185A1 CN 2017104065 W CN2017104065 W CN 2017104065W WO 2019061185 A1 WO2019061185 A1 WO 2019061185A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
signed
picture
value
matrix
Prior art date
Application number
PCT/CN2017/104065
Other languages
English (en)
French (fr)
Inventor
陆晓华
Original Assignee
深圳传音通讯有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 深圳传音通讯有限公司 filed Critical 深圳传音通讯有限公司
Priority to PCT/CN2017/104065 priority Critical patent/WO2019061185A1/zh
Publication of WO2019061185A1 publication Critical patent/WO2019061185A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof

Definitions

  • the present invention relates to the field of encryption technologies, and in particular, to a method and a terminal for digitally signing a picture.
  • digital signature is similar to the signature written on paper.
  • digital signature is a kind of encryption technology. A method of identifying the source of digital information.
  • the method for digitally signing text information is as follows.
  • the terminal extracts the text information, converts it into summary information, and adds encryption based on the summary information. Algorithm to make it a digital signature.
  • the receiving user receives the text information, the digital signature is restored to the summary information by the corresponding decryption algorithm, and the source of the information is determined by determining whether the two summary information are consistent.
  • Embodiments of the present invention provide a method and a terminal for digitally signing a picture, which can digitally sign a picture to improve the security of information exchange.
  • the present invention provides a method of digitally signing a picture, comprising:
  • the terminal acquires a picture to be signed, a user key, and user identity information
  • the terminal generates a digital signature according to the hash value of the to-be-signed picture, the user key, and the user identity information.
  • the determining, by the terminal, the hash value of the to-be-signed image according to the to-be-signed image includes:
  • the terminal performs gray processing on the thumbnail to obtain a grayscale image corresponding to the thumbnail
  • the terminal determines a hash value of the picture to be signed according to a gray value of each pixel in the grayscale image.
  • the size of the thumbnail is 8x8, the gray level of the grayscale image is 64, and the terminal determines the grayscale value according to each pixel in the grayscale image.
  • the hash value of the image to be signed including:
  • the terminal acquires a gray average value of the grayscale image according to a grayscale value of each pixel in the grayscale image
  • the terminal determines a hash value of the to-be-signed picture according to a gray value of each pixel in the grayscale image and a grayscale average value of the grayscale image.
  • the size of the thumbnail is 32x32
  • the gray level of the grayscale image is 64
  • the terminal determines the grayscale value according to each pixel in the grayscale image.
  • the hash value of the image to be signed including:
  • the terminal acquires a frequency average value of the second matrix according to a frequency value of each pixel in the second matrix
  • the terminal determines a hash value of the to-be-signed picture according to a frequency value of each pixel in the second matrix and a frequency average value of the second matrix.
  • the thumbnail has a size of 9x8, and the grayscale has a gray level of 64;
  • Determining, by the terminal, the hash value of the to-be-signed image according to the gray value of each pixel in the grayscale image including:
  • the terminal acquires a matrix of difference values according to a difference value of adjacent pixels in each row, where the matrix of difference values is an 8 ⁇ 8 matrix;
  • the terminal determines a hash value of the to-be-signed picture according to the difference value matrix.
  • the terminal generates a digital signature according to the hash value of the to-be-signed picture, the user key, and the user identity information, including:
  • the terminal generates summary information according to the hash value of the to-be-signed picture and the user identity information
  • the terminal encrypts the digest information by using the user key to generate the digital signature.
  • the terminal acquires user identity information, including:
  • the terminal reads a user identity identifier in the user identification card
  • the terminal generates user identity information according to the user identity.
  • the present invention also provides a terminal for digitally signing a picture, including:
  • An obtaining module configured to obtain a picture to be signed, a user key, and user identity information
  • a determining module configured to determine a hash value of the to-be-signed image according to the to-be-signed image
  • a generating module configured to generate a digital signature according to the hash value of the to-be-signed picture, the user key, and the user identity information.
  • the determining module is specifically configured to obtain a thumbnail of the to-be-signed picture
  • the determining module is further configured to perform gray processing on the thumbnail to obtain a grayscale image corresponding to the thumbnail;
  • the determining module is further configured to determine a hash value of the to-be-signed image according to a gray value of each pixel in the grayscale image.
  • the generating module is specifically configured to generate summary information according to the hash value of the to-be-signed picture and the user identity information;
  • the generating module is further configured to encrypt the digest information by using the user key to generate the digital signature.
  • the size of the thumbnail is 8x8, and the gray level of the grayscale is 64;
  • the determining module is further configured to acquire a gray average value of the grayscale image according to a grayscale value of each pixel in the grayscale image;
  • the determining module is further configured to determine a hash value of the to-be-signed image according to a gray value of each pixel in the grayscale image and a grayscale average value of the grayscale image.
  • the size of the thumbnail is 32x32, and the gray level of the grayscale image is 64;
  • the determining module is further configured to perform discrete cosine transform processing on the grayscale image to obtain a first matrix and a second matrix; wherein the size of the first matrix is 32x32, and the size of the second matrix is 8x8, the second matrix is located in an upper left corner of the first matrix;
  • the determining module is further configured to acquire a frequency average value of the second matrix according to a frequency value of each pixel in the second matrix;
  • the determining module is further configured to determine a hash value of the to-be-signed picture according to a frequency value of each pixel in the second matrix and a frequency average value of the second matrix.
  • the thumbnail has a size of 9x8, and the grayscale has a gray level of 64;
  • the determining module is further configured to acquire, according to the grayscale image, a difference value of adjacent pixels in each row in the grayscale image;
  • the determining module is further configured to obtain a matrix of difference values according to a difference value of adjacent pixels in each row, where the matrix of the difference value is an 8 ⁇ 8 matrix;
  • the determining module is further configured to determine a hash value of the to-be-signed picture according to the difference value matrix.
  • the obtaining module is further configured to read a user identity identifier in the user identity card
  • the obtaining module is further configured to generate user identity information according to the user identity.
  • the present invention further provides a terminal, including:
  • a memory for storing processor executable instructions
  • processor is configured to:
  • the present invention also provides a storage medium comprising: a readable storage medium and a computer program for digitally signing a picture as described in the first aspect and various possible designs of the first aspect Methods.
  • FIG. 1 is a flow chart of a method for digitally signing a picture in an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for determining, by a terminal, a hash value of a picture to be signed according to a picture to be signed according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • FIG. 4 is a block diagram of a terminal in an embodiment of the present invention.
  • Image to be signed It belongs to a kind of electronic file.
  • the format of the image is many, and it can include bitmaps in BMP, JPG and other formats and vector graphics in SWF, CDR, AI, etc.
  • Thumbnail A small image formed by compressing the original image
  • Pixel refers to the basic unit that constitutes a digital image.
  • the pixel resolution is usually expressed in pixels per inch of PPI (pixels per inch).
  • PPI pixels per inch
  • 300x300PPI resolution which means that the number of pixels per inch in the horizontal and vertical directions is 300, or can be expressed as 90,000 (300x300) pixels in one square inch;
  • Grayscale uses black tones to represent objects, that is, black as the reference color and black with different saturations to display the image;
  • Gray level also known as color scale or gray scale, refers to the brightness of the brightness
  • Key is a parameter that is input in an algorithm that converts plaintext to ciphertext or converts ciphertext to plaintext;
  • Hash value maps a binary value of arbitrary length to a smaller binary value of a fixed length. This small binary value is called a hash value
  • Discrete Cosine Transform is a transform related to Fourier transform, which is similar to Discrete Fourier Transform (DFT), but only uses real numbers;
  • the method for digitally signing a picture provided by the present invention aims to solve the above technical problems of the prior art.
  • FIG. 1 is a flowchart of a method for digitally signing a picture according to an embodiment of the present invention.
  • the executor of the embodiment may be a terminal, and the terminal involved in the embodiment of the present invention includes but is not limited to: a smart phone, a tablet computer, Laptops, desktops.
  • the method 100 of this embodiment may include the following steps:
  • Step S101 The terminal acquires a picture to be signed, a user key, and user identity information.
  • Step S102 The terminal determines, according to the to-be-signed picture, a hash value of the to-be-signed picture
  • Step S103 The terminal generates a digital signature according to the hash value of the to-be-signed picture, the user key, and the user identity information.
  • step S101 the terminal acquires the picture to be signed, the user key, and the user identity information.
  • the terminal can obtain a picture to be signed according to the operation of the user. For example, the user can select at least one picture in the terminal album as a picture to be signed by clicking, scribing, etc., and the user key can be pre-stored by the user. in.
  • the terminal acquiring the user identity information may include the following steps:
  • the terminal reads a user identity identifier in the user identification card
  • the terminal generates user identity information according to the user identity.
  • the mobile phone Take the mobile phone as an example to illustrate this process.
  • the mobile phone reads the Subscriber Identification Module (SIM card) installed on the mobile phone, and the SIM card stores the user identity, for example, the user's name, mobile phone number, and network access. Time, etc.; the mobile phone uses the user identity as the user identity information to prepare for generating a digital signature.
  • SIM card Subscriber Identification Module
  • step S102 the terminal determines a hash value of the to-be-signed picture by using a preset algorithm according to the acquired picture to be signed. For example, the terminal extracts pixels, gradations, or luminance values of the picture to be signed. The pixel, the gradation or the brightness of the picture to be signed is converted into a binary value, and then the binary value is mapped to a lesser binary value, that is, a hash value is obtained.
  • step S103 the terminal generates a digital signature according to the hash value of the picture to be signed, the user key, and the user identity information. Specifically, the terminal generates digest information according to the hash value of the to-be-signed picture and the user identity information; the terminal encrypts the digest information by using the user key to generate the digital signature.
  • the terminal combines and generates summary information according to a hash value of the picture to be signed and user identity information by using a preset algorithm.
  • the hash value and the user identity information of the picture to be signed are converted into a character string by a hash algorithm, that is, the summary information is a fixed length value corresponding to an electronic file, which is a one-way hash encryption function pair.
  • the content works to produce it.
  • the terminal encrypts the digest information through the user key to complete the digital signature of the picture.
  • the terminal converts the picture and the user identity information into summary information, and then adds the summary information.
  • the encryption algorithm of the user key makes it a digital signature.
  • the receiver user restores the digital signature to the summary information through the corresponding key decryption algorithm, determines the source of the picture by determining whether the two summary information are consistent, thereby improving the security of the information exchange.
  • FIG. 2 is a flowchart of a method for digitally signing a picture according to another embodiment of the present invention. As shown in FIG. 2, the method 200 can include the following steps:
  • the terminal acquires a thumbnail of the to-be-signed picture.
  • the terminal performs gray processing on the thumbnail to obtain a grayscale image corresponding to the thumbnail.
  • the terminal determines, according to a gray value of each pixel in the grayscale image, a hash value of the to-be-signed image.
  • the terminal converts the picture to be signed into a thumbnail by compression processing.
  • the compression process can be to first reduce the image to a preset size, such as 8x8 size, for a total of 64 pixels. Thumbnails can remove the details of the image, leaving only the basic information such as structure, shading, etc., and discard the differences in the images caused by different sizes and proportions.
  • the terminal performs gradation processing on the thumbnail to obtain a grayscale map corresponding to the thumbnail.
  • each pixel in the figure only needs one byte to store the grayscale value, so that the information of the image itself can be simplified, and the subsequent calculation amount can be reduced.
  • the terminal can determine the hash value of the picture to be signed according to the gray value of each pixel in the grayscale image and the preset algorithm.
  • the method for determining, by the terminal, the hash value of the picture to be signed according to the picture to be signed may include the following implementation manners.
  • the first type the size of the thumbnail is 8x8, and the gray level of the grayscale image is 64, the terminal determines the to-be-signed image according to the gray value of each pixel in the grayscale image.
  • the hash value can specifically include the following steps:
  • the terminal acquires a gray average value of the grayscale image according to a grayscale value of each pixel in the grayscale image
  • the terminal determines a hash value of the to-be-signed picture according to a gray value of each pixel in the grayscale image and a grayscale average value of the grayscale image.
  • a flag with a pixel value greater than the average value is labeled 1, and a flag less than or equal to the average value is zero.
  • a string of 64 numbers is
  • the second type the size of the thumbnail is 32x32, and the gray level of the grayscale image is 64, the terminal determines the to-be-signed image according to the gray value of each pixel in the grayscale image.
  • the hash value can specifically include the following steps:
  • the size of the first matrix is 32x32
  • the size of the second matrix is 8x8, and the second matrix is located at an upper left corner within the first matrix;
  • the terminal acquires a frequency average value of the second matrix according to a frequency value of each pixel in the second matrix
  • the terminal determines a hash value of the to-be-signed picture according to a frequency value of each pixel in the second matrix and a frequency average value of the second matrix.
  • this method performs discrete cosine transform processing on the grayscale image.
  • the discrete-cosine transform processing can perform low-frequency extraction on the image.
  • Discrete cosine transform is an image compression algorithm that transforms an image from a pixel domain to a frequency domain.
  • the first matrix obtained by discrete cosine transform, from the upper left corner to the lower right corner, the frequency is getting higher and higher, so the value of the upper left corner is larger, and the value to the lower right corner is smaller.
  • the energy of the image is almost concentrated on the low frequency coefficient of the place in the upper left corner, so the acquired second matrix can present the lowest frequency of the picture.
  • This kind of can tolerate the deformation rate of about 25%. As long as the overall structure of the picture remains unchanged, the calculation result of the hash value will not change, and the influence of the gamma correction or the color histogram being adjusted can be avoided.
  • the size of the thumbnail is 9x8, and the gray level of the grayscale image is 64;
  • the terminal determines the hash value of the to-be-signed image according to the gray value of each pixel in the grayscale image, and specifically includes the following steps:
  • the terminal acquires a matrix of difference values according to a difference value of adjacent pixels in each row, where the matrix of difference values is an 8 ⁇ 8 matrix;
  • the terminal determines a hash value of the to-be-signed picture according to the difference value matrix.
  • the difference value is obtained by comparing the pixel on the right of each row with the pixel on the left, and the first pixel of the second row is not compared to any pixel in the first row.
  • the thumbnail 9x8 8 different differences are generated between 9 pixels per line, and a total of 8 lines generate 64 difference values, thereby obtaining an 8x8 difference value matrix, and the first Approximate way, by judging whether the difference value is greater than 0, it is converted into a string. For example, if the difference value is greater than 0, the record is 1; otherwise, 0, and 64-bit string can be obtained by the 64 difference values. The string is the hash value. This method has higher acquisition efficiency.
  • FIG. 3 is a schematic structural diagram of a terminal according to an embodiment of the present invention. As shown in FIG. 3, the terminal 40 includes:
  • An obtaining module configured to obtain a picture to be signed, a user key, and user identity information
  • a determining module configured to determine a hash value of the to-be-signed image according to the to-be-signed image
  • a generating module configured to generate a digital signature according to the hash value of the to-be-signed picture, the user key, and the user identity information.
  • the determining module is specifically configured to acquire a thumbnail of the to-be-signed picture
  • the determining module is further configured to perform gray processing on the thumbnail to obtain a grayscale image corresponding to the thumbnail;
  • the determining module is further configured to determine a hash value of the to-be-signed image according to a gray value of each pixel in the grayscale image.
  • the generating module is configured to generate summary information according to the hash value of the to-be-signed image and the user identity information;
  • the generating module is further configured to encrypt the digest information by using the user key to generate the digital signature.
  • the size of the thumbnail is 8x8, and the gray level of the grayscale image is 64;
  • the determining module is further configured to acquire a gray average value of the grayscale image according to a grayscale value of each pixel in the grayscale image;
  • the determining module is further configured to determine a hash value of the to-be-signed image according to a gray value of each pixel in the grayscale image and a grayscale average value of the grayscale image.
  • the size of the thumbnail is 32x32, and the gray level of the grayscale image is 64;
  • the determining module is further configured to perform discrete cosine transform processing on the grayscale image to obtain a first matrix and a second matrix; wherein the size of the first matrix is 32x32, and the size of the second matrix is 8x8, the second matrix is located in an upper left corner of the first matrix;
  • the determining module is further configured to acquire a frequency average value of the second matrix according to a frequency value of each pixel in the second matrix;
  • the determining module is further configured to determine a hash value of the to-be-signed picture according to a frequency value of each pixel in the second matrix and a frequency average value of the second matrix.
  • the size of the thumbnail is 9x8, and the gray level of the grayscale image is 64;
  • the determining module is further configured to acquire, according to the grayscale image, a difference value of adjacent pixels in each row in the grayscale image;
  • the determining module is further configured to obtain a matrix of difference values according to a difference value of adjacent pixels in each row, where the matrix of the difference value is an 8 ⁇ 8 matrix;
  • the determining module is further configured to determine a hash value of the to-be-signed picture according to the difference value matrix.
  • the obtaining module is further configured to read a user identity identifier in the user identity card;
  • the obtaining module is further configured to generate user identity information according to the user identity.
  • FIG. 4 is a block diagram of a terminal in an embodiment of the present invention, which may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.
  • Terminal 500 can include one or more of the following components: processing component 502, memory 504, power component 506, multimedia component 508, audio component 510, input/output (I/O) interface 512, sensor component 514, and communication component 516.
  • Processing component 502 typically controls the overall operation of terminal 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations.
  • Processing component 502 can include one or more processors 520 to execute instructions to perform all or part of the steps of the above described methods.
  • processing component 502 can include one or more modules to facilitate interaction between component 502 and other components.
  • processing component 502 can include a multimedia module to facilitate interaction between multimedia component 508 and processing component 502.
  • the memory 504 is configured to store various types of data to support operation at the terminal 500. Examples of such data include instructions for any application or method operating on terminal 500, contact data, phone book data, messages, pictures, videos, and the like.
  • the memory 504 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Disk Disk or Optical Disk.
  • Power component 506 provides power to various components of terminal 500.
  • Power component 506 can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for terminal 500.
  • the multimedia component 508 includes a screen between the terminal 500 and the user that provides an output interface.
  • the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor may sense not only the boundary of the touch or sliding action, but also the duration and pressure associated with the touch or slide operation.
  • the multimedia component 508 includes a front camera and/or a rear camera. When the terminal 500 is in an operation mode such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front and rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.
  • the audio component 510 is configured to output and/or input an audio signal.
  • the audio component 510 includes a microphone (MIC) that is configured to receive an external audio signal when the terminal 500 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode.
  • the received audio signal may be further stored in memory 504 or transmitted via communication component 516.
  • audio component 510 also includes a speaker for outputting an audio signal.
  • the I/O interface 512 provides an interface between the processing component 502 and the peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to, a home button, a volume button, a start button, and a lock button.
  • Sensor assembly 514 includes one or more sensors for providing terminal 500 with various aspects of status assessment.
  • sensor component 514 can detect an open/closed state of terminal 500, a relative positioning of components, such as the display and keypad of terminal 500, and sensor component 514 can also detect a change in position of a component of terminal 500 or terminal 500. The presence or absence of contact of the user with the terminal 500, the orientation or acceleration/deceleration of the terminal 500, and the temperature change of the terminal 500.
  • Sensor assembly 514 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact.
  • Sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications.
  • the sensor component 514 can also include an acceleration sensor, a gyro sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 516 is configured to facilitate wired or wireless communication between terminal 500 and other devices.
  • the terminal 500 can access a wireless network based on a communication standard such as WiFi, 2G or 3G, or a combination thereof.
  • communication component 516 receives broadcast signals or broadcast associated information from an external broadcast management system via a broadcast channel.
  • the communication component 516 also includes a near field communication (NFC) module to facilitate short range communication.
  • NFC near field communication
  • the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • terminal 500 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays. (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the above methods.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable gate arrays.
  • controller microcontroller, microprocessor or other electronic component implementation for performing the above methods.
  • non-transitory computer readable storage medium comprising instructions, such as a memory 504 comprising instructions executable by processor 520 of terminal 500 to perform the above method.
  • the non-transitory computer readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic Tapes, floppy disks, and optical data storage devices.
  • a storage medium comprising: a readable storage medium and a computer program for implementing the method of digitally signing a picture in the above embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Storage Device Security (AREA)

Abstract

本申请公开了一种对图片进行数字签名的方法及终端。该方法包括:终端获取待签名图片、用户密钥以及用户身份信息;所述终端根据所述待签名图片确定所述待签名图片的哈希值;所述终端根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名。本申请提供的对图片进行数字签名的方法及终端,可以对图片进行数字签名,提高信息往来的安全性。

Description

对图片进行数字签名的方法及终端 技术领域
本发明涉及加密技术领域,具体涉及一种对图片进行数字签名的方法及终端。
背景技术
随着信息科技的发展,信息安全变得愈发重要。为了提高信息往来的安全性,人们在发送电子信息时,通常会在所发的信息中加入数字签名,数字签名与写在纸上的签名类似,简单来说,数字签名是一种利用加密技术鉴别数字信息来源的方法。
现有技术中,对文字信息进行数字签名的方法如下,发送方用户使用终端发送文字信息时,终端将文字信息提取出来,并将其转化为摘要信息,再在该摘要信息的基础上加入加密算法,使之成为数字签名。对应的,接收方用户在接收文字信息时,通过相应的解密算法将数字签名还原为摘要信息,通过判断两个摘要信息是否一致,确定该信息的来源。
然而,在当今生活中,图片的往来越来越多,而如何对图片进行数字签名还没有很好的解决方法。因此,如何对图片进行数字签名,是亟待解决的问题。
发明内容
本发明实施例提供一种对图片进行数字签名的方法及终端,可以对图片进行数字签名,提高信息往来的安全性。
第一方面,本发明提供了一种对图片进行数字签名的方法,包括:
终端获取待签名图片、用户密钥以及用户身份信息;
所述终端根据所述待签名图片确定所述待签名图片的哈希值;
所述终端根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名。
在一种可能的设计中,所述终端根据所述待签名图片确定所述待签名图片的哈希值,包括:
所述终端获取所述待签名图片的缩略图;
所述终端对所述缩略图进行灰度处理,得到所述缩略图对应的灰度图;
所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值。
在一种可能的设计中,所述缩略图的尺寸为8x8,所述灰度图的灰度等级为64,所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,包括:
所述终端根据所述灰度图中各像素的灰度值,获取所述灰度图的灰度平均值;
所述终端根据所述灰度图中各像素的灰度值和所述灰度图的灰度平均值确定所述待签名图片的哈希值。
在一种可能的设计中,所述缩略图的尺寸为32x32,所述灰度图的灰度等级为64,所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,包括:
所述终端对所述灰度图进行离散余弦变换处理,得到第一矩阵和第二矩阵;其中,所述第一矩阵的尺寸为32x32,所述第二矩阵的尺寸为8x8,所述第二矩阵位于所述第一矩阵内的左上角;
所述终端根据所述第二矩阵中各像素的频率值,获取所述第二矩阵的频率平均值;
所述终端根据所述第二矩阵中各像素的频率值和所述第二矩阵的频率平均值确定所述待签名图片的哈希值。
在一种可能的设计中,所述缩略图的尺寸为9x8,所述灰度图的灰度等级为64;
所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,包括:
所述终端根据所述灰度图获取所述灰度图中每行内相邻像素的差异值;
所述终端根据每行内相邻像素的差异值,获取差异值矩阵,所述差异值矩阵为8x8矩阵;
所述终端根据所述差异值矩阵确定所述待签名图片的哈希值。
在一种可能的设计中,所述终端根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名,包括:
所述终端根据所述待签名图片的哈希值和所述用户身份信息生成摘要信息;
所述终端通过所述用户密钥对所述摘要信息进行加密,生成所述数字签名。
在一种可能的设计中,所述终端获取用户身份信息,包括:
所述终端读取用户身份识别卡中的用户身份标识;
所述终端根据所述用户身份标识生成用户身份信息。
第二方面,本发明还提供了一种对图片进行数字签名的终端,包括:
获取模块,用于获取待签名图片、用户密钥以及用户身份信息;
确定模块,用于根据所述待签名图片确定所述待签名图片的哈希值;
生成模块,用于根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名。
在一种可能的设计中,所述确定模块,具体用于获取所述待签名图片的缩略图;
所述确定模块,还具体用于对所述缩略图进行灰度处理,得到所述缩略图对应的灰度图;
所述确定模块,还具体用于根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值。
在一种可能的设计中,所述生成模块,具体用于根据所述待签名图片的哈希值和所述用户身份信息生成摘要信息;
所述生成模块,还具体用于通过所述用户密钥对所述摘要信息进行加密,生成所述数字签名。
在一种可能的设计中,所述缩略图的尺寸为8x8,所述灰度图的灰度等级为64;
所述确定模块,还具体用于根据所述灰度图中各像素的灰度值,获取所述灰度图的灰度平均值;
所述确定模块,还具体用于根据所述灰度图中各像素的灰度值和所述灰度图的灰度平均值确定所述待签名图片的哈希值。
在一种可能的设计中,所述缩略图的尺寸为32x32,所述灰度图的灰度等级为64;
所述确定模块,还具体用于对所述灰度图进行离散余弦变换处理,得到第一矩阵和第二矩阵;其中,所述第一矩阵的尺寸为32x32,所述第二矩阵的尺寸为8x8,所述第二矩阵位于所述第一矩阵内的左上角;
所述确定模块,还具体用于根据所述第二矩阵中各像素的频率值,获取所述第二矩阵的频率平均值;
所述确定模块,还具体用于根据所述第二矩阵中各像素的频率值和所述第二矩阵的频率平均值确定所述待签名图片的哈希值。
在一种可能的设计中,所述缩略图的尺寸为9x8,所述灰度图的灰度等级为64;
所述确定模块,还具体用于根据所述灰度图获取所述灰度图中每行内相邻像素的差异值;
所述确定模块,还具体用于根据每行内相邻像素的差异值,获取差异值矩阵,所述差异值矩阵为8x8矩阵;
所述确定模块,还具体用于根据所述差异值矩阵确定所述待签名图片的哈希值。
在一种可能的设计中,所述获取模块,还具体用于读取用户身份识别卡中的用户身份标识;
所述获取模块,还具体用于根据所述用户身份标识生成用户身份信息。
第三方面,本发明还提供一种终端,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为:
获取待签名图片、用户密钥以及用户身份信息;
根据所述待签名图片确定所述待签名图片的哈希值;
根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名。
第四方面,本发明还提供一种存储介质,包括:可读存储介质和计算机程序,所述计算机程序用于实现第一方面及第一方面各种可能的设计所述的对图片进行数字签名的方法。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明一实施例中的对图片进行数字签名的方法的流程图;
图2为本发明一实施例中的终端根据待签名图片确定待签名图片的哈希值的方法的流程图;
图3为本发明一实施例中的终端的结构示意图;
图4为本发明一实施例中的终端的框图。
具体实施方式
这里将详细地对实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的设备和方法的例子。
首先对本发明所涉及的名词进行解释:
待签名图片:属于电子文件中的一种,图片的格式很多,可以包括BMP、JPG等格式的点阵图和SWF、CDR、AI等格式的矢量图;
缩略图:由原始图片经压缩处理后所形成的小图;
像素:是指构成数码影像的基本单元,通常以像素每英寸PPI(pixels per inch)为单位来表示影像分辨率的大小。例如:300x300PPI分辨率,即表示水平方向与垂直方向上每英寸长度上的像素数都是300,也可表示为一平方英寸内有9万(300x300)像素;
灰度:灰度使用黑色调表示物体,即用黑色为基准色,不同的饱和度的黑色来显示图像;
灰度等级:也称色阶或灰阶,是指亮度的明暗程度;
密钥:是一种参数,它是在明文转换为密文或将密文转换为明文的算法中输入的参数;
哈希值:将任意长度的二进制值映射为固定长度的较小二进制值,这个小的二进制值称为哈希值;
离散余弦变换处理(Discrete Cosine Transform,简称DCT):是与傅里叶变换相关的一种变换,它类似于离散傅里叶变换(Discrete Fourier Transform,简称DFT),但是只使用实数;
本发明提供的对图片进行数字签名的方法,旨在解决现有技术的如上技术问题。
下面以具体地实施例对本发明的技术方案以及本发明的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本发明的实施例进行描述。
图1为本发明一实施例提供的对图片进行数字签名的方法的流程图,本实施例的执行主体可以为终端,本发明实施例中涉及的终端包括但不限于:智能手机、平板电脑、笔记本电脑、台式电脑。如图1所示,本实施例的方法100可以包括以下步骤:
步骤S101、终端获取待签名图片、用户密钥以及用户身份信息;
步骤S102、所述终端根据所述待签名图片确定所述待签名图片的哈希值;
步骤S103、所述终端根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名。
举例来说,用户若在邮件往来时,为了确保邮件内的图片文件未被改动,可以利 用终端对邮件中的图片进行数字签名,通过数字签名确认图片的来源。在用户打算对图片进行数字签名时,进入步骤S101,终端获取待签名图片、用户密钥以及用户身份信息。
其中,终端可以根据用户的操作,获取待签名图片,例如,用户可以通过点击、划取等操作选择终端相册中的至少一副图片作为待签名图片,而用户密钥则可以由用户预存在终端中。
另外,可选地,终端获取用户身份信息,可以包括如下步骤:
所述终端读取用户身份识别卡中的用户身份标识;
所述终端根据所述用户身份标识生成用户身份信息。
以手机为例,对此过程进行说明。当手机进行获取用户身份信息时,手机读取安装在手机上的用户身份识别卡(Subscriber Identification Module,简称SIM卡),SIM卡中存有用户身份标识,例如:用户的姓名、手机号码、入网时间等;手机将该用户身份标识作为用户身份信息,为生成数字签名做准备。
在步骤S102中,终端根据所获取的待签名图片,利用预设算法来确定该待签名图片的哈希值。例如,终端提取待签名图片的像素、灰度、或亮度值。将待签名图片的像素、灰度或者亮度等转换为二进制值,然后将该二进制值映射为较少二进制值,即得到了哈希值。
在步骤S103中,终端根据待签名图片的哈希值、用户密钥和用户身份信息生成数字签名。具体地,终端根据所述待签名图片的哈希值和所述用户身份信息生成摘要信息;所述终端通过所述用户密钥对所述摘要信息进行加密,生成所述数字签名。
举例来说,终端根据待签名图片的哈希值和用户身份信息,利用预设算法将其结合并生成摘要信息。例如:将待签名图片的哈希值和用户身份信息通过哈希算法转化为一字符串,即摘要信息是一个唯一对应一个电子文件的固定长度的值,它由一个单向哈希加密函数对内容进行作用而产生。然后,终端通过用户密钥对该摘要信息再经过加密处理,即可完成对图片的数字签名。
通过上述内容不难发现,利用本发明提供的对图片进行数字签名的方法,发送方用户使用终端发送图片时,终端将图片及用户身份信息转化为摘要信息,再在该摘要信息的基础上加入用户密钥的加密算法,使之成为数字签名。对应的,接收方用户在接收图片时,通过相应的密钥解密算法将数字签名还原为摘要信息,通过判断两个摘要信息是否一致,确定该图片的来源,从而提高信息往来的安全性。
下面结合图2,对确定待签名图片的哈希值的实现方式进行详细说明。
图2为本发明另一实施例提供的对图片进行数字签名的方法的流程图。如图2所示,该方法200可以包括以下步骤:
S201、所述终端获取所述待签名图片的缩略图;
S202、所述终端对所述缩略图进行灰度处理,得到所述缩略图对应的灰度图;
S203、所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值。
具体地说,终端在获取待签名图片后,通过压缩处理,将待签名图片转换为缩略图。压缩过程可以是,先将图片缩小到预设的尺寸,例如8x8的尺寸,总共有64个像素。缩略图可以去除图片的细节,只保留结构、明暗等基本信息,摒弃不同尺寸、比例带来的图片差异。
之后,终端对该缩略图进行灰度处理,得到该缩略图对应的灰度图。经过灰度处理后的灰度图,图中的每个像素只需一个字节存放灰度值,从而可以简化图片本身的信息,用于减少后续的计算量。
再后,终端可以根据灰度图中的各像素的灰度值,再结合预设算法,可以确定待签名图片的哈希值。
更具体地说,上述实施例中,终端根据待签名图片确定待签名图片的哈希值的方法,可以包括以下几种实现方式。
第一种:所述缩略图的尺寸为8x8,所述灰度图的灰度等级为64,则所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,具体可以包括一下步骤:
所述终端根据所述灰度图中各像素的灰度值,获取所述灰度图的灰度平均值;
所述终端根据所述灰度图中各像素的灰度值和所述灰度图的灰度平均值确定所述待签名图片的哈希值。
举例来说,缩略图的像素值=[
247,245,250,253,251,244,240,240,
247,253,228,208,213,243,247,241,
252,226,97,80,88,116,231,247,
255,172,79,65,51,58,191,255,
255,168,71,60,53,69,205,255,
255,211,65,58,56,104,244,252,
248,253,119,42,53,181,252,243,
244,240,218,175,185,230,242,244]
转化后的灰度图的灰度值=[
49,49,50,51,50,49,48,48,
49,51,46,42,43,49,49,48,
50,45,19,16,18,23,46,49,
51,34,16,13,10,12,38,51,
51,34,14,12,11,14,41,51,
51,42,13,12,11,21,49,50,
50,51,24,8,10,36,50,49,
49,48,44,35,37,46,48,49]
因此,计算得到的平均值=37。
得到这个平均值之后,再和每个像素对比。像素值大于平均值的标记成1,小于或等于平均值的标记成0。组成64个数字的字符串。
可以得到结果=[
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,0,0,0,0,1,1,
1,0,0,0,0,0,1,1,
1,0,0,0,0,0,1,1,
1,1,0,0,0,0,1,1,
1,1,0,0,0,0,1,1,
1,1,1,0,0,1,1,1]
64位字符串(即哈希值)='1111111111111111110000111000001110000011110000111100001111100111'。
第二种:所述缩略图的尺寸为32x32,所述灰度图的灰度等级为64,则所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,具体可以包括一下步骤:
所述终端对所述灰度图进行离散余弦变换处理,得到第一矩阵和第二矩阵;其中, 所述第一矩阵的尺寸为32x32,所述第二矩阵的尺寸为8x8,所述第二矩阵位于所述第一矩阵内的左上角;
所述终端根据所述第二矩阵中各像素的频率值,获取所述第二矩阵的频率平均值;
所述终端根据所述第二矩阵中各像素的频率值和所述第二矩阵的频率平均值确定所述待签名图片的哈希值。
不难发现,该方式与第一种方式相比,主要区别在于,本方式对灰度图进行离散余弦变换处理,简单来说,通过离散余弦变换处理可以对图片进行低频提取。离散余弦变换是种图像压缩算法,它将图像从像素域变换到频率域。通过离散余弦变换得到的第一矩阵,其从左上角依次到右下角,频率越来越高,故而左上角的值比较大,到右下角的值就较小。换句话说,图像的能量几乎都集中在左上角这个地方的低频系数上,因此,获取的第二矩阵能呈现图片的最低频率。该种可以容忍变形率在25%左右,只要图片的整体结构保持不变,哈希值的计算结果就不会改变,能够避免伽马校正或颜色直方图被调整带来的影响。
第三种:所述缩略图的尺寸为9x8,所述灰度图的灰度等级为64;
则所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,具体可以包括一下步骤:
所述终端根据所述灰度图获取所述灰度图中每行内相邻像素的差异值;
所述终端根据每行内相邻像素的差异值,获取差异值矩阵,所述差异值矩阵为8x8矩阵;
所述终端根据所述差异值矩阵确定所述待签名图片的哈希值。
可选地,差异值是每行右边的像素与左边的像素作比较得到的,并且第二行的第一个像素不会与第一行的任何像素比较。
举例来说,缩略图9x8的结构中,每行9个像素之间产生了8个不同的差异,一共8行,则产生了64个差异值,从而可获得8x8的差异值矩阵,与第一种方式近似的,通过判断差异值是否大于0,将其转化为字符串,例如,差异值大于0,则记录为1,否则为0,通过这64个差异值可以得到64位字符串,该字符串即为哈希值。该种方式具有更高的获取效率。
图3为本发明一实施例中的终端的结构示意图。如图3所示,该终端40包括:
获取模块,用于获取待签名图片、用户密钥以及用户身份信息;
确定模块,用于根据所述待签名图片确定所述待签名图片的哈希值;
生成模块,用于根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名。
可选地,所述确定模块,具体用于获取所述待签名图片的缩略图;
所述确定模块,还具体用于对所述缩略图进行灰度处理,得到所述缩略图对应的灰度图;
所述确定模块,还具体用于根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值。
可选地,所述生成模块,具体用于根据所述待签名图片的哈希值和所述用户身份信息生成摘要信息;
所述生成模块,还具体用于通过所述用户密钥对所述摘要信息进行加密,生成所述数字签名。
可选地,所述缩略图的尺寸为8x8,所述灰度图的灰度等级为64;
所述确定模块,还具体用于根据所述灰度图中各像素的灰度值,获取所述灰度图的灰度平均值;
所述确定模块,还具体用于根据所述灰度图中各像素的灰度值和所述灰度图的灰度平均值确定所述待签名图片的哈希值。
可选地,所述缩略图的尺寸为32x32,所述灰度图的灰度等级为64;
所述确定模块,还具体用于对所述灰度图进行离散余弦变换处理,得到第一矩阵和第二矩阵;其中,所述第一矩阵的尺寸为32x32,所述第二矩阵的尺寸为8x8,所述第二矩阵位于所述第一矩阵内的左上角;
所述确定模块,还具体用于根据所述第二矩阵中各像素的频率值,获取所述第二矩阵的频率平均值;
所述确定模块,还具体用于根据所述第二矩阵中各像素的频率值和所述第二矩阵的频率平均值确定所述待签名图片的哈希值。
可选地,所述缩略图的尺寸为9x8,所述灰度图的灰度等级为64;
所述确定模块,还具体用于根据所述灰度图获取所述灰度图中每行内相邻像素的差异值;
所述确定模块,还具体用于根据每行内相邻像素的差异值,获取差异值矩阵,所述差异值矩阵为8x8矩阵;
所述确定模块,还具体用于根据所述差异值矩阵确定所述待签名图片的哈希值。
可选地,所述获取模块,还具体用于读取用户身份识别卡中的用户身份标识;
所述获取模块,还具体用于根据所述用户身份标识生成用户身份信息。
图4为本发明一实施例中的终端的框图,该终端可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。
终端500可以包括以下一个或多个组件:处理组件502,存储器504,电源组件506,多媒体组件508,音频组件510,输入/输出(I/O)接口512,传感器组件514,以及通信组件516。
处理组件502通常控制终端500的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件502可以包括一个或多个处理器520来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件502可以包括一个或多个模块,便于处理组件502和其他组件之间的交互。例如,处理组件502可以包括多媒体模块,以方便多媒体组件508和处理组件502之间的交互。
存储器504被配置为存储各种类型的数据以支持在终端500的操作。这些数据的示例包括用于在终端500上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器504可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
电源组件506为终端500的各种组件提供电力。电源组件506可以包括电源管理系统,一个或多个电源,及其他与为终端500生成、管理和分配电力相关联的组件。
多媒体组件508包括在所述终端500和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件508包括一个前置摄像头和/或后置摄像头。当终端500处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。
音频组件510被配置为输出和/或输入音频信号。例如,音频组件510包括一个麦克风(MIC),当终端500处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器504或经由通信组件516发送。在一些实施例中,音频组件510还包括一个扬声器,用于输出音频信号。
I/O接口512为处理组件502和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。
传感器组件514包括一个或多个传感器,用于为终端500提供各个方面的状态评估。例如,传感器组件514可以检测到终端500的打开/关闭状态,组件的相对定位,例如所述组件为终端500的显示器和小键盘,传感器组件514还可以检测终端500或终端500一个组件的位置改变,用户与终端500接触的存在或不存在,终端500方位或加速/减速和终端500的温度变化。传感器组件514可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件514还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件514还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。
通信组件516被配置为便于终端500和其他设备之间有线或无线方式的通信。终端500可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个实施例中,通信组件516经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个实施例中,所述通信组件516还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
在实施例中,终端500可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。
在实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器504,上述指令可由终端500的处理器520执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁 带、软盘和光数据存储设备等。
一种存储介质,包括:可读存储介质和计算机程序,所述计算机程序用于实现上述实施例中的对图片进行数字签名的方法。
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其它实施方案。本发明旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求书指出。
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求书来限制。

Claims (10)

  1. 一种对图片进行数字签名的方法,其特征在于,包括:
    终端获取待签名图片、用户密钥以及用户身份信息;
    所述终端根据所述待签名图片确定所述待签名图片的哈希值;
    所述终端根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名。
  2. 根据权利要求1所述的方法,其特征在于,所述终端根据所述待签名图片确定所述待签名图片的哈希值,包括:
    所述终端获取所述待签名图片的缩略图;
    所述终端对所述缩略图进行灰度处理,得到所述缩略图对应的灰度图;
    所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值。
  3. 根据权利要求2所述的方法,其特征在于,所述缩略图的尺寸为8x8,所述灰度图的灰度等级为64,所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,包括:
    所述终端根据所述灰度图中各像素的灰度值,获取所述灰度图的灰度平均值;
    所述终端根据所述灰度图中各像素的灰度值和所述灰度图的灰度平均值确定所述待签名图片的哈希值。
  4. 根据权利要求2所述的方法,其特征在于,所述缩略图的尺寸为32x32,所述灰度图的灰度等级为64,所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,包括:
    所述终端对所述灰度图进行离散余弦变换处理,得到第一矩阵和第二矩阵;其中,所述第一矩阵的尺寸为32x32,所述第二矩阵的尺寸为8x8,所述第二矩阵位于所述第一矩阵内的左上角;
    所述终端根据所述第二矩阵中各频率值,获取所述第二矩阵的频率平均值;
    所述终端根据所述第二矩阵中各频率值和所述第二矩阵的频率平均值确定所述待签名图片的哈希值。
  5. 根据权利要求2所述的方法,其特征在于,所述缩略图的尺寸为9x8,所述灰度图的灰度等级为64;
    所述终端根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值,包括:
    所述终端根据所述灰度图获取所述灰度图中每行内相邻像素的差异值;
    所述终端根据每行内相邻像素的差异值,获取差异值矩阵,所述差异值矩阵为8x8矩阵;
    所述终端根据所述差异值矩阵确定所述待签名图片的哈希值。
  6. 根据权利要求1所述的方法,其特征在于,所述终端根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名,包括:
    所述终端根据所述待签名图片的哈希值和所述用户身份信息生成摘要信息;
    所述终端通过所述用户密钥对所述摘要信息进行加密,生成所述数字签名。
  7. 根据权利要求1所述的方法,其特征在于,所述终端获取用户身份信息,包括:
    所述终端读取用户身份识别卡中的用户身份标识;
    所述终端根据所述用户身份标识生成用户身份信息。
  8. 一种对图片进行数字签名的终端,其特征在于,包括:
    获取模块,用于获取待签名图片、用户密钥以及用户身份信息;
    确定模块,用于根据所述待签名图片确定所述待签名图片的哈希值;
    生成模块,用于根据所述待签名图片的哈希值、所述用户密钥和所述用户身份信息生成数字签名。
  9. 根据权利要求8所述的终端,其特征在于,
    所述确定模块,具体用于获取所述待签名图片的缩略图;
    所述确定模块,还具体用于对所述缩略图进行灰度处理,得到所述缩略图对应的灰度图;
    所述确定模块,还具体用于根据所述灰度图中的各像素的灰度值,确定所述待签名图片的哈希值。
  10. 根据权利要求8所述的终端,其特征在于,
    所述生成模块,具体用于根据所述待签名图片的哈希值和所述用户身份信息生成摘要信息;
    所述生成模块,还具体用于通过所述用户密钥对所述摘要信息进行加密,生成所述数字签名。
PCT/CN2017/104065 2017-09-28 2017-09-28 对图片进行数字签名的方法及终端 WO2019061185A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/104065 WO2019061185A1 (zh) 2017-09-28 2017-09-28 对图片进行数字签名的方法及终端

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/104065 WO2019061185A1 (zh) 2017-09-28 2017-09-28 对图片进行数字签名的方法及终端

Publications (1)

Publication Number Publication Date
WO2019061185A1 true WO2019061185A1 (zh) 2019-04-04

Family

ID=65900199

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/104065 WO2019061185A1 (zh) 2017-09-28 2017-09-28 对图片进行数字签名的方法及终端

Country Status (1)

Country Link
WO (1) WO2019061185A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579812A (zh) * 2020-12-18 2021-03-30 中国平安财产保险股份有限公司 检索图片的方法、装置和计算机设备
CN116071164A (zh) * 2023-04-06 2023-05-05 江苏金寓信息科技有限公司 一种基于区块链管理的数字资产溯源方法
CN116485623A (zh) * 2023-06-21 2023-07-25 齐鲁工业大学(山东省科学院) 基于十六元数快速精确矩的多光谱图像灰度特征水印方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006050535A (ja) * 2004-07-07 2006-02-16 Ricoh Co Ltd スキャナ装置、情報処理装置、画像データ暗号化方法、画像データ表示方法、画像データ暗号化プログラム及び画像データ表示プログラム
CN101359989A (zh) * 2008-09-03 2009-02-04 深圳华为通信技术有限公司 生成安全数字照片的方法、装置及移动通信终端
CN101562681A (zh) * 2009-05-26 2009-10-21 西南交通大学 基于状态参数的含水印数字照片的生成方法
CN104618107A (zh) * 2014-12-29 2015-05-13 广东信鉴信息科技有限公司 数字签名方法和系统
CN104933342A (zh) * 2015-06-18 2015-09-23 广东欧珀移动通信有限公司 一种图片查看方法及移动终端

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006050535A (ja) * 2004-07-07 2006-02-16 Ricoh Co Ltd スキャナ装置、情報処理装置、画像データ暗号化方法、画像データ表示方法、画像データ暗号化プログラム及び画像データ表示プログラム
CN101359989A (zh) * 2008-09-03 2009-02-04 深圳华为通信技术有限公司 生成安全数字照片的方法、装置及移动通信终端
CN101562681A (zh) * 2009-05-26 2009-10-21 西南交通大学 基于状态参数的含水印数字照片的生成方法
CN104618107A (zh) * 2014-12-29 2015-05-13 广东信鉴信息科技有限公司 数字签名方法和系统
CN104933342A (zh) * 2015-06-18 2015-09-23 广东欧珀移动通信有限公司 一种图片查看方法及移动终端

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579812A (zh) * 2020-12-18 2021-03-30 中国平安财产保险股份有限公司 检索图片的方法、装置和计算机设备
CN112579812B (zh) * 2020-12-18 2023-06-20 中国平安财产保险股份有限公司 检索图片的方法、装置和计算机设备
CN116071164A (zh) * 2023-04-06 2023-05-05 江苏金寓信息科技有限公司 一种基于区块链管理的数字资产溯源方法
CN116485623A (zh) * 2023-06-21 2023-07-25 齐鲁工业大学(山东省科学院) 基于十六元数快速精确矩的多光谱图像灰度特征水印方法
CN116485623B (zh) * 2023-06-21 2023-09-01 齐鲁工业大学(山东省科学院) 基于十六元数快速精确矩的多光谱图像灰度特征水印方法

Similar Documents

Publication Publication Date Title
US20170032219A1 (en) Methods and devices for picture processing
CN105511949B (zh) 验证码的填充方法、装置和移动终端
WO2016192325A1 (zh) 视频文件的标识处理方法及装置
US20110179366A1 (en) Method and apparatus for privacy protection in mobile terminal
WO2017012269A1 (zh) 通过图像确定空间参数的方法、装置及终端设备
WO2019109563A1 (zh) 显示界面图像的方法和装置
WO2019080712A1 (zh) 视频水印生成方法、装置及终端
WO2017080055A1 (zh) 液晶显示方法及装置
US20210158577A1 (en) Method for Adding Special Effect to Video, Electronic Device and Storage Medium
WO2016026270A1 (zh) 传输图片的方法及装置
WO2017143776A1 (zh) 图片类型的识别方法及装置
KR20130072642A (ko) 휴대용 단말기에서 메시지의 첨부 파일을 관리하기 위한 장치 및 방법
WO2019061185A1 (zh) 对图片进行数字签名的方法及终端
US20130335594A1 (en) Enhancing captured data
CN110619610B (zh) 图像处理方法及装置
WO2022110835A1 (zh) 图片分享方法及装置
WO2019183984A1 (zh) 一种图像显示方法及终端
US20150009333A1 (en) Security device and display method thereof
CN104484867A (zh) 图片处理方法及装置
CN113923461A (zh) 一种录屏方法和录屏系统
CN110876014B (zh) 图像处理方法及装置、电子设备及存储介质
CN104536713B (zh) 显示图像中的字符的方法及装置
US20210335390A1 (en) Method and device for generating dynamic image
US20190042830A1 (en) Method, device and storage medium for processing picture
CN116668862B (zh) 图像处理方法与电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17926843

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17926843

Country of ref document: EP

Kind code of ref document: A1