WO2022247639A1 - 保存密文的方法和装置 - Google Patents

保存密文的方法和装置 Download PDF

Info

Publication number
WO2022247639A1
WO2022247639A1 PCT/CN2022/092296 CN2022092296W WO2022247639A1 WO 2022247639 A1 WO2022247639 A1 WO 2022247639A1 CN 2022092296 W CN2022092296 W CN 2022092296W WO 2022247639 A1 WO2022247639 A1 WO 2022247639A1
Authority
WO
WIPO (PCT)
Prior art keywords
ciphertext
key
partition
erasable
account
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.)
Ceased
Application number
PCT/CN2022/092296
Other languages
English (en)
French (fr)
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.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to EP22810366.9A priority Critical patent/EP4152198B1/en
Priority to US18/003,265 priority patent/US12526137B2/en
Publication of WO2022247639A1 publication Critical patent/WO2022247639A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • H—ELECTRICITY
    • H04—ELECTRIC COMMUNICATION TECHNIQUE
    • H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/78—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/78—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data
    • G06F21/79—Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data in semiconductor storage media, e.g. directly-addressable memories
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60—Protecting data
    • G06F21/602—Providing cryptographic facilities or services
    • G—PHYSICS
    • G06—COMPUTING OR CALCULATING; COUNTING
    • G06F—ELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60—Protecting data
    • G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6209—Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself

