CN110690968B - Image encryption method based on Montgomery-RSA algorithm - Google Patents

Image encryption method based on Montgomery-RSA algorithm Download PDF

Info

Publication number
CN110690968B
CN110690968B CN201910764980.5A CN201910764980A CN110690968B CN 110690968 B CN110690968 B CN 110690968B CN 201910764980 A CN201910764980 A CN 201910764980A CN 110690968 B CN110690968 B CN 110690968B
Authority
CN
China
Prior art keywords
image
montgomery
mapping table
rsa algorithm
algorithm
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
Application number
CN201910764980.5A
Other languages
Chinese (zh)
Other versions
CN110690968A (en
Inventor
刘珊珊
蒋文武
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong University of Technology
Original Assignee
Guangdong University of Technology
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 Guangdong University of Technology filed Critical Guangdong University of Technology
Priority to CN201910764980.5A priority Critical patent/CN110690968B/en
Publication of CN110690968A publication Critical patent/CN110690968A/en
Application granted granted Critical
Publication of CN110690968B publication Critical patent/CN110690968B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3006Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy underlying computational problems or public-key parameters
    • H04L9/302Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy underlying computational problems or public-key parameters involving the integer factorization problem, e.g. RSA or quadratic sieve [QS] schemes
    • 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/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • 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/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • H04L9/3006Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy underlying computational problems or public-key parameters
    • H04L9/3033Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy underlying computational problems or public-key parameters details relating to pseudo-prime or prime number generation, e.g. primality test
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/32Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
    • H04N1/32101Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
    • H04N1/32144Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
    • H04N1/32149Methods relating to embedding, encoding, decoding, detection or retrieval operations
    • H04N1/32267Methods relating to embedding, encoding, decoding, detection or retrieval operations combined with processing of the image
    • H04N1/32272Encryption or ciphering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/46Colour picture communication systems
    • H04N1/56Processing of colour picture signals

Abstract

The invention discloses an image encryption method based on Montgomery-RSA algorithm, which comprises the following steps: s1, inputting an image; s2: extracting RGB pixels from the images and creating a separate matrix for each image; s3: each image is divided into a plurality of image blocks, a mapping table is generated, and the size and the position of each block are recorded; s4: encrypting and decrypting each image block and the mapping table by utilizing a Montgomery-RSA algorithm; s5, outputting an image; the invention encrypts the image in blocks according to the RGB color band, thereby ensuring that the transmission of the confidential image has higher confidentiality; meanwhile, the RSA algorithm improved by Montgomery can effectively improve the speed of image data transmission.

Description

Image encryption method based on Montgomery-RSA algorithm
Technical Field
The invention relates to the technical field of information security, in particular to an image encryption method based on a Montgomery-RSA algorithm.
Background
At present, under an increasingly open network environment, people mainly utilize the internet to transmit digital images, and the internet brings convenience to people and also brings information security problems, so that the digital images must have higher security when being transmitted on unreliable communication channels.
Cryptographic encryption techniques of a long history are widely used for data security protection. The purpose of image encryption is to hide the real information of an image, so that an image stealing party cannot acquire an original image, and a receiving party can conveniently acquire encrypted information by a pre-agreed decryption method. Information encryption technology can provide secure communication in the presence of malicious adversaries, thereby ensuring confidentiality, integrity, and availability of information.
The encryption algorithm is the core of the cryptographic technology and mainly comprises a symmetric encryption algorithm and an asymmetric encryption algorithm: the symmetric encryption algorithm is mainly characterized in that the same secret key is used for encryption and decryption, and commonly used algorithms such as AES (advanced encryption standard), DES (data encryption standard) and the like are available; the symmetric encryption algorithm has small calculation amount and high encryption speed, but both the transmitting side and the receiving side have to keep and manage the secret key, and the excessive secret key brings certain burden to the management of the secret key and is not safe enough; the most common of the asymmetric encryption algorithms is the RSA algorithm, and the asymmetry mainly shows that different secret keys are used during encryption and decryption, the secret keys are divided into a public key and a private key, the public key is used for encrypting data, the private key is used for decrypting the encrypted data, the encryption and decryption speed is low, the asymmetric encryption algorithm is only suitable for encrypting and decrypting a small amount of data, and the security is higher than that of the symmetric encryption algorithm, but still has improved space.
In the big data era, data is growing explosively, and the volume of high-quality digital images is large, so that a rapid and safe image encryption method is needed.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide an image encryption method based on a Montgomery-RSA algorithm, which can improve the confidentiality when an image is transmitted from a sender to a target receiver and can transmit large-batch digital image data more safely.
The purpose of the invention is realized by the following technical scheme:
an image encryption method based on Montgomery-RSA algorithm comprises the following steps:
s1, inputting an image;
s2: extracting RGB pixels from the images, and creating a separate matrix for each image;
s3: each image is divided into a plurality of image blocks, a mapping table is generated, and the size and the position of each block are recorded;
s4: encrypting and decrypting each image block and the mapping table by utilizing a Montgomery-RSA algorithm;
s4.1, generating a key, assuming that user a sends an image m to user B, user B generates two large prime numbers p and q, user B calculates n ═ p × q, y (n) ═ p-1 (q-1), selects a random number e to satisfy (e, y (n) ═ 1, n and e are public keys, and a can be found through a public channel;
s4.2, carrying out encryption transformation m on the image mdmodn=c;
S4.3, encrypting the image m according to the mapping table;
s4.4, after user B receives ciphertext c, cdObtaining an image m by modn-m, wherein the private key d satisfies d-e mod Y (n) -1;
s4.5, decrypting the image m according to the mapping table;
s4.6, combining the image blocks according to the mapping table to restore the image;
and S5, outputting the image.
Preferably, in the calculation process of S4.2, the montgomery algorithm is used to simplify the calculation, and the processing process is as follows:
s4.2.1, let c equal to 1;
S4.2.2,IF e%2=0;
S4.2.3,m=m*m%n;
S4.2.4,e=e/2;
S4.2.5,ELSE c=c*m%n;
S4.2.6,e=e-1;
S4.2.7,return c。
preferably, in the calculation process of S4.4, the montgomery algorithm is used to simplify the calculation, and the processing process is as follows:
s4.4.1, making m equal to 1;
S4.4.2,IF d%2=0;
S4.4.3,c=c*c%n;
S4.4.4,d=d/2;
S4.4.5,ELSE m=m*c%n;
S4.4.6,d=d-1;
S4.4.7,return m。
compared with the prior art, the invention has the following beneficial effects:
the invention encrypts the image in blocks according to the RGB color band, thereby ensuring that the transmission of the confidential image has higher confidentiality; meanwhile, the RSA algorithm improved by Montgomery can effectively improve the speed of image data transmission.
Drawings
FIG. 1 is a schematic flow diagram of the present invention;
FIG. 2 is a diagram illustrating a processing procedure of Montgomery algorithm according to the present invention.
Detailed Description
The present invention will be described in further detail with reference to examples and drawings, but the present invention is not limited thereto.
The invention provides an image encryption method based on Montgomery-RSA algorithm, which comprises the steps of firstly extracting RGB color bands of pixel values from an image, and establishing a matrix for each color band by using the pixels; the image is then divided into a plurality of image blocks of the same size, which are encrypted and decrypted using the RSA algorithm using Montgomery.
Specifically, as shown in fig. 1 to 2, an image encryption method based on montgomery-RSA algorithm includes the following steps:
step one, inputting an image;
step two: extracting RGB pixels from the images and creating a separate matrix for each image;
step three: each image is divided into a plurality of image blocks, a mapping table is generated, and the size and the position of each block are recorded;
step four: encrypting and decrypting each image block and the mapping table by utilizing a Montgomery-RSA algorithm;
(1) generating a secret key, assuming that a user A sends an image m to a user B, the user B generates two large prime numbers p and q, the user B calculates n ═ p ═ q, Y (n) ═ p-1 (q-1), selects a random number e to satisfy (e, Y (n) ═ 1, n and e are public keys, and A can be found through a public channel;
(2) carrying out encryption transformation m on image mdmodn=c;
In the calculation process, the Montgomery algorithm is used for simplifying the calculation, and the processing process is as follows:
let c be 1;
IF e%2=0;
m=m*m%n;
e=e/2;
ELSE c=c*m%n;
e=e-1;
return c。
(3) encrypting the image m according to a mapping table;
(4) after user B receives ciphertext c, cdObtaining an image m by modn-m, wherein the private key d satisfies d-e mod Y (n) -1;
in the calculation process, the Montgomery algorithm is used for simplifying the calculation, and the processing process is as follows:
let m equal to 1;
IF d%2=0;
c=c*c%n;
d=d/2;
ELSE m=m*c%n;
d=d-1;
return m。
(5) decrypting the image m according to the mapping table;
(6) combining the image blocks according to the mapping table to restore the image;
and step five, outputting the image.
The invention extracts RGB color bands for the image to be transmitted, then processes each color band in a blocking way, generates a mapping table to record the size and the position of the image block, and then encrypts each image block and the mapping table respectively, thereby ensuring that the transmission of the confidential image has higher confidentiality.
The invention encrypts the image in blocks according to the RGB color band, thereby ensuring that the transmission of the confidential image has higher confidentiality; meanwhile, the RSA algorithm improved by Montgomery can effectively improve the speed of image data transmission.
The present invention is not limited to the above embodiments, and any other changes, modifications, substitutions, combinations, and simplifications which do not depart from the spirit and principle of the present invention should be construed as equivalents and are included in the scope of the present invention.

Claims (3)

1. An image encryption method based on Montgomery-RSA algorithm is characterized by comprising the following steps:
s1, inputting an image;
s2: extracting RGB pixels from the images and creating a separate matrix for each image;
s3: each image is divided into a plurality of image blocks, a mapping table is generated, and the size and the position of each block are recorded;
s4: encrypting and decrypting each image block and the mapping table by utilizing a Montgomery-RSA algorithm;
s4.1, generating a key, assuming that user a sends an image m to user B, user B generates two large prime numbers p and q, user B calculates n ═ p × q, y (n) ═ p-1 (q-1), selects a random number e to satisfy (e, y (n) ═ 1, n and e are public keys, and a can be found through a public channel;
s4.2, carrying out encryption transformation m on the image mdmodn=c;
S4.3, encrypting the image m according to the mapping table;
s4.4, after user B receives ciphertext c, cdObtaining an image m by modn-m, wherein the private key d satisfies d-e mod Y (n) -1;
s4.5, decrypting the image m according to the mapping table;
s4.6, combining the image blocks according to the mapping table to restore the image;
s5, outputting the image.
2. The image encryption method based on Montgomery-RSA algorithm of claim 1, wherein S4.2 uses Montgomery algorithm to simplify the calculation in the calculation process, which is as follows:
s4.2.1, let c equal to 1;
S4.2.2,IF e%2=0;
S4.2.3,m=m*m%n;
S4.2.4,e=e/2;
S4.2.5,ELSE c=c*m%n;
S4.2.6,e=e-1;
S4.2.7,return c。
3. the image encryption method based on Montgomery-RSA algorithm of claim 1, wherein S4.4 uses Montgomery algorithm to simplify the calculation in the calculation process, which is as follows:
s4.4.1, making m equal to 1;
S4.4.2,IF d%2=0;
S4.4.3,c=c*c%n;
S4.4.4,d=d/2;
S4.4.5,ELSE m=m*c%n;
S4.4.6,d=d-1;
S4.4.7,return m。
CN201910764980.5A 2019-08-19 2019-08-19 Image encryption method based on Montgomery-RSA algorithm Active CN110690968B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910764980.5A CN110690968B (en) 2019-08-19 2019-08-19 Image encryption method based on Montgomery-RSA algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910764980.5A CN110690968B (en) 2019-08-19 2019-08-19 Image encryption method based on Montgomery-RSA algorithm

Publications (2)

Publication Number Publication Date
CN110690968A CN110690968A (en) 2020-01-14
CN110690968B true CN110690968B (en) 2022-07-01

Family

ID=69108386

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910764980.5A Active CN110690968B (en) 2019-08-19 2019-08-19 Image encryption method based on Montgomery-RSA algorithm

Country Status (1)

Country Link
CN (1) CN110690968B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0656709A2 (en) * 1993-11-30 1995-06-07 Canon Kabushiki Kaisha Encryption device and apparatus for encryption/decryption based on the Montgomery method using efficient modular multiplication
CN1525307A (en) * 2003-02-26 2004-09-01 上海华园微电子技术有限公司 Modulus multiply operation circuit and encrypt method of applying said modulus multiply operation circuit
CN104680474A (en) * 2015-02-04 2015-06-03 四川长虹电器股份有限公司 Digital image encryption and decryption method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101610917B1 (en) * 2010-03-08 2016-04-11 삼성전자주식회사 Decryption method of crypto algorithm and crypto system having its
US10491401B2 (en) * 2017-02-21 2019-11-26 Google Llc Verification of code signature with flexible constraints

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0656709A2 (en) * 1993-11-30 1995-06-07 Canon Kabushiki Kaisha Encryption device and apparatus for encryption/decryption based on the Montgomery method using efficient modular multiplication
CN1525307A (en) * 2003-02-26 2004-09-01 上海华园微电子技术有限公司 Modulus multiply operation circuit and encrypt method of applying said modulus multiply operation circuit
CN104680474A (en) * 2015-02-04 2015-06-03 四川长虹电器股份有限公司 Digital image encryption and decryption method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Efficient software implementation of RNS-montgomery modular multiplication for embedded system;Chiraz Massoud 等;《2016 International Image Processing, Applications and Systems (IPAS)》;20170320;全文 *
基于FPGA的非对称加密算法及高速PCB实现方案研究;朱青仑;《中国优秀硕士学位论文全文数据库 信息科技辑》;20140115;全文 *

Also Published As

Publication number Publication date
CN110690968A (en) 2020-01-14

Similar Documents

Publication Publication Date Title
US10785019B2 (en) Data transmission method and apparatus
Shiu et al. Encrypted image-based reversible data hiding with public key cryptography from difference expansion
US8155311B2 (en) Method and apparatus for encrypting message for maintaining message integrity, and method and apparatus for decrypting message for maintaining message integrity
Puech et al. A new crypto-watermarking method for medical images safe transfer
Phad Vitthal et al. A novel security scheme for secret data using cryptography and steganography
CN109005027B (en) Random data encryption and decryption method, device and system
CN110932851A (en) PKI-based multi-party cooperative operation key protection method
Abusukhon et al. A novel network security algorithm based on private key encryption
CN107534558B (en) Method for protecting the information security of data transmitted via a data bus and data bus system
CN108810022A (en) A kind of encryption method, decryption method and device
CN102014266A (en) Digital watermarking-based high-definition video encrypted transmitting method and system
CN113726725A (en) Data encryption and decryption method and device, electronic equipment and storage medium
Abusukhon et al. Secure network communication based on text-to-image encryption
Hazra et al. A hybrid cryptosystem of image and text files using blowfish and Diffie-Hellman techniques
Kaur et al. A random selective block encryption technique for secure image cryptography using blowfish algorithm
CN107124616B (en) Method for realizing exchange of cipher watermarks in same operation domain based on homomorphic characteristics
KR101991775B1 (en) Method for data encryption and decryption based on fpga
Hashim et al. Medical image encryption based on hybrid AES with chaotic map
Bangera et al. Multilayer security using RSA cryptography and dual audio steganography
Mehndiratta Data hiding system using cryptography & steganography: a comprehensive modern investigation
WO2012139427A1 (en) Media message processing method, system and device
CN110690968B (en) Image encryption method based on Montgomery-RSA algorithm
CN111541652B (en) System for improving security of secret information keeping and transmission
KR100388059B1 (en) Data encryption system and its method using asymmetric key encryption algorithm
Ariyanto et al. Performance Analysis of LSB Image Steganography Combined with Blowfish-RC4 Encryption in Various File Extensions

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