Definitions

  • the present application relates to the field of terminals, in particular to a method and device for storing ciphertext.
  • An external memory such as a secure digital (SD) card
  • SD secure digital
  • the key of the external memory is encrypted by the lock screen password and stored in the erasable partition of the electronic device.
  • the encrypted key in the erasable partition ie , ciphertext
  • the encrypted key in the erasable partition will be deleted before being saved in time, so that the data in the external memory cannot be decrypted.
  • the present application provides a method and device for storing ciphertext, which can solve the problem that the data in the external memory cannot be decrypted after the electronic device is reset at the factory level.
  • a method for storing ciphertext including: obtaining an encryption instruction indicating to encrypt a file in an external memory; obtaining a characteristic value of a first account ID according to the encryption instruction; using the The characteristic value of the first account identifier encrypts the first key to generate the first ciphertext, wherein the first key is used to encrypt the second key, and the second key is used to encrypt the the first file; encrypting the feature value of the first account ID to generate a second ciphertext; storing the first ciphertext and the second ciphertext in a non-erasable partition.
  • the encryption instruction is an instruction triggered when the user encrypts the external memory on the encryption setting interface. After the electronic device obtains the encryption instruction, it generates the first ciphertext and the second ciphertext, and stores the first ciphertext and the second ciphertext in the electronic device.
  • the electronic device before the user performs a factory-level reset on the electronic device, the electronic device has completed the safe storage of the first ciphertext and the second ciphertext; after the electronic device completes the factory-level reset, it can be accessed from The non-erasable partition restores the first key, and then uses the first key to decrypt the second key in the external storage, and uses the second key to decrypt the files in the external storage, thus solving the problem of external storage after factory reset.
  • the problem that the files in the device storage cannot be decrypted.
  • the method further includes: obtaining instruction information for switching accounts; verifying the first account ID according to the instruction information; after the verification of the first account ID is passed, obtaining the characteristic value of the second account ID ; Updating the first ciphertext and the second ciphertext according to the characteristic value of the second account identifier.
  • the user can switch the currently logged-in account identifier (for example, the first account identifier) on the account login interface.
  • the electronic device can require the user to enter the password corresponding to the first account identifier. , to verify the first account ID.
  • the electronic device can obtain the second account ID input by the user, and calculate the hash value of the second account ID (an example of a characteristic value), and then The first ciphertext and the second ciphertext are updated using the hash value identified by the second account, wherein the electronic device can first decrypt the first key, and then use the hash value identified by the second account to generate an updated The first ciphertext, and then encrypt the hash value of the second account ID to generate an updated second ciphertext.
  • the electronic device can first decrypt the first key, and then use the hash value identified by the second account to generate an updated The first ciphertext, and then encrypt the hash value of the second account ID to generate an updated second ciphertext.
  • the first ciphertext and the second ciphertext are updated using the current user's account ID (second account ID), and the encryption corresponding to the first account ID is released. And the authority to decrypt the external memory, thus ensuring the security of the data in the external memory.
  • the method further includes: after the factory reset is completed, verifying the first account ID; when the verification of the first account ID succeeds, decrypting the first ciphertext and the second Two ciphertexts to generate the first key.
  • the account verification mechanism After the electronic device is reset at the factory level, the account verification mechanism will be activated. This mechanism requires that the electronic device can be used normally only after the account verification is successful. Verifying the last logged-in account ID (for example, the first account ID) before the factory-level reset can ensure that the user after the electronic device performs the factory-level reset is a legitimate user, thereby ensuring the security of data in the external memory.
  • the verifying the first account ID includes:
  • the method further includes: encrypting the first key with a default value to generate a third ciphertext; encrypting the default value to generate a fourth ciphertext; combining the third ciphertext and the first ciphertext Four ciphertexts are stored in the non-erasable partition.
  • the electronic device can use the default value after decrypting the first key. Encryption saves the first key, thereby ensuring the security of data in the external memory.
  • the method further includes: copying the third ciphertext and the fourth ciphertext from the non-erasable partition to an erasable partition;
  • the third ciphertext and the fourth ciphertext generate the first key; decrypt the encrypted first file in the external memory according to the first key.
  • the method before verifying the first account ID, further includes: acquiring a factory-level reset command triggered by a recovery interface; formatting data in the erasable partition according to the factory-level reset command .
  • the encrypting the first key by using the feature value identified by the first account includes: calling the key management module keymaster TA to perform: encrypting the first key by using the feature value identified by the first account
  • the encrypting the feature value of the first account ID includes: calling the keymaster TA to perform: encrypting the feature value of the first account ID.
  • the storing the first ciphertext and the second ciphertext in the non-erasable partition includes: calling a trusted execution environment application program interface to execute: storing the first ciphertext and the second ciphertext The second ciphertext is stored in the non-erasable partition.
  • the first key is also used to encrypt a third key
  • the third key is used to encrypt the encrypted second file in the external memory.
  • the method further includes: acquiring a feature value of the lock screen password according to the encryption instruction; encrypting the first key by using the feature value of the lock screen password to generate a fifth ciphertext; encrypting the lock screen password
  • the feature value of the screen password is used to generate a sixth ciphertext; and the fifth ciphertext and the sixth ciphertext are stored in an erasable partition.
  • the encrypting the first key using the feature value of the lock screen password includes: calling keymaster TA to execute: encrypting the first key using the feature value of the lock screen password;
  • the feature value of the lock screen password includes: calling the keymaster TA to execute: encrypting the feature value of the lock screen password.
  • the method further includes: acquiring a user-level reset instruction triggered by a setting interface; backing up the fifth ciphertext and the sixth ciphertext to the non-erasable partition.
  • the backing up the fifth ciphertext and the sixth ciphertext to the non-erasable partition according to the user-level reset instruction includes: according to the user-level reset instruction, from the decrypting the first key from the fifth ciphertext and the sixth ciphertext; encrypting the first key with a default value to generate a seventh ciphertext; encrypting the default value to generate an eighth ciphertext;
  • the seventh ciphertext and the eighth ciphertext are stored in the non-erasable partition.
  • the method further includes: after the user-level reset is completed, copying the seventh ciphertext and the eighth ciphertext from the non-erasable partition to the erasable partition; Decrypt the first key from the seventh ciphertext and the eighth ciphertext in the erasable partition; decrypt the encrypted first file in the external memory according to the first key .
  • the erasable partition is a data partition
  • the feature value of the lock screen password is a hash value of the lock screen password
  • the non-erasable partition is a sec_storage partition
  • the characteristic value of the first account identifier is a hash value of the first account identifier
  • another method for storing ciphertext including: displaying an encryption setting interface of an external memory; receiving a first operation performed by a user on the encryption setting interface; responding to the first operation , encrypting the files in the external memory; receiving the user’s second operation; in response to the second operation, displaying the factory-level reset setting interface; receiving the user’s operation on the factory-level reset setting interface
  • the third operation in response to the third operation, perform a factory-level reset; display the account verification interface; receive the verification information input by the user on the account verification interface; when the verification information is verified When passing through, and when receiving the operation of accessing the files in the external storage by the user, the encrypted files in the external storage are decrypted.
  • the encryption instruction is an instruction triggered when the user encrypts the external memory on the encryption setting interface. After the electronic device obtains the encryption instruction, it generates the first ciphertext and the second ciphertext, and stores the first ciphertext and the second ciphertext in the electronic device.
  • the electronic device Before the user implements factory-level reset on the electronic device, the electronic device has completed the safe storage of the first ciphertext and the second ciphertext; after the electronic device completes the factory-level reset, it can Recover the first key from the non-erasable partition, then use the first key to decrypt the second key in the external storage, and use the second key to decrypt the files in the external storage, thus solving the problem after factory reset The problem that the files in the external storage cannot be decrypted.
  • a device for storing ciphertext including a unit for executing any method in the first aspect or the second aspect.
  • the device may be a terminal device, or a chip in the terminal device.
  • the device may comprise an input unit and a processing unit.
  • the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory, which is used to store computer program codes, and when the processor executes the When the computer program code is used, the terminal device is made to execute any method in the first aspect or the second aspect.
  • the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin or a circuit, etc.; the chip may also include a memory, and the memory may be a memory (for example, registers, cache, etc.), can also be located outside the chip memory (for example, read-only memory, random access memory, etc.); the memory is used to store computer program code, when the processor executes the memory The stored computer program code causes the chip to execute any method in the first aspect or the second aspect.
  • a computer-readable storage medium stores computer program code, and when the computer program code is run by a device storing ciphertext, the device executes the first aspect or Either method of the second aspect.
  • Fig. 1 is a schematic diagram of a hardware system applicable to the device of the present application
  • Fig. 2 is a schematic diagram of a software system applicable to the device of the present application
  • Fig. 4 is a schematic diagram of an encryption confirmation interface provided by the present application.
  • Fig. 6 is a schematic diagram of a method for storing keys provided by the present application.
  • FIG. 7 is a schematic diagram of an encryption process provided by the present application.
  • FIG. 8 is a schematic diagram of a method for backing up and restoring keys in a user-level reset scenario provided by the present application
  • FIG. 10 is a schematic diagram of a method for backing up keys in a factory-level reset scenario provided by the present application.
  • FIG. 11 is a schematic diagram of an account login interface provided by this application.
  • FIG. 15 is a schematic diagram of a factory-level reset process interface provided by the present application.
  • FIG. 16 is a schematic diagram of a method for recovering keys in a factory-level reset scenario provided by the present application.
  • FIG. 18 is a schematic diagram of changes in ciphertext storage in a storage area in a factory-level reset scenario provided by the present application.
  • the device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and user An identification module (subscriber identification module, SIM) card interface 195 and the like.
  • SIM subscriber identification module
  • Processor 110 may include one or more processing units.
  • the processor 110 may include at least one of the following processing units: an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor) , ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, neural network processor (neural-network processing unit, NPU).
  • an application processor application processor, AP
  • modem processor graphics processing unit
  • graphics processing unit graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is a cache memory.
  • the memory may hold instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated access is avoided, and the waiting time of the processor 110 is reduced, thus improving the efficiency of the system.
  • processor 110 may include one or more interfaces.
  • the processor 110 may include at least one of the following interfaces: an inter-integrated circuit (inter-integrated circuit, I2C) interface, an inter-integrated circuit sound (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, SIM interface, USB interface.
  • I2C inter-integrated circuit
  • I2S inter-integrated circuit sound
  • PCM pulse code modulation
  • UART universal asynchronous receiver/transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal interface or as a data signal interface.
  • the GPIO interface can be used to connect the processor 110 with the camera 193 , the display screen 194 , the wireless communication module 160 , the audio module 170 and the sensor module 180 .
  • the GPIO interface can also be configured as an I2C interface, I2S interface, UART interface or MIPI interface.
  • the USB interface 130 is an interface conforming to the USB standard specification, for example, it can be a mini (Mini) USB interface, a micro (Micro) USB interface or a C-type USB (USB Type C) interface.
  • the USB interface 130 can be used to connect a charger to charge the device 100 , can also be used to transmit data between the device 100 and peripheral devices, and can also be used to connect an earphone to play audio through the earphone.
  • the USB interface 130 can also be used to connect other devices 100, such as AR equipment.
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives the input from the battery 142 and/or the charging management module 140 to provide power for the processor 110 , the internal memory 121 , the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, and battery health status (eg, leakage, impedance).
  • the power management module 141 may be set in the processor 110, or the power management module 141 and the charge management module 140 may be set in the same device.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in device 100 may be used to cover single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna may be used in conjunction with a tuning switch.
  • the wireless communication module 160 can also provide a wireless communication solution applied to the device 100, such as at least one of the following solutions: wireless local area networks (wireless local area networks, WLAN), bluetooth (bluetooth, BT) , Bluetooth low energy (bluetooth low energy, BLE), ultra wide band (ultra wide band, UWB), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication (near field communication) communication, NFC), infrared (infrared, IR) technology.
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the GNSS may include at least one of the following positioning technologies: global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou satellite navigation system (beidou navigation satellite system, BDS), Quasi-zenith satellite system (QZSS), satellite based augmentation systems (SBAS).
  • global positioning system global positioning system
  • GLONASS global navigation satellite system
  • Beidou satellite navigation system beidou navigation satellite system, BDS
  • QZSS Quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the ISP is used for processing the data fed back by the camera 193 .
  • the light is transmitted to the photosensitive element of the camera through the lens, and the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can optimize the algorithm of image noise, brightness and color, and ISP can also optimize parameters such as exposure and color temperature of the shooting scene.
  • the ISP may be located in the camera 193 .
  • the internal memory 121 may be used to store computer-executable program codes including instructions.
  • the internal memory 121 may include an area for storing programs and an area for storing data.
  • the storage program area can store an operating system and an application program required by at least one function (for example, a sound playing function and an image playing function).
  • the data storage area can store data created during use of the device 100 (for example, audio data and phonebook).
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, for example: at least one magnetic disk storage device, flash memory device, and universal flash storage (universal flash storage, UFS), etc.
  • the processor 110 executes various processing methods of the device 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
  • Speaker 170A also known as a horn, is used to convert audio electrical signals into sound signals.
  • Device 100 may listen to music or make hands-free calls through speaker 170A.
  • Receiver 170B also known as an earpiece, is used to convert audio electrical signals into audio signals.
  • the user uses the device 100 to answer calls or voice messages, he can listen to the voice by putting the receiver 170B close to the ear.
  • Microphone 170C also known as microphone or microphone, is used to convert sound signals into electrical signals. When the user makes a call or sends a voice message, a sound signal may be input into the microphone 170C by uttering a sound close to the microphone 170C.
  • the device 100 may be provided with at least one microphone 170C. In other embodiments, the device 100 may be provided with two microphones 170C to implement the noise reduction function. In some other embodiments, the device 100 may also be provided with three, four or more microphones 170C to realize functions such as identifying sound sources and directional recording.
  • the processor 110 can process the electrical signal output by the microphone 170C. For example, the audio module 170 and the wireless communication module 160 can be coupled through a PCM interface. The electrical signal is transmitted to the processor 110; the processor 110 performs volume analysis and frequency analysis on the electrical signal to determine the volume and frequency of the ambient sound.
  • the earphone interface 170D is used for connecting wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense the pressure signal and convert the pressure signal into an electrical signal.
  • pressure sensor 180A may be disposed on display screen 194 .
  • pressure sensor 180A may be a resistive pressure sensor, an inductive pressure sensor or a capacitive pressure sensor.
  • the capacitive pressure sensor may include at least two parallel plates with conductive materials.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when the touch operation whose touch operation intensity is less than the first pressure threshold acts on the short message application icon, execute the instruction of viewing the short message; when the touch operation whose touch operation intensity is greater than or equal to the first pressure threshold acts on the short message application icon , to execute the instruction of creating a new short message.
  • the magnetic sensor 180D includes a Hall sensor.
  • Device 100 may utilize magnetic sensor 180D to detect opening and closing of the flip holster.
  • the device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D.
  • the device 100 can set features such as automatic unlocking of the flip cover according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover.
  • the acceleration sensor 180E can detect the acceleration of the device 100 in various directions (generally x-axis, y-axis and z-axis). The magnitude and direction of gravity can be detected when the device 100 is stationary. The acceleration sensor 180E can also be used to recognize the posture of the device 100 as an input parameter for application programs such as landscape and portrait screen switching and pedometer.
  • the distance sensor 180F is used to measure distance.
  • the device 100 can measure the distance by infrared or laser. In some embodiments, for example, in a shooting scene, the device 100 can use the distance sensor 180F for distance measurement to achieve fast focusing.
  • the proximity light sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode.
  • the LEDs may be infrared LEDs.
  • the device 100 emits infrared light through the LED.
  • Device 100 uses photodiodes to detect infrared reflected light from nearby objects. When the reflected light is detected, the device 100 may determine that there is an object nearby. When no reflected light is detected, the device 100 may determine that there is no object nearby.
  • the device 100 can use the proximity light sensor 180G to detect whether the user is holding the device 100 close to the ear to make a call, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used for automatic unlocking and automatic screen locking in leather case mode or pocket mode.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the device 100 can use the characteristics of the collected fingerprints to implement functions such as unlocking, accessing application locks, taking pictures, and answering incoming calls.
  • the temperature sensor 180J is used to detect temperature.
  • the device 100 implements a temperature treatment strategy using the temperature detected by the temperature sensor 180J. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the device 100 may reduce the performance of a processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection.
  • the device 100 when the temperature is lower than another threshold, the device 100 heats the battery 142 to avoid abnormal shutdown of the device 100 due to low temperature.
  • the device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • the touch sensor 180K is also referred to as a touch device.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a touch screen.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor 180K may transmit the detected touch operation to the application processor to determine the touch event type.
  • Visual output related to the touch operation can be provided through the display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the device 100 and disposed at a different position from the display screen 194 .
  • Keys 190 include a power key and a volume key.
  • the key 190 can be a mechanical key or a touch key.
  • the device 100 can receive key input signals and implement functions related to case input signals.
  • the motor 191 can generate vibrations.
  • the motor 191 can be used for notification of incoming calls, and can also be used for touch feedback.
  • the motor 191 can generate different vibration feedback effects for touch operations on different application programs. For touch operations acting on different areas of the display screen 194, the motor 191 can also generate different vibration feedback effects. Different application scenarios (for example, time reminder, receiving information, alarm clock and games) may correspond to different vibration feedback effects.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging status and the change of the battery capacity, and can also be used to indicate messages, missed calls and notifications.
  • the hardware system of the device 100 is described in detail above, and the software system of the device 100 is introduced below.
  • the software system may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture.
  • the embodiment of the present application uses a layered architecture as an example to describe the software system of the device 100 as an example.
  • a software system adopting a layered architecture is divided into several layers, and each layer has a clear role and division of labor. Layers communicate through software interfaces.
  • the software system can be divided into four layers, which are application program layer, application program framework layer, Android Runtime (Android Runtime) and system library, and kernel layer respectively from top to bottom.
  • the application layer can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer can include some predefined functions.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display, determine whether there is a status bar, lock the screen, and capture the screen.
  • Content providers are used to store and retrieve data and make it accessible to applications.
  • the data may include video, images, audio, calls made and received, browsing history and bookmarks, and phonebook.
  • the view system includes visual controls, such as those that display text and those that display pictures.
  • the view system can be used to build applications.
  • the display interface may be composed of one or more views, for example, a display interface including an SMS notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide communication functions of the device 100, such as management of call status (connected or hung up).
  • the resource manager provides various resources to the application, such as localized strings, icons, pictures, layout files, and video files.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and can automatically disappear after a short stay without user interaction.
  • the notification manager is used for download completion notifications and message reminders.
  • the notification manager can also manage notifications that appear in the status bar at the top of the system in the form of charts or scrolling text, such as notifications from applications running in the background.
  • the notification manager can also manage notifications that appear on the screen in the form of dialog windows, such as prompting text messages in the status bar, making alert sounds, vibrating electronic devices, and blinking lights.
  • the Android Runtime includes core library and virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application program layer and the application program framework layer as binary files.
  • the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules, such as: surface manager (surface manager), media library (Media Libraries), three-dimensional graphics processing library (for example: open graphics library for embedded systems (open graphics library for embedded systems, OpenGL ES) and 2D graphics engine (for example: skia graphics library (skia graphics library, SGL)).
  • surface manager surface manager
  • media library Media Libraries
  • three-dimensional graphics processing library for example: open graphics library for embedded systems (open graphics library for embedded systems, OpenGL ES)
  • 2D graphics engine for example: skia graphics library (skia graphics library, SGL)
  • the surface manager is used to manage the display subsystem and provides the fusion of 2D layers and 3D layers for multiple applications.
  • the 3D graphics processing library can be used to implement 3D graphics drawing, image rendering, compositing and layer processing.
  • the 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer may include driver modules such as display driver, camera driver, audio driver and sensor driver.
  • a corresponding hardware interrupt is sent to the kernel layer, and the kernel layer processes the touch operation into an original input event.
  • the original input event includes information such as touch coordinates and a time stamp of the touch operation.
  • the original input event is stored in the kernel layer, and the application framework layer obtains the original input event from the kernel layer, identifies the control corresponding to the original input event, and notifies the corresponding application (application, APP) of the control.
  • the above-mentioned touch operation is a single-click operation
  • the APP corresponding to the above-mentioned control is a camera APP. After the camera APP is awakened by the single-click operation, it can call the camera driver of the kernel layer through the API, and control the camera 193 to take pictures through the camera driver.
  • the following uses the device 100 as an example to introduce the method for storing ciphertext provided by this application.
  • the files in the external memory can be encrypted and stored in the external memory, and the key for decrypting these files is stored in the internal memory of the device 100. In this way, the content in the external memory can only be It can be read as plaintext in the device 100.
  • the external memory is connected to other electronic devices, since other electronic devices do not store keys, the content in the external memory cannot be decrypted by other electronic devices, thus ensuring the security of the external memory. Security of files in .
  • the external storage can be an SD card, a USB flash drive or other types of storage.
  • the external storage can establish a data connection with the device 100 through insertion, or establish a data connection with the device 100 through wired or wireless methods.
  • This application There is no limitation on the specific type of the external memory and the connection method between the external memory and the device 100 .
  • the user can trigger the encryption process of the SD card on the encryption setting interface shown in Figure 3.
  • the user can click "Encrypted Memory Card” in Figure 3 to enter the encryption setting confirmation interface shown in Figure 4.
  • the user can click "Encrypted Memory Card” in Figure 4 to confirm the encryption of the files in the SD card.
  • the encryption process The interface is shown in Figure 5. This application does not limit the encryption algorithm used in the encryption process.
  • file encryption key file encryption key, FEK
  • a method of storing FEK is to encrypt FEK multiple times and then store it in an erasable partition, as shown in Figure 6.
  • the SD card encryption setting module After the user triggers the encryption process of the SD card on the encryption setting interface shown in Figure 3, the SD card encryption setting module generates an encryption command. Based on the setting of the lock screen password, there are two situations for the module called by the encryption command.
  • Case 1 The lock screen password is not set.
  • the SD card encryption module calls the encryption management module (Vold) to encrypt the FEK through this encryption command. If the user does not set a lock screen password, the default value (empty auth) can be used to encrypt the FEK key (file encryption key) encryption key, FEKEK) for encryption, and the process of encrypting FEK will be described in detail below.
  • the SD card encryption module calls the lock screen service (LockSettingsService) to obtain the password hash value through the encryption command, and then the lock screen service transmits the password hash value to the encryption management module (Vold), so that the subsequent use of the password hash value to encrypt FEK key for encryption.
  • the password hash value above is based on the information generated by the lock screen password. For example, the lock screen service performs hash calculation on the lock screen password when the user sets the lock screen password to generate a password hash value. After the user triggers the encryption of the SD card, the previous Save the password hash value and transmit the password hash value to the encryption management module.
  • Vold is responsible for the realization of the core function of encryption and decryption. Vold triggers the encryption logic or decryption logic for the SD card by calling the encryption library or decryption library.
  • the file system When the file system (such as eCryptfs) creates files in the SD card, the file system generates a random number for each file. For example, when eCryptfs creates a new file, it uses the random function provided by the kernel to create a random number. The random number The number is FEK. FEK is used to encrypt files in the SD card and to decrypt encrypted files in the SD card.
  • eCryptfs uses an open pretty good privacy (OpenPGP) file format to store encrypted files
  • encrypted files can be divided into multiple logical blocks (extent), and the size of each logical block is adjustable, but The size of each logical block is usually not larger than the size of a physical page.
  • OpenPGP open pretty good privacy
  • the FEK needs to be encrypted and saved. Vold unmounts the file system when the user sets SD card encryption, and remounts the file system. At this time, a random number is generated, which is FEKEK (an example of the first key).
  • the FEKEK is used to encrypt the FEK (an example of the second key), wherein the FEKEK is set by Vold to the keyring (keyring) of the kernel, and the file system obtains the FEKEK from the keyring when encrypting the FEK.
  • the encrypted FEK is stored in the metadata of the encrypted file.
  • FEKEK After FEK is encrypted, FEKEK also needs to be stored encrypted. Since Vold is a module in the rich execution environment (rich execution environment, REE), the security does not meet the requirements, and FEKEK cannot be encrypted. Vold can invoke the trusted execution environment (trust execution environment) through the client application (client application, CA).
  • the key management module in the TEE that is, the keymaster trusted application (trust application, TA), completes the encryption of the FEKEK by the keymaster TA.
  • the keymaster TA can encrypt FEKEK with the password hash and according to the advanced encryption standard (AES), generating ciphertext 1 (an example of a fifth ciphertext). Subsequently, the keymaster TA can use the hardware unique key (HUK) and encrypt the password hash value according to AES to generate keymaster_key_blob (an example of the sixth ciphertext). keymaster TA stores ciphertext 1 and keymaster_key_blob in the erasable partition (/data path).
  • AES advanced encryption standard
  • UK hardware unique key
  • keymaster TA stores ciphertext 1 and keymaster_key_blob in the erasable partition (/data path).
  • file system If there are two files to be encrypted (file 1 and file 2) in the current SD card, the file system generates two random numbers for these two files, namely, FEK1 and FEK2; subsequently, the file system uses FEK1 to encrypt file 1, and uses FEK2 encrypted file 2.
  • the file system After file 1 and file 2 are encrypted, the file system obtains FEKEK from the keyring, and uses FEKEK to encrypt FEK1 and FEK2 respectively.
  • the encrypted FEK1 is stored in the metadata of file 1
  • the encrypted FEK2 is stored in file 2. in metadata.
  • Vold calls the keymaster TA through the CA, and the keymaster TA uses the password hash value to encrypt FEKEK; then, the keymaster TA uses the hardware HUK to encrypt the password hash value.
  • the device 100 When it is necessary to decrypt the encrypted file in the SD card, the device 100 performs the reverse process of the encryption process shown in Figure 7. For example, Vold calls the keymaster TA through the CA to perform the following decryption steps: the keymaster TA obtains the keymaster_key_blob and the key from the erasable partition. In document 1, first use HUK to decrypt keymaster_key_blob to obtain the password hash value, and then use the password hash value to decrypt ciphertext 1 to obtain FEKEK.
  • eCryptfs when eCryptfs opens an encrypted file, it reads the metadata of the encrypted file header through the underlying file system, and hands the metadata to the Keystore module (including the module of keymaster TA); the Keystore module obtains FEKEK from the keyring, and uses FEKEK to The encrypted FEK in the metadata is decrypted to generate the FEK; then, eCryptfs uses the FEK to decrypt the encrypted file.
  • each logical block (extent) of the encrypted file is read into the cache page (page cache) and decrypted through the Kernel Crypto API.
  • the device 100 When the device 100 performs the first type of reset (also known as "user-level reset", that is, the user resets the device 100 from the system setting menu), the data in the erasable area will be cleared. At this time, the device 100 can back up ciphertext 1 and keymaster_key_blob, so as to prevent the files in the SD card from being unable to be decrypted due to ciphertext 1 and keymaster_key_blob being deleted.
  • the backup process of user-level reset is shown in Figure 8.
  • the user controls the device 100 to restore the factory settings through the setting interface.
  • the device 100 verifies the lock screen password input by the user. For example, the device 100 calculates the lock screen password input by the user to obtain a password hash value, and then compares the calculated password hash value with the saved password hash value, If the hash values of the two passwords are the same, it is determined that the verification is passed.
  • the application program framework layer (framework) sends a broadcast message for restoring factory settings. Vold starts the backup key process after receiving the broadcast message, calls the keymaster TA through the CA to decrypt the FEKEK from the erasable partition, then encrypts the FEKEK with the default value (empty auth), and encrypts the default value with HUK, and the encrypted FEKEK and default values (an example of the seventh ciphertext and the eighth ciphertext) are saved in the non-erasable partition.
  • the non-erasable partition refers to the data that will not be erased during the second type of reset (also known as "factory reset", that is, the user does not reset the device 100 through the system setting menu)
  • the non-erasable partition can be /sec_storage, or other secure storage areas in TEE, such as replay protected memory block (RPMB).
  • RPMB replay protected memory block
  • the device 100 After the user instructs the device 100 to perform a user-level reset, the device 100 is triggered to perform key backup.
  • the ciphertext 1 and keymaster_key_blob are stored in the erasable partition.
  • the ciphertext 1 and keymaster_key_blob are stored in the non-erasable partition in the form of "default encrypted FEKEK and HUK encrypted default value”. partition.
  • the device 100 After the key backup is completed, the device 100 enters into the formatting stage. In the formatting stage, the data in the erasable partition is cleared, and the data in the non-erasable partition is retained.
  • the device 100 After the formatting is completed, the device 100 enters the key recovery stage.
  • the ciphertext in the non-erasable partition (the default value encrypted by FEKEK and the default value encrypted by HUK) is copied to the erasable partition, thus completing the key recovery.
  • the user needs to format the device 100 through the system setting menu, and the device 100 has the opportunity to back up the ciphertext (encrypted FEKEK) in the erasable partition, so that the files in the SD card are stored in the device 100 It can still be decrypted after formatting.
  • the ciphertext in the erasable partition will be deleted without being copied to the non-erasable partition , so that the files in the SD card cannot be decrypted after the device 100 is formatted.
  • the following introduces another embodiment of the method for storing ciphertext provided by the present application, which enables the files in the SD card to be decrypted after the device 100 is reset at the factory level.
  • This embodiment can be applied to the device 100 together with the "user-level reset" embodiment described above, or can be applied to the device 100 alone.
  • the device 100 executes the key backup process shown in FIG. 10 .
  • the SD card encryption setting module calls the account login module through encryption instructions for subsequent processing. Based on the account login situation, the account login module has the following two processing methods.
  • the account login module displays the account login interface shown in Figure 11, prompting the user to log in to the account (such as the Honor account). After the account login is successful, the account login module calculates the hash value of the account identifier (identifier, ID), and then transmits the hash value of the account ID to Vold.
  • the device 100 can back up FEKEK at any time before performing the factory reset. Even if the subsequent device 100 performs the factory reset, it can Restore FEKEK after restart, thus solving the problem that files in SD card cannot be decrypted after factory reset.
  • the following describes the process of decrypting files in the SD card after the device 100 performs a factory reset.
  • the user first locks the screen of the device 100 (or shuts it down), and then presses a key combination (for example, "volume key” + “power key”) to make the device 100 enter the recovery mode, and the factory-level reset setting interface shown in FIG. 13 is displayed. . Subsequently, after the user clicks "restore factory settings", the device 100 displays the confirmation interface shown in FIG. 14 . After the user clicks "restore factory settings” on the interface shown in FIG. 13 , the device 100 executes factory reset, and displays the factory reset interface shown in FIG. 15 .
  • a key combination for example, "volume key” + “power key”
  • the device 100 restarts after completing the factory reset, runs the boot wizard program, and executes the key recovery process shown in FIG. 16 .
  • the boot wizard program calls the mobile phone retrieval module to determine whether the factory reset protection (factory reset protection, FRP) state has been triggered.
  • the mobile phone retrieval module calls the anti-theft TA through the anti-theft CA to determine whether the FRP status has been triggered. If the FRP status has been triggered, the mobile phone retrieval module displays the account verification interface shown in Figure 17.
  • the account verified on the account verification interface is The account associated with the FRP status (that is, the last login account of the device 100 before performing the factory reset). After the user enters the correct password on this interface, the mobile phone recovery module notifies Vold that the verification of the account is successful. Then, Vold calls the keymaster TA through the CA to perform the following key recovery steps.
  • keymaster TA obtains keymaster_key_blob_bak and ciphertext 2 from the non-erasable partition, first uses HUK to decrypt keymaster_key_blob_bak to obtain the hash value of the account ID, and then uses the hash value of the account ID to decrypt ciphertext 2 to obtain FEKEK.
  • keymaster TA re-encrypts FEKEK with the default value (empty auth) to generate the third ciphertext, and encrypts the default value with HUK to generate the fourth ciphertext.
  • the encrypted FEKEK and the default value are stored in the non-erasable partition (/sec_storage path) as the backup key.
  • keymaster TA copies the encrypted FEKEK and default values to the erasable partition (/data path) for use when encrypting or decrypting files in the SD card.
  • the old lock screen password is cleared. The above embodiment enables the device 100 to use the default value as the key to decrypt the SD card without setting a new lock screen password.
  • the keymaster TA can not use the default value to encrypt FEKEK, and directly copy keymaster_key_blob_bak and ciphertext 2 from the non-erasable partition to the erasable partition, in this case, the device 100 can prompt the user to set a new lock screen password , in order to encrypt FEKEK with the new lock screen password.
  • keymaster TA decrypts the FEKEK from the erasable partition, and transmits the FEKEK to the key ring through Vold.
  • the file system uses FEK to encrypt files in the SD card, it obtains FEKEK from the key ring, uses FEKEK to encrypt FEK, and the encrypted FEK is stored in the metadata of the file.
  • keymaster TA decrypts the FEKEK from the erasable partition, and transmits the FEKEK to the key ring through Vold.
  • the file system uses FEKEK to decrypt the FEK from the metadata of the file on the SD card, and then uses the FEK to decrypt the file.
  • ciphertext 1 and keymaster_key_blob are stored in the erasable partition
  • ciphertext 2 and keymaster_key_blob_bak are stored in the non-erasable partition.
  • ciphertext 1 is FEKEK encrypted with the password hash value
  • keymaster_key_blob is stored using The password hash value encrypted by HUK
  • ciphertext 2 is FEKEK encrypted with the hash value of the account ID
  • keymaster_key_blob_bak is the hash value of the account ID encrypted with HUK.
  • the device 100 After the formatting is completed, the device 100 enters the key recovery stage.
  • the ciphertext (ciphertext 2 and keymaster_key_blob_bak) in the non-erasable partition is decrypted and encrypted, and copied to the erasable partition in the form of "default value encrypted FEKEK and HUK encrypted default value", Key recovery is thus completed.
  • the corresponding device includes a corresponding hardware structure and/or software module for performing each function.
  • the present application can be implemented in the form of hardware or a combination of hardware and computer software in combination with the units and algorithm steps of each example described in the embodiments disclosed herein. Whether a certain function is executed by hardware or computer software drives hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
  • the present application may divide the device for storing ciphertext into functional units according to the above method example, for example, each function may be divided into each functional unit, or two or more functions may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in this application is schematic, and is only a logical function division, and there may be other division methods in actual implementation.
  • Fig. 19 is a schematic structural diagram of a device for storing ciphertext provided by the present application.
  • the device 1900 includes a processing unit 1910 and an input unit 1920 .
  • the input unit 1920 is used to: obtain an encryption instruction, the encryption instruction indicates to encrypt files in the external memory;
  • the processing unit 1910 is configured to: obtain the characteristic value of the first account identifier according to the encryption instruction; use the characteristic value of the first account identifier to encrypt the first key to generate a first ciphertext, wherein the first key is used to encrypt a second key, and the second key is used to encrypt the first file in the external memory; encrypt the characteristic value of the first account identifier to generate a second ciphertext; convert the first The ciphertext and the second ciphertext are stored in the non-erasable partition.
  • the input unit 1920 is further configured to: acquire instruction information for switching accounts;
  • the processing unit 1910 is further configured to: verify the first account ID according to the instruction information; obtain the feature value of the second account ID after the verification of the first account ID is passed; A value updates the first ciphertext and the second ciphertext.
  • the processing unit 1910 is further configured to: determine whether the FRP state has been triggered; when the FRP state has been triggered, verify the first account ID; when the verification of the first account ID is successful, Decrypt the first ciphertext and the second ciphertext to generate the first key.
  • the processing unit 1910 is further configured to: use a default value to encrypt the first key to generate a third ciphertext; encrypt the default value to generate a fourth ciphertext; combine the third ciphertext and the The fourth ciphertext is stored in the non-erasable partition.
  • the processing unit 1910 is further configured to: copy the third ciphertext and the fourth ciphertext from the non-erasable partition to the erasable partition; according to the The third ciphertext and the fourth ciphertext generate the first key; and decrypt the file in the external memory according to the first key.
  • the device 1900 executes the method for storing ciphertext and the beneficial effects produced, refer to the relevant description in the method embodiments.
  • FIG. 20 shows a schematic structural diagram of an electronic device provided by the present application.
  • the dashed line in Figure 20 indicates that the unit or the module is optional.
  • the device 2000 may be used to implement the methods described in the foregoing method embodiments.
  • the device 2000 includes one or more processors 2001, and the one or more processors 2001 can support the device 2000 to implement the method in the method embodiment.
  • the processor 2001 may be a general purpose processor or a special purpose processor.
  • the processor 2001 may be a central processing unit (central processing unit, CPU), a digital signal processor (digital signal processor, DSP), an application specific integrated circuit (ASIC), a field programmable gate array (field programmable gate array, FPGA) or other programmable logic devices such as discrete gates, transistor logic devices, or discrete hardware components.
  • the processor 2001 may be used to control the device 2000, execute software programs, and process data of the software programs.
  • the device 2000 may also include a communication unit 2005, configured to implement signal input (reception) and output (transmission).
  • the device 2000 may be a chip
  • the communication unit 2005 may be an input and/or output circuit of the chip, or the communication unit 2005 may be a communication interface of the chip, and the chip may serve as a component of a terminal device or other electronic devices.
  • the device 2000 may be a terminal device, and the communication unit 2005 may be a transceiver of the terminal device, or the communication unit 2005 may be a transceiver circuit of the terminal device.
  • the device 2000 may include one or more memories 2002, on which a program 2004 is stored, and the program 2004 may be run by the processor 2001 to generate instructions 2003, so that the processor 2001 executes the methods described in the above method embodiments according to the instructions 2003.
  • data may also be stored in the memory 2002 .
  • the processor 2001 can also read the data stored in the memory 2002 (such as the first ciphertext and the second ciphertext), the data can be stored in the same storage address as the program 2004, and the data can also be stored in the same storage address as the program 2004. 2004 is stored at a different memory address.
  • the processor 2001 and the memory 2002 may be set separately, or may be integrated together, for example, integrated on a system-on-chip (system on chip, SOC) of a terminal device.
  • SOC system on chip
  • the present application also provides a computer program product, which implements the method described in any method embodiment in the present application when the computer program product is executed by the processor 2001 .
  • the computer program product can be stored in the memory 2002, such as program 2004, and the program 2004 is finally converted into an executable target file that can be executed by the processor 2001 through processes such as preprocessing, compiling, assembling and linking.
  • the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a computer, the method described in any method embodiment in the present application is implemented.
  • the computer program may be a high-level language program or an executable object program.
  • the computer-readable storage medium is, for example, the memory 2002 .
  • the memory 2002 may be a volatile memory or a nonvolatile memory, or, the memory 2002 may include both a volatile memory and a nonvolatile memory.
  • the non-volatile memory can be read-only memory (read-only memory, ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically programmable Erases programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • Volatile memory can be random access memory (RAM), which acts as external cache memory.
  • RAM random access memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • SDRAM double data rate synchronous dynamic random access memory
  • double data rate SDRAM double data rate SDRAM
  • DDR SDRAM enhanced synchronous dynamic random access memory
  • ESDRAM enhanced synchronous dynamic random access memory
  • serial link DRAM SLDRAM
  • direct memory bus random access memory direct rambus RAM, DR RAM
  • the disclosed systems, devices and methods may be implemented in other ways. For example, some features of the method embodiments described above may be omitted, or not implemented.
  • the device embodiments described above are only illustrative, and the division of units is only a logical function division. In actual implementation, there may be other division methods, and multiple units or components may be combined or integrated into another system.
  • the coupling between the various units or the coupling between the various components may be direct coupling or indirect coupling, and the above coupling includes electrical, mechanical or other forms of connection.
  • serial numbers of the processes do not mean the order of execution, and the execution order of the processes should be determined by their functions and internal logic, rather than by the embodiments of the present application.
  • the implementation process constitutes any limitation.
  • system and “network” are often used herein interchangeably.
  • the term “and/or” in this article is just an association relationship describing associated objects, which means that there can be three relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, and A and B exist alone. There are three cases of B.
  • the character "/" in this article generally indicates that the contextual objects are an "or” relationship.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephone Function (AREA)
  • Storage Device Security (AREA)

Abstract

一种保存密文的方法和装置,方法包括:获取加密指令,加密指令指示加密外置存储器中的文件;根据加密指令获取第一账号标识的特征值;使用第一账号标识的特征值加密第一密钥,生成第一密文,其中,第一密钥用于加密第二密钥,第二密钥用于加密外置存储器中的第一文件;加密第一账号标识的特征值,生成第二密文;将第一密文和第二密文存储于不可擦除分区。方法和装置能够解决电子设备执行工厂级重置后外置存储器中的数据无法解密的问题。

Description

保存密文的方法和装置
本申请要求于2021年05月24日提交国家知识产权局、申请号为202110566480.8、申请名称为“保存密文的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端领域,具体涉及一种保存密文的方法和装置。
背景技术
随着增强移动宽带(enhanced mobile broadband,eMBB)、高清视频等大数据量业务的出现,电子设备面临存储空间不足的问题。与电子设备连接的外置存储器(如安全数码(secure digital,SD)卡)能够解决存储空间不足的问题,为了保障数据安全,外置存储器中的数据需要加密保存。
外置存储器的密钥被锁屏口令加密后存储在电子设备的可擦除分区中,当用户对电子设备实施工厂级重置(factory reset)时,可擦除分区内加密的密钥(即,密文)来不及保存即被删除,从而导致外置存储器中的数据无法解密。
发明内容
本申请提供了一种保存密文的方法和装置,能够解决电子设备执行工厂级重置后外置存储器中的数据无法解密的问题。
第一方面,提供了一种保存密文的方法,包括:获取加密指令,所述加密指令指示加密外置存储器中的文件;根据所述加密指令获取第一账号标识的特征值;使用所述第一账号标识的特征值加密第一密钥,生成第一密文,其中,所述第一密钥用于加密第二密钥,所述第二密钥用于加密所述外置存储器中的第一文件;加密所述第一账号标识的特征值,生成第二密文;将所述第一密文和所述第二密文存储于不可擦除分区。
加密指令为用户在加密设置界面加密外置存储器时触发的指令,电子设备获取加密指令后生成第一密文和第二密文,并将第一密文和第二密文存储在电子设备的不可擦除分区中,这样,在用户对电子设备实施工厂级重置前,电子设备已完成了第一密文和第二密文的安全存储;电子设备完成了工厂级重置后,可以从不可擦除分区恢复第一密钥,随后利用第一密钥解密出外置存储器中的第二密钥,并利用第二密钥解密出外置存储器中的文件,从而解决了工厂级重置后外置存储器中的文件无法被解密的问题。
可选地,所述方法还包括:获取切换账号的指示信息;根据所述指示信息校验所述第一账号标识;所述第一账号标识校验通过后,获取第二账号标识的特征值;根据所述第二账号标识的特征值更新所述第一密文和所述第二密文。
用户可以在账号登录界面切换当前登录的账号标识(如,第一账号标识),用户 在账号登录界面触发电子设备生成切换账号的指示信息后,电子设备可以要求用户输入第一账号标识对应的密码,对第一账号标识进行校验。第一账号标识校验通过后,说明切换账号标识的用户为合法用户,电子设备可以获取用户输入的第二账号标识,并计算第二账号标识的哈希值(特征值的一个示例),随后利用第二账号标识的哈希值更新所述第一密文和所述第二密文,其中,电子设备可以先解密出第一密钥,再使用第二账号标识的哈希值生成更新后的第一密文,随后加密第二账号标识的哈希值生成更新后的第二密文。上述方案在确定当前用户(切换账号标识的用户)为合法用户后,利用当前用户的账号标识(第二账号标识)更新第一密文和第二密文,解除了第一账号标识对应的加密和解密外置存储器的权限,从而确保了外置存储器中数据的安全性。
可选地,所述方法还包括:在工厂级重置完成后,校验所述第一账号标识;当所述第一账号标识校验成功时,解密所述第一密文和所述第二密文,生成所述第一密钥。
电子设备执行工厂级重置后会启动账号校验机制,该机制要求账号校验成功后才能正常使用电子设备。校验工厂级重置前最后登录的账号标识(如,第一账号标识),可以确保电子设备执行工厂级重置后的用户为合法用户,从而确保了外置存储器中数据的安全性。
可选地,所述校验所述第一账号标识,包括:
当工厂级重置保护(factory reset protection,FRP)状态已被触发时,校验所述第一账号标识。
可选地,所述方法还包括:使用默认值加密所述第一密钥,生成第三密文;加密所述默认值,生成第四密文;将所述第三密文和所述第四密文存储于所述不可擦除分区。
由于用户可能会切换账号,电子设备执行工厂级重置后继续使用第一账号标识或者第二账号标识加密保存第一密钥存在泄密风险,电子设备可以在解密出第一密钥后使用默认值加密保存第一密钥,从而确保了外置存储器中数据的安全性。
可选地,所述方法还包括:将所述第三密文和所述第四密文从所述不可擦除分区拷贝至可擦除分区;根据所述可擦除分区中的所述第三密文和所述第四密文生成所述第一密钥;根据所述第一密钥解密所述外置存储器中加密的第一文件。
可选地,所述校验所述第一账号标识之前,所述方法还包括:获取recovery界面触发的工厂级重置指令;根据所述工厂级重置指令格式化可擦除分区中的数据。
可选地,所述使用所述第一账号标识的特征值加密第一密钥,包括:调用密钥管理模块keymaster TA执行:使用所述第一账号标识的特征值加密所述第一密钥;所述加密所述第一账号标识的特征值,包括:调用所述keymaster TA执行:加密所述第一账号标识的特征值。
可选地,所述将所述第一密文和所述第二密文存储于不可擦除分区,包括:调用可信执行环境应用程序接口执行:将所述第一密文和所述第二密文存储于所述不可擦除分区。
可选地,所述第一密钥还用于加密第三密钥,所述第三密钥用于加密所述外置存储器中加密的第二文件。
可选地,所述方法还包括:根据所述加密指令获取锁屏口令的特征值;使用所述锁屏口令的特征值加密所述第一密钥,生成第五密文;加密所述锁屏口令的特征值,生成第六密文;将所述第五密文和所述第六密文存储于可擦除分区。
可选地,所述使用所述锁屏口令的特征值加密所述第一密钥,包括:调用keymaster TA执行:使用所述锁屏口令的特征值加密所述第一密钥;所述加密所述锁屏口令的特征值,包括:调用所述keymaster TA执行:加密所述锁屏口令的特征值。
可选地,所述方法还包括:获取设置界面触发的用户级重置指令;根据所述用户级重置指令将所述第五密文和所述第六密文备份至所述不可擦除分区。
可选地,所述根据所述用户级重置指令将所述第五密文和所述第六密文备份至所述不可擦除分区,包括:根据所述用户级重置指令从所述第五密文和所述第六密文中解密出所述第一密钥;使用默认值加密所述第一密钥,生成第七密文;加密所述默认值,生成第八密文;将所述第七密文和所述第八密文存储在所述不可擦除分区中。
可选地,所述方法还包括:在用户级重置完成后,将所述第七密文和所述第八密文从所述不可擦除分区拷贝至所述可擦除分区;从所述可擦除分区中的所述第七密文和所述第八密文中解密出所述第一密钥;根据所述第一密钥解密所述外置存储器中加密的所述第一文件。
可选地,所述可擦除分区为data分区,所述锁屏口令的特征值为所述锁屏口令的哈希值。
可选地,所述不可擦除分区为sec_storage分区,所述第一账号标识的特征值为所述第一账号标识的哈希值。
第二方面,提供了一种另一种保存密文的方法,包括:显示外置存储器的加密设置界面;接收用户在所述加密设置界面上进行的第一操作;响应于所述第一操作,加密所述外置存储器中的文件;接收所述用户的第二操作;响应于所述第二操作,显示工厂级重置设置界面;接收所述用户在所述工厂级重置设置界面进行的第三操作;响应于所述第三操作,进行工厂级重置;显示账号校验界面;接收所述用户在所述账号校验界面输入的校验信息;当所述校验信息校验通过时,并且,当接收到用户访问所述外置存储器中的文件的操作时,解密所述外置存储器中加密的文件。
加密指令为用户在加密设置界面加密外置存储器时触发的指令,电子设备获取加密指令后生成第一密文和第二密文,并将第一密文和第二密文存储在电子设备的不可擦除分区中,这样,在用户对电子设备实施工厂级重置前,电子设备已完成了第一密文和第二密文的安全存储;电子设备在完成了工厂级重置后,可以从不可擦除分区恢复第一密钥,随后利用第一密钥解密出外置存储器中的第二密钥,并利用第二密钥解密出外置存储器中的文件,从而解决了工厂级重置后外置存储器中的文件无法被解密的问题。
第三方面,提供了一种保存密文的装置,包括用于执行第一方面或第二方面中任一种方法的单元。该装置可以是终端设备,也可以是终端设备内的芯片。该装置可以包括输入单元和处理单元。
当该装置是终端设备时,该处理单元可以是处理器,该输入单元可以是通信接口;该终端设备还可以包括存储器,该存储器用于存储计算机程序代码,当该处理器执行 该存储器所存储的计算机程序代码时,使得该终端设备执行第一方面或第二方面中的任一种方法。
当该装置是终端设备内的芯片时,该处理单元可以是芯片内部的处理单元,该输入单元可以是输出接口、管脚或电路等;该芯片还可以包括存储器,该存储器可以是该芯片内的存储器(例如,寄存器、缓存等),也可以是位于该芯片外部的存储器(例如,只读存储器、随机存取存储器等);该存储器用于存储计算机程序代码,当该处理器执行该存储器所存储的计算机程序代码时,使得该芯片执行第一方面或第二方面中的任一种方法。
第四方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序代码,当所述计算机程序代码被保存密文的装置运行时,使得该装置执行第一方面或第二方面中的任一种方法。
第五方面,提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序代码,当所述计算机程序代码被保存密文的装置运行时,使得该装置执行第一方面或第二方面中的任一种方法。
附图说明
图1是一种适用于本申请的装置的硬件系统的示意图;
图2是一种适用于本申请的装置的软件系统的示意图;
图3是本申请提供的一种加密设置界面的示意图;
图4是本申请提供的一种加密确认界面的示意图;
图5是本申请提供的一种加密过程界面的示意图;
图6是本申请提供的一种保存密钥的方法的示意图;
图7是本申请提供的一种加密流程的示意图;
图8是本申请提供的一种用户级重置场景中备份和恢复密钥的方法的示意图;
图9是本申请提供的一种用户级重置场景中存储区域的密文存储变化情况的示意图;
图10是本申请提供的一种工厂级重置场景中备份密钥的方法的示意图;
图11是本申请提供的一种账号登录界面的示意图;
图12是本申请提供的一种账号切换时存储区域的密文存储变化情况的示意图;
图13是本申请提供的一种工厂级重置设置界面的示意图;
图14是本申请提供的一种工厂级重置确认界面的示意图;
图15是本申请提供的一种工厂级重置过程界面的示意图;
图16是本申请提供的一种工厂级重置场景中恢复密钥的方法的示意图;
图17是本申请提供的一种账号校验界面示意图;
图18是本申请提供的一种工厂级重置场景中存储区域的密文存储变化情况的示意图;
图19是本申请提供的一种保存密文的装置的示意图;
图20是本申请提供的一种保存密文的电子设备的示意图。
具体实施方式
下面将结合附图,对本申请实施例中的技术方案进行描述。
图1示出了一种适用于本申请的装置的硬件系统。
装置100可以是手机、智慧屏、平板电脑、可穿戴电子设备、车载电子设备、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)、投影仪等等,本申请实施例对装置100的具体类型不作任何限制。
装置100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
需要说明的是,图1所示的结构并不构成对装置100的具体限定。在本申请另一些实施例中,装置100可以包括比图1所示的部件更多或更少的部件,或者,装置100可以包括图1所示的部件中某些部件的组合,或者,装置100可以包括图1所示的部件中某些部件的子部件。图1示的部件可以以硬件、软件、或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元。例如,处理器110可以包括以下处理单元中的至少一个:应用处理器(application processor,AP)、调制解调处理器、图形处理器(graphics processing unit,GPU)、图像信号处理器(image signal processor,ISP)、控制器、视频编解码器、数字信号处理器(digital signal processor,DSP)、基带处理器、神经网络处理器(neural-network processing unit,NPU)。其中,不同的处理单元可以是独立的器件,也可以是集成的器件。
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。例如,处理器110可以包括以下接口中的至少一个:内部集成电路(inter-integrated circuit,I2C)接口、内部集成电路音频(inter-integrated circuit sound,I2S)接口、脉冲编码调制(pulse code modulation,PCM)接口、通用异步接收传输器(universal asynchronous receiver/transmitter,UART)接口、移动产业处理器接口(mobile industry processor interface,MIPI)、通用输入输出(general-purpose input/output,GPIO)接口、SIM接 口、USB接口。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K、充电器、闪光灯、摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现装置100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194和摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI)、显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现装置100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现装置100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号接口,也可被配置为数据信号接口。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194、无线通信模块160、音频模块170和传感器模块180。GPIO接口还可以被配置为I2C接口、I2S接口、UART接口或MIPI接口。
USB接口130是符合USB标准规范的接口,例如可以是迷你(Mini)USB接口、微型(Micro)USB接口或C型USB(USB Type C)接口。USB接口130可以用于连接充电器为装置100充电,也可以用于装置100与外围设备之间传输数据,还可以用于连接耳机以通过耳机播放音频。USB接口130还可以用于连接其他装置100,例如AR设备。
图1所示的各模块间的连接关系只是示意性说明,并不构成对装置100的各模块间的连接关系的限定。可选地,装置100的各模块也可以采用上述实施例中多种连接方式的组合。
充电管理模块140用于从充电器接收电力。其中,充电器可以是无线充电器,也 可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的电流。在一些无线充电的实施例中,充电管理模块140可以通过装置100的无线充电线圈接收电磁波(电流路径如虚线所示)。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为装置100供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量、电池循环次数和电池健康状态(例如,漏电、阻抗)等参数。可选地,电源管理模块141可以设置于处理器110中,或者,电源管理模块141和充电管理模块140可以设置于同一个器件中。
装置100的无线通信功能可以通过天线1、天线2、移动通信模块150、无线通信模块160、调制解调处理器以及基带处理器等器件实现。
天线1和天线2用于发射和接收电磁波信号。装置100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在装置100上的无线通信的解决方案,例如下列方案中的至少一个:第二代(2 th generation,2G)移动通信解决方案、第三代(3 th generation,3G)移动通信解决方案、第四代(4 th generation,4G)移动通信解决方案、第五代(5 th generation,5G)移动通信解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波和放大等处理,随后传送至调制解调处理器进行解调。移动通信模块150还可以放大经调制解调处理器调制后的信号,放大后的该信号经天线1转变为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(例如,扬声器170A、受话器170B)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
与移动通信模块150类似,无线通信模块160也可以提供应用在装置100上的无线通信解决方案,例如下列方案中的至少一个:无线局域网(wireless local area networks,WLAN)、蓝牙(bluetooth,BT)、蓝牙低功耗(bluetooth low energy,BLE)、超宽带(ultra wide band,UWB)、全球导航卫星系统(global navigation satellite system,GNSS)、调频(frequency modulation,FM)、近场通信(near field communication,NFC)、红 外(infrared,IR)技术。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,并将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频和放大,该信号经天线2转变为电磁波辐射出去。
在一些实施例中,装置100的天线1和移动通信模块150耦合,装置100的天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络和其他电子设备通信。该无线通信技术可以包括以下通信技术中的至少一个:全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,IR技术。该GNSS可以包括以下定位技术中的至少一个:全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS),星基增强系统(satellite based augmentation systems,SBAS)。
装置100可以通过GPU、显示屏194以及应用处理器实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194可以用于显示图像或视频。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD)、有机发光二极管(organic light-emitting diode,OLED)、有源矩阵有机发光二极体(active-matrix organic light-emitting diode,AMOLED)、柔性发光二极管(flex light-emitting diode,FLED)、迷你发光二极管(mini light-emitting diode,Mini LED)、微型发光二极管(micro light-emitting diode,Micro LED)、微型OLED(Micro OLED)或量子点发光二极管(quantum dot light emitting diodes,QLED)。在一些实施例中,装置100可以包括1个或N个显示屏194,N为大于1的正整数。
装置100可以通过ISP、摄像头193、视频编解码器、GPU、显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP可以对图像的噪点、亮度和色彩进行算法优化,ISP还可以优化拍摄场景的曝光和色温等参数。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图 像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的红绿蓝(red green blue,RGB),YUV等格式的图像信号。在一些实施例中,装置100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当装置100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。装置100可以支持一种或多种视频编解码器。这样,装置100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1、MPEG2、MPEG3和MPEG4。
NPU是一种借鉴生物神经网络结构的处理器,例如借鉴人脑神经元之间传递模式对输入信息快速处理,还可以不断地自学习。通过NPU可以实现装置100的智能认知等功能,例如:图像识别、人脸识别、语音识别和文本理解。
外部存储器接口120可以用于连接外部存储卡,例如安全数码(secure digital,SD)卡,实现扩展装置100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能(例如,声音播放功能和图像播放功能)所需的应用程序。存储数据区可存储装置100使用过程中所创建的数据(例如,音频数据和电话本)。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如:至少一个磁盘存储器件、闪存器件和通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令和/或存储在设置于处理器中的存储器的指令,执行装置100的各种处理方法。
装置100可以通过音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D以及应用处理器等实现音频功能,例如,音乐播放和录音。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也可以用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170或者音频模块170的部分功能模块可以设置于处理器110中。
扬声器170A,也称为喇叭,用于将音频电信号转换为声音信号。装置100可以通过扬声器170A收听音乐或免提通话。
受话器170B,也称为听筒,用于将音频电信号转换成声音信号。当用户使用装置100接听电话或语音信息时,可以通过将受话器170B靠近耳朵接听语音。
麦克风170C,也称为话筒或传声器,用于将声音信号转换为电信号。当用户拨打电话或发送语音信息时,可以通过靠近麦克风170C发声将声音信号输入麦克风170C。装置100可以设置至少一个麦克风170C。在另一些实施例中,装置100可以设置两个麦克风170C,以实现降噪功能。在另一些实施例中,装置100还可以设置三个、四个或更多麦克风170C,以实现识别声音来源和定向录音等功能。处理器110可以对麦克风170C输出的电信号进行处理,例如,音频模块170与无线通信模块160可以通过 PCM接口耦合,麦克风170C将环境声音转换为电信号(如PCM信号)后,通过PCM接口将该电信号传输至处理器110;从处理器110对该电信号进行音量分析和频率分析,确定环境声音的音量和频率。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动装置100平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,例如可以是电阻式压力传感器、电感式压力传感器或电容式压力传感器。电容式压力传感器可以是包括至少两个具有导电材料的平行板,当力作用于压力传感器180A,电极之间的电容改变,装置100根据电容的变化确定压力的强度。当触摸操作作用于显示屏194时,装置100根据压力传感器180A检测所述触摸操作。装置100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令;当触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定装置100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定装置100围绕三个轴(即,x轴、y轴和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。例如,当快门被按下时,陀螺仪传感器180B检测装置100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消装置100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航和体感游戏等场景。
气压传感器180C用于测量气压。在一些实施例中,装置100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。装置100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当装置100是翻盖机时,装置100可以根据磁传感器180D检测翻盖的开合。装置100可以根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测装置100在各个方向上(一般为x轴、y轴和z轴)加速度的大小。当装置100静止时可检测出重力的大小及方向。加速度传感器180E还可以用于识别装置100的姿态,作为横竖屏切换和计步器等应用程序的输入参数。
距离传感器180F用于测量距离。装置100可以通过红外或激光测量距离。在一些实施例中,例如在拍摄场景中,装置100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(light-emitting diode,LED)和光检测器,例如,光电二极管。LED可以是红外LED。装置100通过LED向外发射红外光。装置100使用光电二极管检测来自附近物体的红外反射光。当检测到反射光时, 装置100可以确定附近存在物体。当检测不到反射光时,装置100可以确定附近没有物体。装置100可以利用接近光传感器180G检测用户是否手持装置100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式或口袋模式的自动解锁与自动锁屏。
环境光传感器180L用于感知环境光亮度。装置100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测装置100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。装置100可以利用采集的指纹特性实现解锁、访问应用锁、拍照和接听来电等功能。
温度传感器180J用于检测温度。在一些实施例中,装置100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,装置100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,装置100对电池142加热,以避免低温导致装置100异常关机。在其他一些实施例中,当温度低于又一阈值时,装置100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称为触控器件。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,触摸屏也称为触控屏。触摸传感器180K用于检测作用于其上或其附近的触摸操作。触摸传感器180K可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于装置100的表面,并且与显示屏194设置于不同的位置。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键和音量键。按键190可以是机械按键,也可以是触摸式按键。装置100可以接收按键输入信号,实现于案件输入信号相关的功能。
马达191可以产生振动。马达191可以用于来电提示,也可以用于触摸反馈。马达191可以对作用于不同应用程序的触摸操作产生不同的振动反馈效果。对于作用于显示屏194的不同区域的触摸操作,马达191也可产生不同的振动反馈效果。不同的应用场景(例如,时间提醒、接收信息、闹钟和游戏)可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态和电量变化,也可以用于指示消息、未接来电和通知。
SIM卡接口195用于连接SIM卡。SIM卡可以插入SIM卡接口195实现与装置100的接触,也可以从SIM卡接口195拔出实现与装置100的分离。装置100可以支 持1个或N个SIM卡接口,N为大于1的正整数。同一个SIM卡接口195可以同时插入多张卡,所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容外部存储卡。装置100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,装置100采用嵌入式SIM(embedded-SIM,eSIM)卡,eSIM卡可以嵌在装置100中,不能和装置100分离。
上文详细描述了装置100的硬件系统,下面介绍装置100的软件系统。软件系统可以采用分层架构、事件驱动架构、微核架构、微服务架构或云架构,本申请实施例以分层架构为例,示例性地描述装置100的软件系统。
如图2所示,采用分层架构的软件系统分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,软件系统可以分为四层,从上至下分别为应用程序层、应用程序框架层、安卓运行时(Android Runtime)和系统库、以及内核层。
应用程序层可以包括相机、图库、日历、通话、地图、导航、WLAN、蓝牙、音乐、视频、短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用程序编程接口(application programming interface,API)和编程框架。应用程序框架层可以包括一些预定义的函数。
例如,应用程序框架层包括窗口管理器、内容提供器、视图系统、电话管理器、资源管理器和通知管理器。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏、锁定屏幕和截取屏幕。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频、图像、音频、拨打和接听的电话、浏览历史和书签、以及电话簿。
视图系统包括可视控件,例如显示文字的控件和显示图片的控件。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成,例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供装置100的通信功能,例如通话状态(接通或挂断)的管理。
资源管理器为应用程序提供各种资源,比如本地化字符串、图标、图片、布局文件和视频文件。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于下载完成告知和消息提醒。通知管理器还可以管理以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知。通知管理器还可以管理以对话窗口形式出现在屏幕上的通知,例如在状态栏提示文本信息、发出提示音、电子设备振动以及指示灯闪烁。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序 框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理、堆栈管理、线程管理、安全和异常的管理、以及垃圾回收等功能。
系统库可以包括多个功能模块,例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:针对嵌入式系统的开放图形库(open graphics library for embedded systems,OpenGL ES)和2D图形引擎(例如:skia图形库(skia graphics library,SGL))。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D图层和3D图层的融合。
媒体库支持多种音频格式的回放和录制、多种视频格式回放和录制以及静态图像文件。媒体库可以支持多种音视频编码格式,例如:MPEG4、H.264、动态图像专家组音频层面3(moving picture experts group audio layer III,MP3)、高级音频编码(advanced audio coding,AAC)、自适应多码率(adaptive multi-rate,AMR)、联合图像专家组(joint photographic experts group,JPG)和便携式网络图形(portable network graphics,PNG)。
三维图形处理库可以用于实现三维图形绘图、图像渲染、合成和图层处理。
二维图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层可以包括显示驱动、摄像头驱动、音频驱动和传感器驱动等驱动模块。
下面结合显示拍照场景,示例性说明装置100的软件系统和硬件系统的工作流程。
当用户在触摸传感器180K上进行触摸操作时,相应的硬件中断被发送至内核层,内核层将触摸操作加工成原始输入事件,原始输入事件例如包括触摸坐标和触摸操作的时间戳等信息。原始输入事件被存储在内核层,应用程序框架层从内核层获取原始输入事件,识别出原始输入事件对应的控件,并通知该控件对应的应用程序(application,APP)。例如,上述触摸操作为单击操作,上述控件对应的APP为相机APP,相机APP被单击操作唤醒后,可以通过API调用内核层的摄像头驱动,通过摄像头驱动控制摄像头193进行拍摄。
下面以装置100为例介绍本申请提供的保存密文的方法。
为了保障外置存储器中的文件的安全,可以对外置存储器中的文件加密后存储在外置存储器中,解密这些文件的密钥存储在装置100的内部存储器中,这样,外置存储器中的内容只能在装置100中作为明文被读出,当外置存储器与其他电子设备连接时,由于其他电子设备未存储密钥,外置存储器中的内容无法被其他电子设备解密,从而保障了外置存储器中的文件的安全。
外置存储器可以是SD卡,也可以是U盘或其他类型的存储器,外置存储器可以通过插入的方式与装置100建立数据连接,也可以通过有线或无线方式与装置100建立数据连接,本申请对外置存储器的具体类型和外置存储器与装置100的连接方式不做限定。下面以SD为例进行说明。
用户可以在图3所示的加密设置界面触发对SD卡的加密过程。用户可以点击图3中的“加密存储卡”,进入图4所示的加密设置确认界面,随后,用户点击图4中的“加密存储卡”,确认对SD卡中的文件进行加密,加密过程的界面如图5所示。本申请对加密过程中 采用的加密算法不做限定。
SD卡中的文件完成加密后,文件加密密钥(file encryption key,FEK)需要被妥善保存。一种保存FEK的方法是对FEK进行多次加密后再存储于可擦除分区,该方法如图6所示。
用户在图3所示的加密设置界面触发对SD卡的加密过程后,SD卡加密设置模块生成加密指令,基于锁屏口令的设置情况,加密指令调用的模块有两种情况。
情况一:锁屏口令未设置。
SD卡加密模块通过该加密指令调用加密管理模块(Vold)对FEK进行加密,在用户未设置锁屏口令的情况下,后续可以使用默认值(empty auth)对加密FEK的密钥(file encryption key encryption key,FEKEK)进行加密,下文会详细介绍加密FEK的过程。
情况二:锁屏口令已设置。
SD卡加密模块通过该加密指令调用锁屏服务(LockSettingsService)获取口令哈希值,随后,锁屏服务将口令哈希值传输至加密管理模块(Vold),以便于后续使用口令哈希值对加密FEK的密钥进行加密。上述口令哈希值是基于锁屏口令生成的信息,例如,锁屏服务在用户设置锁屏口令时对锁屏口令进行哈希计算生成口令哈希值,在用户触发SD卡的加密后获取先前保存的口令哈希值并将口令哈希值传输至加密管理模块。
Vold负责加密解密核心功能的实现,Vold通过调用加密库或解密库,触发针对SD卡的加密逻辑或解密逻辑。
当文件系统(如,eCryptfs)在SD卡中创建文件时,文件系统针对每个文件生成一个随机数,例如,当eCryptfs创建一个新文件时,利用内核提供的随机函数创建一个随机数,该随机数即FEK。FEK用于加密SD卡中的文件,以及用于解密SD卡中被加密的文件。
可选地,eCryptfs采用开放优良保密协议(open pretty good privacy,OpenPGP)的文件格式存放加密文件,加密文件可以被分成多个逻辑块(extent),每个逻辑块的大小是可调的,但每个逻辑块的大小通常不会大于物理页的尺寸。
SD卡中的文件被加密后,FEK需要被加密保存。Vold在用户设置SD卡加密时卸载文件系统,并重新挂载文件系统,此时生成一个随机数,该随机数即FEKEK(第一密钥的一个示例)。FEKEK用于加密FEK(第二密钥的一个示例),其中,FEKEK由Vold设置到内核的密钥环(keyring),文件系统在对FEK进行加密时从keyring中获取FEKEK。加密后的FEK存储于加密文件的元数据(meta data)中。
FEK被加密后,FEKEK也需要被加密保存。由于Vold属于富执行环境(rich execution environment,REE)中的模块,安全性不满足要求,无法对FEKEK进行加密,Vold可以通过客户应用(client application,CA)调用可信执行环境(trust execution environment,TEE)中的密钥管理模块,即,keymaster可信应用(trust application,TA),由keymaster TA完成对FEKEK的加密。
keymaster TA可以利用口令哈希值并根据高级加密标准(advanced encryption standard,AES)对FEKEK进行加密,生成密文1(第五密文的一个示例)。随后,keymaster TA可以利用硬件唯一密钥(hardware unique key,HUK)并根据AES对口令哈希值进行加密,生成keymaster_key_blob(第六密文的一个示例)。keymaster TA将密文1和keymaster_key_blob存储在可擦除分区(/data路径)中。
由于不同装置的HUK具有唯一性,使用HUK对口令哈希值进行加密,保证了上述keymaster_key_blob只能在装置100上解密,从而确保了SD卡中加密文件的安全性。
图6涉及的加密流程如图7所示。
若当前SD卡存在两个待加密的文件(文件1和文件2),文件系统针对这两个文件生成两个随机数,即,FEK1和FEK2;随后,文件系统使用FEK1加密文件1,并使用FEK2加密文件2。
文件1和文件2完成加密后,文件系统从keyring中获取FEKEK,并使用FEKEK分别对FEK1和FEK2进行加密,加密后的FEK1保存在文件1的元数据中,加密后的FEK2保存在文件2的元数据中。
随后,Vold通过CA调用keymaster TA,由keymaster TA使用口令哈希值对FEKEK进行加密;随后,keymaster TA使用硬件HUK对口令哈希值进行加密。
当需要解密SD卡中的加密文件时,装置100执行图7所示的加密流程的逆过程,例如,Vold通过CA调用keymaster TA执行下列解密步骤:keymaster TA从可擦除分区中获取keymaster_key_blob和密文1,首先利用HUK解密keymaster_key_blob,获得口令哈希值,随后利用口令哈希值解密密文1,获得FEKEK。Vold从keymaster TA获取FEKEK后,将FEKEK设置到keyring,文件系统从keyring获取FEKEK,解密出FEK,再利用FEK解密出SD卡中的解密文件。
例如,eCryptfs打开一个加密文件时,通过下层文件系统读取该加密文件头部的元数据,将该元数据交予Keystore模块(包含keymaster TA的模块);Keystore模块从keyring获取FEKEK,利用FEKEK对元数据中加密后的FEK进行解密,生成FEK;随后,eCryptfs利用FEK解密该加密文件。在对加密文件进行解密时,加密文件的各个逻辑块(extent)被读入缓存页(page cache),通过Kernel Crypto API进行解密。
当装置100执行第一类重置(也称为“用户级重置”,即,用户从系统设置菜单对装置100进行重置)时,可擦除区的数据将被清空,此时,装置100可以备份密文1和keymaster_key_blob,从而避免密文1和keymaster_key_blob被删除导致SD卡中的文件无法解密。用户级重置的备份流程如图8所示。
用户通过设置界面控制装置100恢复出厂设置。装置100校验用户输入的锁屏口令,例如,装置100对用户输入的锁屏口令进行计算,得到口令哈希值,随后将计算得到的口令哈希值与保存的口令哈希值进行对比,若这两个口令哈希值相同,则确定校验通过。
校验通过后,应用程序框架层(framework)发送恢复出厂设置的广播消息。Vold收到该广播消息后启动备份密钥流程,通过CA调用keymaster TA从可擦除分区解密出FEKEK,随后使用默认值(empty auth)加密FEKEK,并使用HUK加密该默认值,加密后的FEKEK和默认值(第七密文和第八密文的一个示例)被保存在不可擦除分区。
本申请中,不可擦除分区指的是第二类重置(也称为“工厂级重置”,即,用户不通过系统设置菜单对装置100进行重置)过程中不会被擦除数据的存储区域,不可擦除分区可以是/sec_storage,也可以是TEE中其他安全存储区域,如重放保护内存块(replay protected memory block,RPMB)。
装置100恢复出厂设置并重启后,检测SD卡是否在位。当SD在位时,keymaster TA将加密后的FEKEK和默认值从不可擦除分区拷贝至可擦除分区,从而可以利用加密后的 FEKEK和默认值恢复FEK,解密SD卡中的文件。
综上所述,装置100执行用户级重置前后,存储区域存储的密钥变化情况如图9所示。
用户指示装置100进行用户级重置后,触发装置100执行密钥备份。在密钥备份阶段,可擦除分区中存储有密文1和keymaster_key_blob,密文1和keymaster_key_blob经过解密和加密,以“默认值加密的FEKEK和HUK加密的默认值”的形式存储于不可擦除分区。
密钥备份完成后,装置100进入格式化阶段。在格式化阶段,可擦除分区内的数据被清除,不可擦除分区内的数据被保留。
格式化完成后,装置100进入密钥恢复阶段。在密钥恢复阶段,不可擦除分区内的密文(默认值加密的FEKEK和HUK加密的默认值)被拷贝至可擦除分区,从而完成了密钥恢复。
上述用户级重置过程中,用户需要通过系统设置菜单对装置100进行格式化,装置100有机会备份可擦除分区中的密文(加密后的FEKEK),使得SD卡中的文件在装置100格式化后仍能被解密。然而,当用户不通过系统设置菜单对装置100实施第二类重置(即,工厂级重置)时,可擦除分区内的密文会在未拷贝至不可擦除分区的情况下被删除,从而导致装置100格式化后SD卡中的文件无法解密。
下面介绍本申请提供的保存密文的方法的另一实施例,能够使装置100经过工厂级重置后SD卡中的文件仍可以被解密。该实施例可以与上文所述的“用户级重置”实施例共同应用于装置100上,也可以单独应用于装置100上。
用户在图3所示的设置界面触发对SD卡的加密后,装置100执行图10所示的密钥备份流程。如图10所示,SD卡加密设置模块通过加密指令调用账号登录模块进行后续处理。基于账号登录情况,账号登录模块的处理方式有以下两种。
情况三:用户未登录账号。
账号登录模块显示图11所示的账号登录界面,提示用户登录账号(如荣耀账号)。账号登录成功后,账号登录模块计算账号标识(identifier,ID)的哈希值,随后,将账号ID的哈希值传输至Vold。
情况四:用户已登录账号。
账号登录模块获取账号ID的哈希值,并将账号ID的哈希值传输至Vold。可选地,若账号登录模块在用户触发SD卡加密前未计算账号ID的哈希值,则账号登录模块在用户触发SD卡加密时计算账号ID的哈希值;若账号登录模块在用户触发SD卡加密前已计算账号ID的哈希值,则账号登录模块在用户触发SD卡加密时直接获取账号ID的哈希值。
Vold获取账号ID的哈希值后,通过CA调用keymaster TA,由keymaster TA对FEKEK进行加密和备份。
keymaster TA可以利用账号ID的哈希值并根据AES对FEKEK进行加密,生成密文2(第一密文的一个示例)。随后,keymaster TA可以利用HUK并根据AES对账号ID的哈希值进行加密,生成keymaster_key_blob_bak(第二密文的一个示例)。keymaster TA调用TEE API将密文2和keymaster_key_blob_bak存储在不可擦除分区(/sec_storage路径)中,从而完成了FEKEK的备份。
由于不同装置的HUK具有唯一性,使用HUK对账号ID的哈希值进行加密,保证了上述keymaster_key_blob_bak只能在装置100上解密,从而确保了SD卡中加密文件的安 全性。
图10所示的方法中,用户通过设置界面触发对SD卡的加密后,装置100可以在执行工厂级重置前的任一时刻备份FEKEK,即使后续装置100执行了工厂级重置,也能够在重启后恢复FEKEK,从而解决了工厂级重置后SD卡中的文件无法被解密的问题。
可选地,装置100执行图10所示的方法后,若用户切换了登录的账号ID,则Vold获取新的账号ID的哈希值,并利用新的账号ID的哈希值更新密文2和keymaster_key_blob_bak,更新过程如图12所示。
下面说明装置100执行工厂级重置后解密SD卡中的文件的过程。
用户先将装置100锁屏(或关机),然后可以按组合键(如,“音量键”+“电源键”)使装置100进入recovery模式,显示如图13所示的工厂级重置设置界面。随后,用户点击“恢复出厂设置”后装置100显示图14所示的确认界面。用户在图13所示的界面点击“恢复出厂设置”后,装置100执行工厂级重置,显示图15所示的工厂级重置界面。
装置100完成工厂级重置后重启,运行开机向导程序,执行图16所示的密钥恢复流程。
开机向导程序调用手机找回模块确定工厂级重置保护(factory reset protection,FRP)状态是否已触发。手机找回模块通过防盗CA调用防盗TA确定FRP状态是否已触发,若FRP状态已触发,则手机找回模块显示图17所示的账号校验界面,该账号校验界面所校验的账号为FRP状态关联的账号(即,装置100执行工厂级重置前最后一次登录的账号)。用户在该界面输入正确的密码后,手机找回模块通知Vold账号校验成功。随后,Vold通过CA调用keymaster TA执行下列密钥恢复步骤。
keymaster TA从不可擦除分区中获取keymaster_key_blob_bak和密文2,首先利用HUK解密keymaster_key_blob_bak,获得账号ID的哈希值,随后利用账号ID的哈希值解密密文2,获得FEKEK。
keymaster TA使用默认值(empty auth)重新加密FEKEK,生成第三密文,并使用HUK加密该默认值,生成第四密文。加密后的FEKEK和默认值作为备份密钥被保存在不可擦除分区(/sec_storage路径)。随后,keymaster TA将加密后的FEKEK和默认值拷贝至可擦除分区(/data路径),以便于对SD卡中的文件进行加密或解密时使用。装置100执行工厂级重置后旧的锁屏口令被清除,上述实施例使得装置100可以在未设置新的锁屏口令的情况下使用默认值作为密钥解密SD卡。
可选地,keymaster TA可以不使用默认值加密FEKEK,直接将keymaster_key_blob_bak和密文2从不可擦除分区拷贝到可擦除分区,在这种情况下,装置100可以提示用户设置新的锁屏口令,以便于使用新的锁屏口令加密FEKEK。
当需要对SD卡中的文件进行加密时,keymaster TA从可擦除分区解密出FEKEK,通过Vold将该FEKEK传输至密钥环。文件系统使用FEK对SD卡中的文件加密后,从密钥环中获取FEKEK,使用FEKEK对FEK进行加密,加密后的FEK保存在文件的元数据中。
当需要对SD卡中的文件进行解密时,keymaster TA从可擦除分区解密出FEKEK,通过Vold将该FEKEK传输至密钥环。文件系统使用FEKEK从SD卡的文件的元数据中解密出FEK,随后使用FEK解密该文件。
综上所述,装置100执行工厂级重置前后,存储区域存储的密钥变化情况如图18所 示。
用户指示装置100对SD卡中的文件进行加密时,触发装置100执行密钥备份。在密钥备份阶段,可擦除分区中存储有密文1和keymaster_key_blob,不可擦除分区内存储有密文2和keymaster_key_blob_bak,其中,密文1是使用口令哈希值加密的FEKEK,keymaster_key_blob是使用HUK加密的口令哈希值,密文2是使用账号ID的哈希值加密的FEKEK,keymaster_key_blob_bak是使用HUK加密的账号ID的哈希值。
用户指示装置100执行工厂级重置后,装置100进入工厂级重置阶段,并执行格式化。在工厂级重置阶段,可擦除分区内的数据被清除,不可擦除分区内的数据被保留。
格式化完成后,装置100进入密钥恢复阶段。在密钥恢复阶段,不可擦除分区内的密文(密文2和keymaster_key_blob_bak)经过解密和加密,以“默认值加密的FEKEK和HUK加密的默认值”的形式被拷贝至可擦除分区,从而完成了密钥恢复。
上文详细介绍了本申请提供的保存密文的方法的示例。可以理解的是,相应的装置为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请可以根据上述方法示例对保存密文的装置进行功能单元的划分,例如,可以将各个功能划分为各个功能单元,也可以将两个或两个以上的功能集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
图19是本申请提供的一种保存密文的装置的结构示意图。该装置1900包括处理单元1910和输入单元1920。
输入单元1920用于:获取加密指令,所述加密指令指示加密外置存储器中的文件;
处理单元1910用于:根据所述加密指令获取第一账号标识的特征值;使用所述第一账号标识的特征值加密第一密钥,生成第一密文,其中,所述第一密钥用于加密第二密钥,所述第二密钥用于加密所述外置存储器中的第一文件;加密所述第一账号标识的特征值,生成第二密文;将所述第一密文和所述第二密文存储于不可擦除分区。
可选地,输入单元1920还用于:获取切换账号的指示信息;
处理单元1910还用于:根据所述指示信息校验所述第一账号标识;所述第一账号标识校验通过后,获取第二账号标识的特征值;根据所述第二账号标识的特征值更新所述第一密文和所述第二密文。
可选地,处理单元1910还用于:确定FRP状态是否已被触发;当所述FRP状态已被触发时,校验所述第一账号标识;当所述第一账号标识校验成功时,解密所述第一密文和所述第二密文,生成所述第一密钥。
可选地,处理单元1910还用于:使用默认值加密所述第一密钥,生成第三密文;加密所述默认值,生成第四密文;将所述第三密文和所述第四密文存储于所述不可擦 除分区。
可选地,处理单元1910还用于:将所述第三密文和所述第四密文从所述不可擦除分区拷贝至可擦除分区;根据所述可擦除分区中的所述第三密文和所述第四密文生成所述第一密钥;根据所述第一密钥解密所述外置存储器中的文件。
装置1900执行保存密文的方法的具体方式以及产生的有益效果可以参见方法实施例中的相关描述。
图20示出了本申请提供的一种电子设备的结构示意图。图20中的虚线表示该单元或该模块为可选的。设备2000可用于实现上述方法实施例中描述的方法。
设备2000包括一个或多个处理器2001,该一个或多个处理器2001可支持设备2000实现方法实施例中的方法。处理器2001可以是通用处理器或者专用处理器。例如,处理器2001可以是中央处理器(central processing unit,CPU)、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其它可编程逻辑器件,如分立门、晶体管逻辑器件或分立硬件组件。
处理器2001可以用于对设备2000进行控制,执行软件程序,处理软件程序的数据。设备2000还可以包括通信单元2005,用以实现信号的输入(接收)和输出(发送)。
例如,设备2000可以是芯片,通信单元2005可以是该芯片的输入和/或输出电路,或者,通信单元2005可以是该芯片的通信接口,该芯片可以作为终端设备或其它电子设备的组成部分。
又例如,设备2000可以是终端设备,通信单元2005可以是该终端设备的收发器,或者,通信单元2005可以是该终端设备的收发电路。
设备2000中可以包括一个或多个存储器2002,其上存有程序2004,程序2004可被处理器2001运行,生成指令2003,使得处理器2001根据指令2003执行上述方法实施例中描述的方法。可选地,存储器2002中还可以存储有数据。可选地,处理器2001还可以读取存储器2002中存储的数据(如,第一密文和第二密文),该数据可以与程序2004存储在相同的存储地址,该数据也可以与程序2004存储在不同的存储地址。
处理器2001和存储器2002可以单独设置,也可以集成在一起,例如,集成在终端设备的系统级芯片(system on chip,SOC)上。
本申请还提供了一种计算机程序产品,该计算机程序产品被处理器2001执行时实现本申请中任一方法实施例所述的方法。
该计算机程序产品可以存储在存储器2002中,例如是程序2004,程序2004经过预处理、编译、汇编和链接等处理过程最终被转换为能够被处理器2001执行的可执行目标文件。
本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被计算机执行时实现本申请中任一方法实施例所述的方法。该计算机程序可以是高级语言程序,也可以是可执行目标程序。
该计算机可读存储介质例如是存储器2002。存储器2002可以是易失性存储器或 非易失性存储器,或者,存储器2002可以同时包括易失性存储器和非易失性存储器。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。
本领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的装置和设备的具体工作过程以及产生的技术效果,可以参考前述方法实施例中对应的过程和技术效果,在此不再赘述。
在本申请所提供的几个实施例中,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的方法实施例的一些特征可以忽略,或不执行。以上所描述的装置实施例仅仅是示意性的,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,多个单元或组件可以结合或者可以集成到另一个系统。另外,各单元之间的耦合或各个组件之间的耦合可以是直接耦合,也可以是间接耦合,上述耦合包括电的、机械的或其它形式的连接。
应理解,在本申请的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施例的实施过程构成任何限定。
另外,本文中术语“系统”和“网络”在本文中常被可互换使用。本文中的术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
总之,以上所述仅为本申请技术方案的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (39)

  1. 一种保存密文的方法,其特征在于,包括:
    获取加密指令,所述加密指令指示加密外置存储器中的文件;
    根据所述加密指令获取第一账号标识的特征值;
    使用所述第一账号标识的特征值加密第一密钥,生成第一密文,其中,所述第一密钥用于加密第二密钥,所述第二密钥用于加密所述外置存储器中的第一文件;
    加密所述第一账号标识的特征值,生成第二密文;
    将所述第一密文和所述第二密文存储于不可擦除分区。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    获取切换账号的指示信息;
    根据所述指示信息校验所述第一账号标识;
    所述第一账号标识校验通过后,获取第二账号标识的特征值;
    根据所述第二账号标识的特征值更新所述第一密文和所述第二密文。
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在工厂级重置完成后,校验所述第一账号标识;
    当所述第一账号标识校验成功时,解密所述第一密文和所述第二密文,生成所述第一密钥。
  4. 根据权利要求3所述的方法,其特征在于,所述校验所述第一账号标识,包括:
    当工厂级重置保护FRP状态已被触发时,校验所述第一账号标识。
  5. 根据权利要求3或4所述的方法,其特征在于,所述方法还包括:
    使用默认值加密所述第一密钥,生成第三密文;
    加密所述默认值,生成第四密文;
    将所述第三密文和所述第四密文存储于所述不可擦除分区。
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:
    将所述第三密文和所述第四密文从所述不可擦除分区拷贝至可擦除分区;
    根据所述可擦除分区中的所述第三密文和所述第四密文生成所述第一密钥;
    根据所述第一密钥解密所述外置存储器中加密的所述第一文件。
  7. 根据权利要求3至6中任一项所述的方法,其特征在于,所述校验所述第一账号标识之前,所述方法还包括:
    获取recovery界面触发的工厂级重置指令;
    根据所述工厂级重置指令格式化可擦除分区中的数据。
  8. 根据权利要求1至7中任一项所述的方法,其特征在于,
    所述使用所述第一账号标识的特征值加密第一密钥,包括:
    调用密钥管理模块keymaster TA执行:使用所述第一账号标识的特征值加密所述第一密钥;
    所述加密所述第一账号标识的特征值,包括:
    调用所述keymaster TA执行:加密所述第一账号标识的特征值。
  9. 根据权利要求1至8中任一项所述的方法,其特征在于,所述将所述第一密文和所述第二密文存储于不可擦除分区,包括:
    调用可信执行环境应用程序接口TEE API执行:将所述第一密文和所述第二密文存储于所述不可擦除分区。
  10. 根据权利要求1至9中任一项所述的方法,其特征在于,所述第一密钥还用于加密第三密钥,所述第三密钥用于加密所述外置存储器中加密的第二文件。
  11. 根据权利要求1至10中任一项所述的方法,其特征在于,所述方法还包括:
    根据所述加密指令获取锁屏口令的特征值;
    使用所述锁屏口令的特征值加密所述第一密钥,生成第五密文;
    加密所述锁屏口令的特征值,生成第六密文;
    将所述第五密文和所述第六密文存储于可擦除分区。
  12. 根据权利要求11所述的方法,其特征在于,
    所述使用所述锁屏口令的特征值加密所述第一密钥,包括:
    调用keymaster TA执行:使用所述锁屏口令的特征值加密所述第一密钥;
    所述加密所述锁屏口令的特征值,包括:
    调用所述keymaster TA执行:加密所述锁屏口令的特征值。
  13. 根据权利要求11或12所述的方法,其特征在于,所述方法还包括:
    获取设置界面触发的用户级重置指令;
    根据所述用户级重置指令将所述第五密文和所述第六密文备份至所述不可擦除分区。
  14. 根据权利要求13所述的方法,其特征在于,所述根据所述用户级重置指令将所述第五密文和所述第六密文备份至所述不可擦除分区,包括:
    根据所述用户级重置指令从所述第五密文和所述第六密文中解密出所述第一密钥;
    使用默认值加密所述第一密钥,生成第七密文;
    加密所述默认值,生成第八密文;
    将所述第七密文和所述第八密文存储在所述不可擦除分区中。
  15. 根据权利要求14所述的方法,其特征在于,所述方法还包括:
    在用户级重置完成后,将所述第七密文和所述第八密文从所述不可擦除分区拷贝至所述可擦除分区;
    从所述可擦除分区中的所述第七密文和所述第八密文中解密出所述第一密钥;
    根据所述第一密钥解密所述外置存储器中加密的所述第一文件。
  16. 根据权利要求11至15中任一项所述的方法,其特征在于,所述可擦除分区为data分区,所述锁屏口令的特征值为所述锁屏口令的哈希值。
  17. 根据权利要求1至16中任一项所述的方法,其特征在于,所述不可擦除分区为sec_storage分区,所述第一账号标识的特征值为所述第一账号标识的哈希值。
  18. 一种保存密文的方法,其特征在于,包括:
    显示外置存储器的加密设置界面;
    接收用户在所述加密设置界面上进行的第一操作;
    响应于所述第一操作,加密所述外置存储器中的文件;
    接收所述用户的第二操作;
    响应于所述第二操作,显示工厂级重置设置界面;
    接收所述用户在所述工厂级重置设置界面进行的第三操作;
    响应于所述第三操作,进行工厂级重置;
    显示账号校验界面;
    接收所述用户在所述账号校验界面输入的校验信息;
    当所述校验信息校验通过时,并且,当接收到用户访问所述外置存储器中的文件的操作时,解密所述外置存储器中加密的文件。
  19. 根据权利要求18所述的方法,其特征在于,所述方法还包括:
    接收所述用户在所述加密设置界面上进行的第四操作;
    响应于所述第四操作,加密所述外置存储器中的文件;
    接收所述用户的第五操作;
    响应于所述第五操作,显示用户级重置设置界面;
    接收所述用户在所述用户级重置设置界面进行的第六操作;
    响应于所述第六操作,进行用户级重置;
    显示锁屏口令校验界面;
    接收所述用户在所述锁屏口令界面输入的锁屏口令;
    当所述锁屏口令校验通过时,并且,当接收到用户访问所述外置存储器中的文件的操作时,解密所述外置存储器中加密的文件。
  20. 根据权利要求18或19所述的方法,其特征在于,
    所述接收用户在所述加密设置界面上进行的第一操作,包括
    获取加密指令,所述加密指令指示加密外置存储器中的文件;
    所述方法还包括:
    根据所述加密指令获取第一账号标识的特征值;
    使用所述第一账号标识的特征值加密第一密钥,生成第一密文,其中,所述第一密钥用于加密第二密钥,所述第二密钥用于加密所述外置存储器中的第一文件;
    加密所述第一账号标识的特征值,生成第二密文;
    将所述第一密文和所述第二密文存储于不可擦除分区。
  21. 根据权利要求20所述的方法,其特征在于,所述方法还包括:
    获取切换账号的指示信息;
    根据所述指示信息校验所述第一账号标识;
    所述第一账号标识校验通过后,获取第二账号标识的特征值;
    根据所述第二账号标识的特征值更新所述第一密文和所述第二密文。
  22. 根据权利要求20所述的方法,其特征在于,所述解密所述外置存储器中加密的文件之前,所述方法还包括:
    在所述工厂级重置完成后,根据所述校验信息校验所述第一账号标识;
    当所述第一账号标识校验成功时,解密所述第一密文和所述第二密文,生成所述第一密钥。
  23. 根据权利要求22所述的方法,其特征在于,所述根据所述校验信息校验所述第一账号标识,包括:
    当工厂级重置保护FRP状态已被触发时,根据所述校验信息校验所述第一账号标 识。
  24. 根据权利要求22或23所述的方法,其特征在于,所述方法还包括:
    使用默认值加密所述第一密钥,生成第三密文;
    加密所述默认值,生成第四密文;
    将所述第三密文和所述第四密文存储于所述不可擦除分区。
  25. 根据权利要求24所述的方法,其特征在于,所述方法还包括:
    将所述第三密文和所述第四密文从所述不可擦除分区拷贝至可擦除分区;
    根据所述可擦除分区中的所述第三密文和所述第四密文生成所述第一密钥;
    根据所述第一密钥解密所述外置存储器中加密的所述第一文件。
  26. 根据权利要求20至25中任一项所述的方法,其特征在于,所述响应于所述第三操作,进行工厂级重置,包括:
    获取所述第三操作在所述工厂级重置设置界面触发的工厂级重置指令;
    根据所述工厂级重置指令格式化可擦除分区中的数据。
  27. 根据权利要求20至26中任一项所述的方法,其特征在于,
    所述使用所述第一账号标识的特征值加密第一密钥,包括:
    调用密钥管理模块执行:使用所述第一账号标识的特征值加密所述第一密钥;
    所述加密所述第一账号标识的特征值,包括:
    调用所述密钥管理模块执行:加密所述第一账号标识的特征值。
  28. 根据权利要求20至27中任一项所述的方法,其特征在于,所述将所述第一密文和所述第二密文存储于不可擦除分区,包括:
    调用可信执行环境应用程序接口执行:将所述第一密文和所述第二密文存储于所述不可擦除分区。
  29. 根据权利要求20至28中任一项所述的方法,其特征在于,所述第一密钥还用于加密第三密钥,所述第三密钥用于加密所述外置存储器中加密的第二文件。
  30. 根据权利要求20至29中任一项所述的方法,其特征在于,所述方法还包括:
    根据所述加密指令获取锁屏口令的特征值;
    使用所述锁屏口令的特征值加密所述第一密钥,生成第五密文;
    加密所述锁屏口令的特征值,生成第六密文;
    将所述第五密文和所述第六密文存储于可擦除分区。
  31. 根据权利要求30所述的方法,其特征在于,
    所述使用所述锁屏口令的特征值加密所述第一密钥,包括:
    调用密钥管理模块执行:使用所述锁屏口令的特征值加密所述第一密钥;
    所述加密所述锁屏口令的特征值,包括:
    调用所述密钥管理模块执行:加密所述锁屏口令的特征值。
  32. 根据权利要求30或31所述的方法,其特征在于,所述方法还包括:
    获取设置界面触发的用户级重置指令;
    根据所述用户级重置指令将所述第五密文和所述第六密文备份至所述不可擦除分区。
  33. 根据权利要求32所述的方法,其特征在于,所述根据所述用户级重置指令将 所述第五密文和所述第六密文备份至所述不可擦除分区,包括:
    根据所述用户级重置指令从所述第五密文和所述第六密文中解密出所述第一密钥;
    使用默认值加密所述第一密钥,生成第七密文;
    加密所述默认值,生成第八密文;
    将所述第七密文和所述第八密文存储在所述不可擦除分区中。
  34. 根据权利要求33所述的方法,其特征在于,所述方法还包括:
    在用户级重置完成后,将所述第七密文和所述第八密文从所述不可擦除分区拷贝至所述可擦除分区;
    从所述可擦除分区中的所述第七密文和所述第八密文中解密出所述第一密钥;
    根据所述第一密钥解密所述外置存储器中加密的所述第一文件。
  35. 根据权利要求30至34中任一项所述的方法,其特征在于,所述可擦除分区为数据分区,所述锁屏口令的特征值为所述锁屏口令的哈希值。
  36. 根据权利要求20至35中任一项所述的方法,其特征在于,所述不可擦除分区为安全存储分区,所述第一账号标识的特征值为所述第一账号标识的哈希值。
  37. 一种保存密文的装置,其特征在于,所述装置包括处理器和存储器,所述存储器用于存储计算机程序,所述处理器用于从所述存储器中调用并运行所述计算机程序,使得所述装置执行权利要求1至17中任一项所述的方法,或者,使得所述装置执行权利要求18至36中任一项所述的方法。
  38. 一种芯片,其特征在于,包括处理器,当所述处理器执行指令时,所述处理器执行如权利要求1至17中任一项所述的方法,或者,使得所述处理器执行权利要求18至36中任一项所述的方法。
  39. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储了计算机程序,当所述计算机程序被处理器执行时,使得所述处理器执行权利要求1至17中任一项所述的方法,或者,使得所述处理器执行权利要求18至36中任一项所述的方法。
PCT/CN2022/092296 2021-05-24 2022-05-11 保存密文的方法和装置 Ceased WO2022247639A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22810366.9A EP4152198B1 (en) 2021-05-24 2022-05-11 Method and apparatus for storing ciphertext
US18/003,265 US12526137B2 (en) 2021-05-24 2022-05-11 Method for saving ciphertext and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110566480.8 2021-05-24
CN202110566480.8A CN113408016B (zh) 2021-05-24 2021-05-24 保存密文的方法和装置

Publications (1)

Publication Number Publication Date
WO2022247639A1 true WO2022247639A1 (zh) 2022-12-01

Family

ID=77674679

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/092296 Ceased WO2022247639A1 (zh) 2021-05-24 2022-05-11 保存密文的方法和装置

Country Status (4)

Country Link
US (1) US12526137B2 (zh)
EP (1) EP4152198B1 (zh)
CN (2) CN115391849A (zh)
WO (1) WO2022247639A1 (zh)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168160B (zh) 2020-09-10 2026-04-21 荣耀终端股份有限公司 应用模块启动方法和电子设备
CN115391849A (zh) * 2021-05-24 2022-11-25 荣耀终端有限公司 保存密文的方法和装置
US12585759B2 (en) * 2021-06-30 2026-03-24 Ivanti, Inc. Application integrity verification
CN114662157B (zh) * 2022-05-25 2022-08-26 湖南工商大学 社交文本数据流的块压缩感知不可区分性保护方法及装置
CN115562573B (zh) * 2022-08-30 2024-10-29 荣耀终端有限公司 一种存储数据的方法、通信系统、电子设备及存储介质
CN116484431B (zh) * 2023-06-21 2024-05-17 荣耀终端有限公司 一种数据保护方法、电子设备及存储介质
CN118568736A (zh) * 2024-08-01 2024-08-30 上海艾拉比智能科技有限公司 一种基于frp的设备防盗方法及系统
CN119513877B (zh) * 2024-11-15 2025-10-03 南方电网科学研究院有限责任公司 可搜索加密方法、计算机设备、存储介质和计算机程序产品

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120185759A1 (en) * 2011-01-13 2012-07-19 Helen Balinsky System and method for collaboratively editing a composite document
CN105809045A (zh) * 2016-03-15 2016-07-27 青岛海信移动通信技术股份有限公司 一种设备系统在数据重置时的处理方法和装置
US10164955B1 (en) * 2016-05-25 2018-12-25 Google Llc Volatile encryption keys
US20200151356A1 (en) * 2017-08-11 2020-05-14 Duality Technologies, Inc. System and method for fast and efficient searching of encrypted ciphertexts
CN111614698A (zh) * 2017-04-28 2020-09-01 李丽萍 擦除终端数据的方法及装置
CN111966373A (zh) * 2020-08-11 2020-11-20 Oppo(重庆)智能科技有限公司 Apn的重置方法、终端设备及存储介质
CN112262548A (zh) * 2019-02-28 2021-01-22 华为技术有限公司 一种文件处理方法及终端设备
CN113408016A (zh) * 2021-05-24 2021-09-17 荣耀终端有限公司 保存密文的方法和装置

Family Cites Families (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7729690B1 (en) 2006-02-15 2010-06-01 Trend Micro, Inc. Backup and restore of user data for mobile telephone
CN101075874B (zh) 2007-06-28 2010-06-02 腾讯科技(深圳)有限公司 认证方法和认证系统
CN201518127U (zh) * 2009-10-13 2010-06-30 航天信息股份有限公司 基于口令认证的加密型移动存储器
US8700895B1 (en) * 2010-06-30 2014-04-15 Google Inc. System and method for operating a computing device in a secure mode
US20140373184A1 (en) * 2013-06-12 2014-12-18 Lookout, Inc. Mobile device persistent security mechanism
US20180091301A1 (en) * 2016-05-06 2018-03-29 ZeroDB, Inc. Method and system for switching public keys in ciphertexts
US20170337390A1 (en) * 2016-05-18 2017-11-23 Qualcomm Incorporated Data protection at factory reset
US10678924B2 (en) 2016-08-10 2020-06-09 Qualcomm Incorporated Hardware-based software-resilient user privacy exploiting ephemeral data retention of volatile memory
CN106952094B (zh) * 2017-03-10 2018-09-04 腾讯科技(深圳)有限公司 电子票据管理方法及装置
US10476858B2 (en) * 2017-05-08 2019-11-12 Dell Products L.P. System and method to remotely secure a compromised information handling system
CN111566989B (zh) * 2018-06-14 2022-06-07 华为技术有限公司 一种密钥处理方法及装置
KR102794916B1 (ko) * 2018-07-31 2025-04-15 삼성전자주식회사 팩토리 데이터 리셋 기능에 의해 제거된 어플리케이션을 복원하는 장치 및 방법
US11163908B2 (en) * 2019-03-08 2021-11-02 Microsoft Technology Licensing, Llc Device state driven encryption key management
CN110059499A (zh) * 2019-03-22 2019-07-26 华为技术有限公司 一种文件访问权限认证方法及电子设备
CN110377250B (zh) * 2019-06-05 2021-07-16 华为技术有限公司 一种投屏场景下的触控方法及电子设备
EP4036775A4 (en) * 2019-11-08 2022-09-14 Huawei Technologies Co., Ltd. DATA PROCESSING METHOD AND DEVICE AND SYSTEM CHIP
KR102325986B1 (ko) * 2020-01-22 2021-11-12 네이버클라우드 주식회사 스토리지 암호화의 동적 적용을 위한 방법 및 시스템
CN111935138B (zh) * 2020-08-07 2022-03-18 珠海海鹦安全科技有限公司 安全登录的防护方法、装置及电子设备
CN112560058B (zh) * 2020-12-17 2022-12-30 山东华芯半导体有限公司 基于智能密码钥匙的ssd分区加密存储系统及其实现方法
CN112632593B (zh) * 2021-03-09 2021-05-25 冷杉云(北京)科技股份有限公司 数据存储方法、数据处理方法、设备以及存储介质

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120185759A1 (en) * 2011-01-13 2012-07-19 Helen Balinsky System and method for collaboratively editing a composite document
CN105809045A (zh) * 2016-03-15 2016-07-27 青岛海信移动通信技术股份有限公司 一种设备系统在数据重置时的处理方法和装置
US10164955B1 (en) * 2016-05-25 2018-12-25 Google Llc Volatile encryption keys
CN111614698A (zh) * 2017-04-28 2020-09-01 李丽萍 擦除终端数据的方法及装置
US20200151356A1 (en) * 2017-08-11 2020-05-14 Duality Technologies, Inc. System and method for fast and efficient searching of encrypted ciphertexts
CN112262548A (zh) * 2019-02-28 2021-01-22 华为技术有限公司 一种文件处理方法及终端设备
CN111966373A (zh) * 2020-08-11 2020-11-20 Oppo(重庆)智能科技有限公司 Apn的重置方法、终端设备及存储介质
CN113408016A (zh) * 2021-05-24 2021-09-17 荣耀终端有限公司 保存密文的方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4152198A4

Also Published As

Publication number Publication date
CN113408016A (zh) 2021-09-17
EP4152198B1 (en) 2025-10-15
CN113408016B (zh) 2022-07-05
EP4152198A4 (en) 2024-01-17
US12526137B2 (en) 2026-01-13
EP4152198A1 (en) 2023-03-22
CN115391849A (zh) 2022-11-25
US20230254143A1 (en) 2023-08-10

Similar Documents

Publication Publication Date Title
CN113408016B (zh) 保存密文的方法和装置
CN113609498B (zh) 数据保护方法及电子设备
CN110752929B (zh) 应用程序的处理方法及相关产品
EP4063203A1 (en) Authentication method and medium and electronic apparatus thereof
CN114553814B (zh) 处理推送消息的方法和装置
CN113168461A (zh) 一种删除安全业务的方法及电子设备
CN112930533B (zh) 一种电子设备的控制方法及电子设备
WO2020010584A1 (zh) 一种终端恢复出厂设置时的数据恢复方法及终端
WO2020015259A1 (zh) 一种数据备份方法及终端
CN115904282B (zh) 一种投屏方法、设备、存储介质及计算机程序产品
CN114546969A (zh) 一种文件共享方法、装置及电子设备
CN116339510A (zh) 眼动追踪方法、装置、电子设备及计算机可读存储介质
CN112966297B (zh) 数据保护方法、系统、介质及电子设备
CN116484431B (zh) 一种数据保护方法、电子设备及存储介质
CN114254334B (zh) 数据处理方法、装置、设备及存储介质
CN116669020B (zh) 一种密码管理方法、系统和电子设备
CN114692119A (zh) 校验应用的方法和电子设备
CN115017227B (zh) 数据同步方法及相关设备
US12524388B2 (en) Picture storage method and apparatus, and terminal device
CN116414500B (zh) 电子设备操作引导信息录制方法、获取方法和终端设备
RU2809740C2 (ru) Способ обработки файла, хранящегося во внешней памяти
WO2023071985A1 (zh) 一种远程支付方法、电子设备及系统
CN116991345A (zh) 投屏方法和电子设备
HK40076905A (zh) 保存密文的方法和装置
CN120428885B (zh) 应用窗口切换方法、电子设备及存储介质

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2022810366

Country of ref document: EP

Effective date: 20221216

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

Ref document number: 22810366

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

WWG Wipo information: grant in national office

Ref document number: 2022810366

Country of ref document: EP

WWG Wipo information: grant in national office

Ref document number: 18003265

Country of ref document: US