WO2018090508A1 - 一种基于Keychain的数据管理方法、终端、设备及计算机可读存储介质 - Google Patents

一种基于Keychain的数据管理方法、终端、设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2018090508A1
WO2018090508A1 PCT/CN2017/076517 CN2017076517W WO2018090508A1 WO 2018090508 A1 WO2018090508 A1 WO 2018090508A1 CN 2017076517 W CN2017076517 W CN 2017076517W WO 2018090508 A1 WO2018090508 A1 WO 2018090508A1
Authority
WO
WIPO (PCT)
Prior art keywords
key
value
user
keychain
dictionary
Prior art date
Application number
PCT/CN2017/076517
Other languages
English (en)
French (fr)
Inventor
张良
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2018090508A1 publication Critical patent/WO2018090508A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • G06F21/6263Protecting personal data, e.g. for financial or medical purposes during internet communication, e.g. revealing personal data from cookies

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a data management method based on a Keychain, a terminal, a device, and a computer readable storage medium.
  • the embodiments of the present invention provide a keychain-based data management method, a terminal, a device, and a computer-readable storage medium.
  • the embodiment of the present invention improves the traditional Keychain, and facilitates storage and reading of user information.
  • a keychain-based data management method comprising:
  • the user information including at least one attribute information
  • the Key-Value is decoded.
  • the encoding the Key-Value includes:
  • the Key-Value is encoded by the encoder.
  • the decoding of the Key-Value includes:
  • the Key-Value is decoded using the decoder.
  • the method further includes:
  • writing the dictionary to be built into the keychain includes:
  • Blocking the keychain and generating a data interface where the data interface includes a storage data interface, a read data interface, and a delete data interface;
  • the constructed dictionary is written into the Keychain.
  • a terminal comprising:
  • each dictionary corresponding to a plurality of key-value pairs Key-Value, each Key-Value corresponding to one attribute information of the user;
  • a receiving unit configured to receive user information input by a user, where the user information includes at least one attribute information
  • a generating unit configured to generate the corresponding character string by using the user information
  • a setting unit configured to set a corresponding string to a Key-Value in the dictionary according to the attribute information
  • a coding unit configured to encode the Key-Value
  • a writing unit configured to write the constructed dictionary into the Keychain
  • a decoding unit configured to decode the Key-Value if receiving an instruction of the user to access the Key-Value.
  • the coding unit includes:
  • a first calling unit configured to call an encoding function and obtain an encoder
  • An encoding subunit for encoding the Key-Value with the encoder is an encoding subunit for encoding the Key-Value with the encoder.
  • the decoding unit includes:
  • a second calling unit configured to call a decoding function and obtain a decoder
  • a decoding subunit configured to decode the Key-Value by using the decoder.
  • the terminal further includes:
  • the reading unit is configured to read all user information from the Keychain when the application starts again.
  • the writing unit includes:
  • a packaging unit configured to encapsulate the keychain and generate a data interface, where the data interface
  • a data management device comprising: an input device, an output device, a transceiver device, a memory, and a processor;
  • An input device configured to receive user data of an input of a user through an external access control device
  • An output device configured to output output data of the access control device to the outside
  • transceiver device for transmitting data to or receiving data from other devices through a communication link
  • Memory for storing programs and data with various functions
  • a processor for running a program stored in the memory to perform the following operations:
  • the user information including at least one attribute information
  • the Key-Value is decoded.
  • the encoding the Key-Value includes:
  • the Key-Value is encoded by the encoder.
  • the decoding of the Key-Value includes:
  • the Key-Value is decoded using the decoder.
  • processor further performs the following operations:
  • writing the dictionary to be built into the keychain includes:
  • the constructed dictionary is written into the Keychain.
  • a computer readable storage medium storing one or more programs, the one or more programs being executed by one or more processors to implement the steps of:
  • the user information including at least one attribute information
  • the Key-Value is decoded.
  • step of encoding the Key-Value includes:
  • the Key-Value is encoded by the encoder.
  • step of decoding the Key-Value includes:
  • the Key-Value is decoded using the decoder.
  • steps further include
  • step of writing the constructed dictionary into the Keychain includes:
  • the constructed dictionary is written into the Keychain.
  • the embodiment of the present invention constructs a dictionary and uses the corresponding key-value pair Key-Value in the dictionary.
  • the user information is stored, and the dictionary storing the user information is written into the Keychain to facilitate the storage of the user information, and the user information is encoded before the user information is set to the Key-Value in the dictionary, so that the user information supports the NSCoding protocol.
  • the read user information is decoded and converted into a corresponding data type, which facilitates the use of the user information.
  • FIG. 1 is a schematic flowchart of a keychain-based data management method according to Embodiment 1 of the present invention.
  • FIG. 2 is another schematic flowchart of a keychain-based data management method according to Embodiment 1 of the present invention.
  • FIG. 3 is another schematic flowchart of a keychain-based data management method according to Embodiment 1 of the present invention.
  • FIG. 4 is another schematic flowchart of a keychain-based data management method according to Embodiment 1 of the present invention.
  • FIG. 5 is a schematic flowchart of a keychain-based data management method according to Embodiment 2 of the present invention.
  • FIG. 6 is a schematic block diagram of a terminal according to an embodiment of the present invention.
  • FIG. 7 is another schematic block diagram of a terminal according to an embodiment of the present invention.
  • FIG. 8 is another schematic block diagram of a terminal according to an embodiment of the present invention.
  • FIG. 9 is another schematic block diagram of a terminal according to an embodiment of the present invention.
  • FIG. 10 is another schematic block diagram of a terminal according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a data management device according to an embodiment of the present invention.
  • FIG. 1 is a schematic flowchart diagram of a keychain-based data management method according to Embodiment 1 of the present invention. The method includes steps S101 to S107.
  • S101 Construct a dictionary, each dictionary corresponding to a plurality of key-value pairs Key-Value, and each Key-Value corresponds to one attribute information of the user.
  • the Keychain is a storage tool running on the IOS system, and can provide a data storage with high security coefficient for the application on the system to ensure data security; the Keychain can pass the key.
  • the value stores the Key-Value, saves the necessary data, and ensures that the data will not be found or exposed in the normal file, nor will it be read by other applications in the system.
  • the application stores the user data input by the user by constructing a dictionary NSDictionary.
  • Each dictionary corresponds to a plurality of key-value pairs Key-Value, wherein the user's account is used as a Key, and the user model is used as a Value. storage.
  • the attribute information refers to a mapping relationship between a key value and a Key and a Key in a Key-Value, each time
  • the user data is a user account and a user model
  • each user account corresponds to a user model
  • the user account is used as a Key and the user model is stored as a Value.
  • the Key can be called. Query the corresponding Value.
  • S102 Receive user information input by a user, where the user information includes at least one attribute information.
  • the data type stored by Key-Value is a string type, and the user data input by the user needs to be converted into a string type corresponding to Key-Value.
  • the single-case operation class PHKeychainManager is created to set the user data input by the user to a Key-Value in the dictionary, for example, the user account is used as a key, and the user model corresponding to the user account is used. As Value, enter the user account and user model entered by the user into the key-value pair Key-Value.
  • the created singleton operation class PHKeychainManager is used to uniformly manage the input and read of user data.
  • the creation process of the singleton operation class PHKeychainManager is standardized. For example, a global variable can be declared in the class implementation file. Instance
  • the unified access function of this class is +sharedManager, and in this function, it is judged whether the global variable _instance has been initialized, and if so, the variable itself is returned, otherwise the function dispatch_once: is used to ensure that _instance only performs initialization once and overwrites Other methods that might generate new objects, such as +allocWithZone: or -copyWithZone:.
  • the object model in which the Key-Value used to store the user data in the development is an entity data class, such as the entity data class created by the present invention, and inherits from the NSObject class, the entity data class.
  • entity data class such as the entity data class created by the present invention
  • NSObject class the entity data class.
  • the user data is supported by the NSCoding protocol, and the steps of depositing the keychain into the dictionary NSDictionary are prepared.
  • step S104 includes steps S201 to S202.
  • the encoding function is -encodeWithCoder:, and an encoder aCoder is passed when the function is called.
  • S202 Encode the Key-Value by using the encoder.
  • Each Key-Value in the entity data class is encoded once by the encoder, and for the Key-Value in the entity data class, the encoded property is not supported.
  • the property of the Int type is converted to NSString by the NSString class function + StringWithFormat: Type, and then use the encoder to encode the converted attributes.
  • the dictionary NSDictionary storing the user data is written into the Keychain.
  • the present invention can monitor the active state of the application. If the application is detected to be closed, the user data is stored in the dictionary NSDictionary through the singleton operation class PHKeychainManager, and the operation class PHKeychainWrapper is called.
  • the dictionary NSDictionary is saved to the Keychain in time by operating the data interface of the class PHKeychainWrapper.
  • step S106 includes steps S301 to S302.
  • the keychain operation type PHKeychainWrapper is used to facilitate the direct operation of the keychain by the single-function operation type PHKeychainManager.
  • the keychain is encapsulated and three data interfaces are generated, and the user directly operates the Keychain through the data interface.
  • the three data interfaces generated after the keychain is encapsulated are the storage data interface + saveObject: toService: serviceID, read data interface + saveObject: toService: serviceID and delete data interface + deleteKeychainBy:serviceID.
  • the data operation of the keychain is performed by using the single-key operation type PHKeychainManager, and the three data interfaces generated after the keychain is encapsulated can be directly operated, for example, by storing the data interface + saveObject:toService:serviceID Writes the dictionary NSDictionary storing user data to the keychain.
  • the deleteKeychainBy:serviceID deletes the user data stored in the keychain. Therefore, the operation of the PHKeychainWrapper and the generated data interface facilitates unified management of user data storage, reading, and deletion.
  • step S107 includes steps S401 to S402.
  • the decoding function is called when the user data is read from the Keychain.
  • the decoding function is -initWithCoder:, and a decoder aDecoder is passed when the function is called.
  • the decoder decodes once and decodes it into an NSString type, and then converts it into a data type corresponding to each user data as needed, and assigns it to the corresponding object.
  • the embodiment of the present invention stores the user information by using the corresponding key value in the dictionary for the Key-Value, and writing the dictionary storing the user information into the Keychain, which facilitates the storage of the user information and is set in the user information.
  • the user information Before the Key-Value in the dictionary, the user information is encoded, so that the user information supports the NSCoding protocol; when the user information in the Keychain is read, the read user information is decoded and converted into a corresponding data type. Convenient for the user
  • a flowchart of another embodiment of the present invention includes steps S501-S508 (where steps S501-S507 and The first embodiment of the present invention is the same and will not be described in detail herein.
  • S501 Construct a dictionary, each dictionary corresponding to a plurality of key-value pairs Key-Value, and each Key-Value corresponds to one attribute information of the user.
  • the PHKeychainManager responds in a timely manner, and calls the operation class PHKeychainWrapper to read the user data in the Keychain by operating the data interface of the class PHKeychainWrapper.
  • the embodiment of the present invention can prevent the loss of user data by monitoring the state of the application.
  • the storage medium may be a magnetic disk, an optical disk, or a read-only storage memory (Read-Only) Memory, ROM) or Random Access Memory (RAM).
  • the present invention further provides a data management method based on the Keychain.
  • the terminal 100 includes: a construction unit 10, a receiving unit 20, a generating unit 30, and a coding unit
  • the setting unit 50 the writing unit 60, and the decoding unit 70.
  • the building unit 10 is configured to construct a dictionary, and each dictionary corresponds to a plurality of key-value pairs Key-Value, and each Key-Value corresponds to one attribute information of the user.
  • a Keychain (a keychain) is a storage tool running on an IOS system, and can provide a security factor for applications on the system.
  • Keychain can save the necessary data by key-value storage of Key-Value, and ensure that the data will not be found or exposed in the general file, nor Will be read by other applications in the system.
  • the application stores the user data input by the user by constructing a dictionary NSDictionary.
  • Each dictionary corresponds to a plurality of key-value pairs Key-Value, wherein the user's account is used as a Key, and the user model is used as a Value. storage.
  • the attribute information refers to a mapping relationship between a key value and a Key and a Key in a Key-Value.
  • the index is stored according to the Key; corresponding to the user data input by the user, for example, the user.
  • the data is a user account and a user model.
  • Each user account corresponds to a user model, and the user account is used as a Key and the user model is stored as a Value.
  • the corresponding value can be queried by calling the Key. .
  • the receiving unit 20 is configured to receive user information input by the user, where the user information includes at least one attribute information.
  • the generating unit 30 is configured to generate the corresponding character string by using the user information.
  • the user data input by the user cannot directly input the key value pair Key-Value.
  • the data type stored by Key-Value is a string type, and the user data input by the user needs to be converted into a string type corresponding to Key-Value.
  • the setting unit 40 is configured to set a corresponding character string as a Key-Value in the dictionary according to the attribute information.
  • the single-case operation class PHKeychainManager is created to set the user data input by the user to a Key-Value in the dictionary, for example, the user account is used as a key, and the user model corresponding to the user account is used. As Value, enter the user account and user model entered by the user into the key-value pair Key-Value.
  • the created singleton operation class PHKeychainManager is used to uniformly manage the input and read of user data.
  • the creation process of the singleton operation class PHKeychainManager is standardized. For example, a global variable can be declared in the class implementation file. Instance, specifies that the unified access function of this class is +sharedManager, and in this letter
  • the encoding unit 50 is configured to encode the Key-Value.
  • the object model in which the Key-Value used to store the user data in the development is an entity data class, such as the entity data class created by the present invention, and inherits from the NSObject class, the entity data class.
  • entity data class such as the entity data class created by the present invention
  • NSObject class the entity data class.
  • the user data is supported by the NSCoding protocol, and the steps of depositing the keychain into the dictionary NSDictionary are prepared.
  • the writing unit 60 is configured to write the constructed dictionary into the Keychain.
  • the singleton operation class PHKeychainManager is called again, and the dictionary NSDictionary storing the user data is written into the Keychain.
  • the present invention can monitor the active state of the application. If the application is detected to be closed, the user data is stored in the dictionary NSDictionary through the singleton operation class PHKeychainManager, and the operation class PHKeychainWrapper is called.
  • the dictionary NSDictionary is saved to the Keychain in time by operating the data interface of the class PHKeychainWrapper. .
  • the decoding unit 70 is configured to decode the Key-Value if receiving an instruction of the user to access the Key-Value.
  • the coding unit 50 specifically includes:
  • the first calling unit 501 is configured to call an encoding function and acquire an encoder.
  • the encoding function is -encodeWithCoder:, and an encoder aCoder is passed when the function is called.
  • the encoding sub-unit 502 is configured to encode the corresponding character string by using the encoder.
  • Each Key-Value in the entity data class is encoded once by the encoder, and for the Key-Value in the entity data class, the encoded property is not supported.
  • the property of the Int type is converted to NSString by the NSString class function + StringWithFormat: Type, and then use the encoder to encode the converted attributes.
  • the decoding unit 70 specifically includes:
  • the second calling unit 701 is configured to call a decoding function and acquire a decoder. Read from Keychain
  • the decoding function is called when the user data is, the decoding function is -initWithCoder:, and the function is called when the function is called.
  • a decoder aDecoder A decoder aDecoder.
  • the decoding subunit 702 is configured to decode the Key-Value by using the decoder.
  • Each Key-Value read in the Keychain is decoded once by the decoder, that is, the user data in each Key-Value is decoded once by the decoder, and decoded into an NSString type, and then converted as needed.
  • the data type corresponding to each user data is assigned to the corresponding object.
  • the terminal 100 further includes:
  • the reading unit 80 is configured to read all user information from the Keychain when the application starts again.
  • the monitoring is set. If the application is enabled again, the PHKeychainManager responds in a single operation, and the operation class PHKeychainWrapper is called to read the Keychain through the data interface of the PHKeychainWrapper.
  • the writing unit 60 specifically includes:
  • the encapsulating unit 601 is configured to encapsulate the keychain and generate a data interface, where the data interface includes a storage data interface, a read data interface, and a delete data interface.
  • the embodiment of the present invention facilitates the developer to pass the singleton operation class by encapsulating a Keychain operation class PHKeychainWrapper.
  • the KeyKeychainManager directly operates the keychain. Specifically, the keychain is encapsulated and three data interfaces are generated. The data interface allows the user to directly operate the keychain. The three data interfaces generated after the keychain is encapsulated are the storage data interface. saveObject: toService: serviceID, read data interface + saveObject: toService: serviceID and delete data interface + deleteKeychainBy:serviceID.
  • the write subunit 602 is configured to write the constructed dictionary into the keychain according to the data interface.
  • the data operation of the keychain is performed by using the single-key operation type PHKeychainManager, and the three data interfaces generated after the keychain is encapsulated can be directly operated, for example, by storing the data interface + saveObject:toService:serviceID Writes the dictionary NSDictionary storing user data to the keychain.
  • the above building unit 10 receiving unit 20, generating unit 30, and encoding unit
  • the processor 40, the setting unit 50, the writing unit 60, the decoding unit 70, etc. may be embedded in or independent of the data processing device in hardware, or may be stored in the memory of the data processing device in software, so that the processor can execute the call.
  • the processor can be a central processing unit (CPU), a microprocessor, a microcontroller, or the like.
  • FIG. 11 is a schematic structural diagram of a data management device according to the present invention. As shown in FIG. 11, it may include: an input device 99, an output device 88, a transceiver device 77, a memory 66, and a processor 55, wherein:
  • the input device 99 is configured to receive user data input by a user through an external access control device.
  • the input device 99 may include a keyboard, a mouse, a photoelectric input device, a sound input device, a touch input device, a scanner, and the like.
  • the output device 88 is configured to output output data of the access control device to the outside.
  • the output device 88 described in the embodiments of the present invention may include a display, a speaker, a printer, and the like.
  • the transceiver device 77 is configured to send data to or receive data from other devices through a communication link.
  • the transceiver device 77 of the embodiment of the present invention may include a transceiver device such as a radio frequency antenna.
  • the memory 66 is configured to store programs and data with various functions.
  • the data stored by the memory 66 in the embodiment of the present invention includes program data that can be called and run.
  • the memory 66 of an embodiment of the present invention may be a system memory such as volatile (such as RAM), non-volatile (such as ROM, flash memory, etc.), or a combination of both.
  • the memory 66 of the embodiment of the present invention may also be an external memory outside the system, such as a magnetic disk, an optical disk, a magnetic tape, or the like.
  • the processor 55 is configured to run a program stored in the memory 66 and perform the following operations:
  • each dictionary corresponding to a plurality of key-value pairs Key-Value, each Key-Value corresponding to one attribute information of the user; receiving user information input by the user, the user information including at least one attribute information; The information generates a corresponding character string; according to the attribute information, the corresponding character string is set as a Key-Value in the dictionary; the Key-Value is encoded; the built dictionary is written into the Keychain; if the user is received The Key-Value instruction is accessed to decode the Key-Value.
  • the encoding the Key-Value includes:
  • the encoding function is called and an encoder is obtained; the Key-Value is encoded by the encoder.
  • the decoding of the Key-Value includes:
  • the decoding function is called and a decoder is obtained; the Key-Value is decoded by the decoder.
  • processor 55 also performs the following operations:
  • writing the dictionary to be built into the keychain includes:
  • the keychain is closed and a data interface is generated.
  • the data interface includes a storage data interface, a read data interface, and a delete data interface. According to the data interface, the constructed dictionary is written into the keychain.
  • the data management device embodiment shown in FIG. 11 does not constitute a limitation on the specific configuration of the data management device.
  • the data management device may include more or less than the illustrated. Parts, or combinations of parts, or different parts.
  • the data management device may include only a memory and a processor. In such an embodiment, the structure and functions of the memory and the processor are the same as those in the embodiment shown in FIG. .
  • the present invention provides a computer readable storage medium having stored one or more programs, the one or more programs being executed by one or more processors to implement the following steps:
  • the user information including at least one attribute information
  • the Key-Value is decoded.
  • step of encoding the Key-Value includes:
  • the Key-Value is encoded by the encoder.
  • step of decoding the Key-Value includes:
  • the Key-Value is decoded using the decoder.
  • steps further include:
  • step of writing the constructed dictionary into the Keychain includes:
  • the constructed dictionary is written into the Keychain.
  • the foregoing storage medium of the present invention includes: a magnetic disk, an optical disk, and a read-only storage memory (Read-Only) Memory, ROM) or random access memory (RAM), etc., which can store various program codes.
  • ROM read-only storage memory
  • RAM random access memory
  • the units in all embodiments of the present invention may be implemented by a general-purpose integrated circuit such as a CPU (Central Processing) Unit, central processing unit, or through ASIC (Application Specific Integrated circuit
  • the units in the terminal in the embodiment of the present invention may be combined, divided, and deleted according to actual needs.

Landscapes

  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Medical Informatics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种基于Keychain的数据管理方法、终端、设备以及计算机可读存储介质。该方法包括:构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息 (S101);接收用户输入的用户信息,所述用户信息包括至少一种属性信息 (S102);将所述用户信息生成相应的字符串 (S103);根据所述属性信息将相应的字符串设置为字典中的Key-Value (S104);对所述Key-Value进行编码 (S105);将构建的字典写入所述Keychain中 (S106);若接收到用户访问Key-Value的指令,对所述Key-Value进行解码 (S107)。上述方法对传统的Keychain进行改进,方便了用户信息的存储和读取。

Description

一种基于Keychain的数据管理方法、终端、设备及计算机可读存储介质
技术领域
本发明涉及计算机技术领域,尤其涉及一种基于Keychain的数据管理方法、终端、设备及计算机可读存储介质。
背景技术
目前市场上的绝大多数应用APP都记录有用户信息,并需要把用户信息保留在终端上,用以实现在一定时间段内免登陆,而且能够迅速展示用户信息的功能。其中,例如金融业领域,用户信息是极度安全敏感的,为了避免水平参差的开发工程师用不安全的方式保存用户信息,以及减少大部分开发工程师重复工作量的目的,需要一种安全方便方法以存储和读取用户信息。
发明内容
有鉴于此,本发明实施例提供一种基于Keychain的数据管理方法、终端、设备及计算机可读存储介质,本发明实施例对传统的Keychain进行改进,方便了用户信息的存储和读取。
一种基于Keychain的数据管理方法,该方法包括:
构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;
接收用户输入的用户信息,所述用户信息包括至少一种属性信息;
将所述用户信息生成相应的字符串;
根据所述属性信息将相应的字符串设置为字典中的Key-Value;
对所述Key-Value进行编码;
将构建的字典写入所述Keychain中;
若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
进一步地,所述对所述Key-Value进行编码包括:
调用编码函数并获取编码器;
利用所述编码器对所述Key-Value进行编码。
进一步地,所述对所述Key-Value进行解码包括:
调用解码函数并获取解码器;
利用所述解码器对所述Key-Value进行解码。
进一步地,所述方法还包括:
若应用再次启用时,从Keychain中读取所有用户信息。
进一步地,所述将构建的字典写入所述Keychain中包括:
对所述Keychain进行封闭并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口;
根据所述数据接口,将构建的字典写入所述Keychain中。
一种终端,该终端包括:
构建单元,用于构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;
接收单元,用于接收用户输入的用户信息,所述用户信息包括至少一种属性信息;
生成单元,用于将所述用户信息生成相应的字符串;
设置单元,用于根据所述属性信息将相应的字符串设置为字典中的Key-Value;
编码单元,用于对所述Key-Value进行编码;
写入单元,用于将构建的字典写入所述Keychain中;
解码单元,用于若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
进一步地,所述编码单元包括:
第一调用单元,用于调用编码函数并获取编码器;
编码子单元,用于利用所述编码器对所述Key-Value进行编码。
进一步地,所述解码单元包括:
第二调用单元,用于调用解码函数并获取解码器;
解码子单元,用于利用所述解码器对所述Key-Value进行解码。
进一步地,所述终端还包括:
读取单元,用于若应用再次启动时,从Keychain中读取所有用户信息。
进一步地,所述写入单元包括:
封装单元,用于对所述Keychain进行封装并生成数据接口,所述数据接口
包括存储数据接口、读取数据接口以及删除数据接口;
写入子单元,用于根据所述数据接口,将构建的字典写入所述Keychain中。
一种数据管理设备,该设备包括:输入装置、输出装置、收发装置、存储器以及处理器;
输入装置,用于接收用户通过外部访问控制设备的输入的用户数据;
输出装置,用于对外输出访问控制设备的输出数据;
收发装置,用于通过通信链路向其他设备发送数据或者从其他设备接收数据;
存储器,用于存储带有各种功能的程序和数据;
处理器,用于运行所述存储器中存储的程序,以执行如下操作:
构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;
接收用户输入的用户信息,所述用户信息包括至少一种属性信息;
将所述用户信息生成相应的字符串;
根据所述属性信息将相应的字符串设置为字典中的Key-Value;
对所述Key-Value进行编码;
将构建的字典写入所述Keychain中;
若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
进一步地,所述对所述Key-Value进行编码包括:
调用编码函数并获取编码器;
利用所述编码器对所述Key-Value进行编码。
进一步地,所述对所述Key-Value进行解码包括:
调用解码函数并获取解码器;
利用所述解码器对所述Key-Value进行解码。
进一步地,所述处理器还执行如下操作:
若应用再次启用时,从Keychain中读取所有用户信息。
进一步地,所述将构建的字典写入所述Keychain中包括:
对所述Keychain进行封闭并生成数据接口,所述数据接口包括存储数据接
口、读取数据接口以及删除数据接口;
根据所述数据接口,将构建的字典写入所述Keychain中。
一种计算机可读存储介质,计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序被一个或者一个以上的处理器执行,以实现以下步骤:
构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;
接收用户输入的用户信息,所述用户信息包括至少一种属性信息;
将所述用户信息生成相应的字符串;
根据所述属性信息将相应的字符串设置为字典中的Key-Value;
对所述Key-Value进行编码;
将构建的字典写入所述Keychain中;
若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
进一步地,所述对所述Key-Value进行编码的步骤包括:
调用编码函数并获取编码器;
利用所述编码器对所述Key-Value进行编码。
进一步地,所述对所述Key-Value进行解码的步骤包括:
调用解码函数并获取解码器;
利用所述解码器对所述Key-Value进行解码。
进一步地,所述步骤还包括
若应用再次启用时,从Keychain中读取所有用户信息。
进一步地,所述将构建的字典写入所述Keychain中的步骤包括:
对所述Keychain进行封装并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口;
根据所述数据接口,将构建的字典写入所述Keychain中。
由上可见,本发明实施例通过构建字典,利用字典中对应的键值对Key-Value
存储用户信息,并将存储有用户信息的字典写入Keychain方便了用户信息的存储,并且在用户信息设置为所述字典中的Key-Value之前,对用户信息进行编码,使得用户信息支持NSCoding协议;在读取Keychain中的用户信息时,对读取的用户信息进行解码并转换成相对应的数据类型,方便对所述用户信息的使用。
附图说明
为了更清楚地说明本发明实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例一提供的一种基于Keychain的数据管理方法的示意流程图。
图2是本发明实施例一提供的一种基于Keychain的数据管理方法的另一示意流程图。
图3是本发明实施例一提供的一种基于Keychain的数据管理方法的另一示意流程图。
图4是本发明实施例一提供的一种基于Keychain的数据管理方法的另一示意流程图。
图5是本发明实施例二提供的一种基于Keychain的数据管理方法的示意流程图。
图6是本发明实施例提供的一种终端的示意性框图。
图7是本发明实施例提供的一种终端的另一示意性框图。
图8是本发明实施例提供的一种终端的另一示意性框图。
图9是本发明实施例提供的一种终端的另一示意性框图。
图10是本发明实施例提供的一种终端的另一示意性框图。
图11是本发明实施例提供的一种数据管理设备的结构组成示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清
楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳
动前提下所获得的所有其他实施例,都属于本发明保护的范围。
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和 “包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在此本发明说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本发明。如在本发明说明书和所附权利要求书中所使
用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。
如图1所示,为本发明实施例一提供的一种基于Keychain的数据管理方法的流程示意图。该方法包括步骤S101~S107。
S101,构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息。在本发明实施例中,Keychain(即钥匙串)是运行在IOS系统上一种存储工具,并能够为系统上的应用提供安全系数较高的数据存储,保证数据的安全性;Keychain可以通过键值对Key-Value的存储方式,将必要的数据进行保存,并且保证该数据不会在一般的文件中被找到或者暴露,亦不会被系统中其他的应用所读取。例如,当用户初次在应用中注册登录时,应用通过构建字典NSDictionary存储用户输入的用户数据,每个字典对应若干键值对Key-Value,其中将用户的账号作为Key,将用户模型作为Value进行存储。
所述属性信息指的是键值对Key-Value中Key与Value的映射关系,在每次
存储一个数据时,是根据Key进行索引存储的;相对应的在用户输入的用户数
据中,例如用户数据为用户帐号和用户模型,则每一个用户帐号均对应一种用户模型,将用户帐号作为Key以及将用户模型作为Value进行存储,在查询用户数据时,通过调用Key便可查询相对应的Value。
S102,接收用户输入的用户信息,所述用户信息包括至少一种属性信息。
S103,将所述用户信息生成相应的字符串。在本发明实施例中,用户输入的用户数据(例如包括用户帐号、用户模型)并不能直接输入键值对Key-Value
中, Key-Value存储的数据类型为字符串类型,需要将用户输入的用户数据转换成Key-Value对应的字符串类型。
S104,根据所述属性信息将相应的字符串设置为字典中的Key-Value。在本发明实施例中,当用户登录应用成功后,创建单例操作类PHKeychainManager将用户输入的用户数据设置为字典中的Key-Value,例如将用户帐号作为Key,与用户帐号相对应的用户模型作为Value,将用户输入的用户帐号和用户模型输入键值对Key-Value。需要说明的是,所创建的单例操作类PHKeychainManager用来统一管理用户数据的输入和读取,单例操作类PHKeychainManager的创建过程为标准化创建,例如,可以在类实现文件中声明一个全局变量_instance,规
定此类的统一访问函数为+sharedManager,并在此函数中判断全局变量_instance是否已经初始化,若是,则返回该变量本身,否则使用函数dispatch_once:,以确保_instance只执行一次初始化,并且覆盖其他可能产生新对象的方法,如+allocWithZone:或者-copyWithZone:等。
S105,对所述Key-Value进行编码。在本发明实施例中,由于在开发中用来存储用户数据的Key-Value所在的对象模型是一个实体数据类,例如本发明自定义创建的实体数据类,且继承自NSObject类,实体数据类可以有多项属性,包含用户帐号、姓名、昵称、年龄、性别、头像或者URL地址等具体信息,但是在最初创建的时候实体数据类并不支持NSCoding协议,因此需要对实体数据类进行编码,使得用户数据支持NSCoding协议,以及为所述字典NSDictionary存入Keychain的步骤做准备。
具体地,如图2所示,步骤S104包括步骤S201~S202。
S201,调用编码函数并获取编码器。所述编码函数为-encodeWithCoder:,调用该函数时会传入一个编码器aCoder。
S202,利用所述编码器对所述Key-Value进行编码。对实体数据类中的每个Key-Value都用编码器编码一次,而对于实体数据类中的Key-Value不支持编码的属性,如Int类型的属性,通过NSString类函数+StringWithFormat:转换成NSString类型,再利用编码器对转换后的属性进行编码。
S106,将构建的字典写入所述Keychain中。在本发明实施例中,在将相应的字符串设置为字典中的Key-Value后,再次调用单例操作类PHKeychainManager,
将存储有用户数据的字典NSDictionary写入Keychain中。此外,在另外一些可行的实施例中,本发明可以通过监听应用的活动状态,若检测到应用被关闭时,通过单例操作类PHKeychainManager将用户数据存入字典NSDictionary中,并调用操作类PHKeychainWrapper,通过操作类PHKeychainWrapper的数据接口及时把字典NSDictionary保存至Keychain中。
具体地,如图3所示,步骤S106包括步骤S301~S302。
S301,对所述Keychain进行封装并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口。本发明实施例通过封装一Keychain操作类PHKeychainWrapper方便开发者通过单例操作类PHKeychainManager直接操作Keychain;具体的,对Keychain进行封装并生成三个数据接口,通过数据接口方便用户对Keychain进行直接操作,对Keychain进行封装后生成的三个数据接口分别为,存储数据接口+ saveObject:toService:serviceID、读取数据接口+saveObject:toService:serviceID以及删除数据接口+ deleteKeychainBy:serviceID。
S302,根据所述数据接口,将构建的字典写入所述Keychain中。本发明实施例通过单例操作类PHKeychainManager对所述Keychain进行数据操作,可以通过对Keychain封装后生成的三个数据接口进行直接操作,例如,可以通过存储数据接口+ saveObject:toService:serviceID将存储有用户数据的字典NSDictionary写入Keychain中,可以通过读取数据接口+saveObject:toService:serviceID读取Keychain并获得用户数据,可以通过删除数据接口+ deleteKeychainBy:serviceID将Keychain中存储的用户数据进行删除,因此,通过操作类PHKeychainWrapper以及生成的数据接口方便统一管理用户数据的存储、读取以及删除等操作。
S107,若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
具体地,如图4所示,步骤S107包括步骤S401~S402。
S401,调用解码函数并获取解码器。从Keychain中读取用户数据时调用解码函数,所述解码函数为-initWithCoder:,调用该函数时会传入一个解码器aDecoder。
S402,利用所述解码器对所述Key-Value进行解码。对从Keychain中读取的每个Key-Value都用解码器解码一次,即将每个Key-Value中的用户数据都用解
码器解码一次,且解码成NSString类型,再根据需要转换成每个用户数据对应的数据类型,并赋值给相应的对象。
由以上可见,本发明实施例通过构建字典,利用字典中对应的键值对Key-Value存储用户信息,并将存储有用户信息的字典写入Keychain方便了用户信息的存储,并且在用户信息设置为所述字典中的Key-Value之前,对用户信息进行编码,使得用户信息支持NSCoding协议;在读取Keychain中的用户信息时,对读取的用户信息进行解码并转换成相对应的数据类型,方便对所述用户
信息的使用。
在本发明一种基于Keychain的数据管理方法的另一个实施例中,如图5所示,为本发明另一实施例提供的流程示图,其包括步骤S501~S508(其中步骤S501~S507与本发明实施例一相同,在此不再详述)。
S501,构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息。
S502,接收用户输入的用户信息,所述用户信息包括至少一种属性信息。
S503,将所述用户信息生成相应的字符串。
S504,根据所述属性信息将相应的字符串设置为字典中的Key-Value。
S505,对所述Key-Value进行编码。
S506,将构建的字典写入所述Keychain中。
S507,若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
S508,若应用再次启用时,从Keychain中读取所有用户信息。本发明实施例在检测到应用再次开启时设置了监听,若检测到应用再次启用时,通过单例操
作类PHKeychainManager及时响应,并调用操作类PHKeychainWrapper,通过操作类PHKeychainWrapper的数据接口读取Keychain中的用户数据。
由以上可见,本发明实施例通过监听应用的状态,可以防止用户数据的丢失。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
如图6所示,对应上述一种基于Keychain的数据管理方法,本发明还提出一
种终端,该终端100包括:构建单元10、接收单元20、生成单元30、编码单元
40、设置单元50、写入单元60、解码单元70。
其中构建单元10,用于构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息。在本发明实施例中,Keychain(即钥匙串)是运行在IOS系统上一种存储工具,并能够为系统上的应用提供安全系数
较高的数据存储,保证数据的安全性;Keychain可以通过键值对Key-Value的存储方式,将必要的数据进行保存,并且保证该数据不会在一般的文件中被找到或者暴露,亦不会被系统中其他的应用所读取。例如,当用户初次在应用中注册登录时,应用通过构建字典NSDictionary存储用户输入的用户数据,每个字典对应若干键值对Key-Value,其中将用户的账号作为Key,将用户模型作为Value进行存储。所述属性信息指的是键值对Key-Value中Key与Value的映射关系,在每次存储一个数据时,是根据Key进行索引存储的;相对应的在用户输入的用户数据中,例如用户数据为用户帐号和用户模型,则每一个用户帐号均对应一种用户模型,将用户帐号作为Key以及将用户模型作为Value进行存储,在查询用户数据时,通过调用Key便可查询相对应的Value。
接收单元20,用于接收用户输入的用户信息,所述用户信息包括至少一种属性信息。
生成单元30,用于将所述用户信息生成相应的字符串。在本发明实施例中,用户输入的用户数据(例如包括用户帐号、用户模型)并不能直接输入键值对Key-Value中, Key-Value存储的数据类型为字符串类型,需要将用户输入的用户数据转换成Key-Value对应的字符串类型。
设置单元40,用于根据所述属性信息将相应的字符串设置为字典中的Key-Value。在本发明实施例中,当用户登录应用成功后,创建单例操作类PHKeychainManager将用户输入的用户数据设置为字典中的Key-Value,例如将用户帐号作为Key,与用户帐号相对应的用户模型作为Value,将用户输入的用户帐号和用户模型输入键值对Key-Value。需要说明的是,所创建的单例操作类PHKeychainManager用来统一管理用户数据的输入和读取,单例操作类PHKeychainManager的创建过程为标准化创建,例如,可以在类实现文件中声明一个全局变量_instance,规定此类的统一访问函数为+sharedManager,并在此函
数中判断全局变量_instance是否已经初始化,若是,则返回该变量本身,否则
使用函数dispatch_once:,以确保_instance只执行一次初始化,并且覆盖其他可能产生新对象的方法,如+allocWithZone:或者-copyWithZone:等。
编码单元50,用于对所述Key-Value进行编码。在本发明实施例中,由于在开发中用来存储用户数据的Key-Value所在的对象模型是一个实体数据类,例如本发明自定义创建的实体数据类,且继承自NSObject类,实体数据类可以有多项属性,包含用户帐号、姓名、昵称、年龄、性别、头像或者URL地址等具体信息,但是在最初创建的时候实体数据类并不支持NSCoding协议,因此需要对实体数据类进行编码,使得用户数据支持NSCoding协议,以及为所述字典NSDictionary存入Keychain的步骤做准备。
写入单元60,用于将构建的字典写入所述Keychain中。在本发明实施例中,在将相应的字符串设置为字典中的Key-Value后,再次调用单例操作类PHKeychainManager,将存储有用户数据的字典NSDictionary写入Keychain中。此外,在另外一些可行的实施例中,本发明可以通过监听应用的活动状态,若检测到应用被关闭时,通过单例操作类PHKeychainManager将用户数据存入字典NSDictionary中,并调用操作类PHKeychainWrapper,通过操作类PHKeychainWrapper的数据接口及时把字典NSDictionary保存至Keychain中。。
解码单元70,用于若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
进一步的,如图7所示,所述编码单元50,具体包括:
第一调用单元501,用于调用编码函数并获取编码器。所述编码函数为-encodeWithCoder:,调用该函数时会传入一个编码器aCoder。
编码子单元502,用于利用所述编码器对相应的字符串进行编码。对实体数据类中的每个Key-Value都用编码器编码一次,而对于实体数据类中的Key-Value不支持编码的属性,如Int类型的属性,通过NSString类函数+StringWithFormat:转换成NSString类型,再利用编码器对转换后的属性进行编码。
进一步的,如图8所示,所述解码单元70,具体包括:
第二调用单元701,用于调用解码函数并获取解码器。从Keychain中读取用
户数据时调用解码函数,所述解码函数为-initWithCoder:,调用该函数时会传入
一个解码器aDecoder。
解码子单元702,用于利用所述解码器对所述Key-Value进行解码。对从
Keychain中读取的每个Key-Value都用解码器解码一次,即将每个Key-Value中的用户数据都用解码器解码一次,且解码成NSString类型,再根据需要转换
成每个用户数据对应的数据类型,并赋值给相应的对象。
进一步的,如图9所示,所述终端100,还包括:
读取单元80,用于若应用再次启动时,从Keychain中读取所有用户信息。
本发明实施例在检测到应用再次开启时设置了监听,若检测到应用再次启用时,通过单例操作类PHKeychainManager及时响应,并调用操作类PHKeychainWrapper,通过操作类PHKeychainWrapper的数据接口读取Keychain
中的用户数据。
进一步的,如图10所示,所述写入单元60,具体包括:
封装单元601,用于对所述Keychain进行封装并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口。本发明实施例通过封装一Keychain操作类PHKeychainWrapper方便开发者通过单例操作类
PHKeychainManager直接操作Keychain;具体的,对Keychain进行封装并生成三个数据接口,通过数据接口方便用户对Keychain进行直接操作,对Keychain进行封装后生成的三个数据接口分别为,存储数据接口+ saveObject:toService:serviceID、读取数据接口+saveObject:toService:serviceID以及删除数据接口+ deleteKeychainBy:serviceID。
写入子单元602,用于根据所述数据接口,将构建的字典写入所述Keychain中。本发明实施例通过单例操作类PHKeychainManager对所述Keychain进行数据操作,可以通过对Keychain封装后生成的三个数据接口进行直接操作,例如,可以通过存储数据接口+ saveObject:toService:serviceID将存储有用户数据的字典NSDictionary写入Keychain中,可以通过读取数据接口+saveObject:toService:serviceID读取Keychain并获得用户数据,可以通过删除数据接口+ deleteKeychainBy:serviceID将Keychain中存储的用户数据进行删除,因此,通过操作类PHKeychainWrapper以及生成的数据接口方便统一管理用户
数据的存储、读取以及删除等操作。
在硬件实现上,以上构建单元10、接收单元20、生成单元30、编码单元
40、设置单元50、写入单元60、解码单元70等可以以硬件形式内嵌于或独立于数据处理装置中,也可以以软件形式存储于数据处理装置的存储器中,以便于处理器调用执行以上各个单元对应的操作。该处理器可以为中央处理单元(CPU)、微处理器、单片机等。
图11为本发明数据管理设备的结构组成示意图。如图11所示,其可包括:输入装置99、输出装置88、收发装置77、存储器66以及处理器55,其中:
所述输入装置99,用于接收用户通过外部访问控制设备输入的用户数据。具体实现中,本发明实施例所述的输入装置99可包括键盘、鼠标、光电输入装置、声音输入装置、触摸式输入装置、扫描仪等。
所述输出装置88,用于对外输出访问控制设备的输出数据。具体实现中,
本发明实施例所述的输出装置88可包括显示器、扬声器、打印机等。
所述收发装置77,用于通过通信链路向其他设备发送数据或者从其他设备接收数据。具体实现中,本发明实施例的收发装置77可包括射频天线等收发器件。
所述存储器66,用于存储带有各种功能的程序和数据。本发明实施例中存储器66存储的数据包括可调用并运行的程序数据。具体实现中,本发明实施例的存储器66可以是系统存储器,比如,挥发性的(诸如RAM),非易失性的(诸如ROM,闪存等),或者两者的结合。具体实现中,本发明实施例的存储器66还可以是系统之外的外部存储器,比如,磁盘、光盘、磁带等。
所述处理器55,用于运行所述存储器66中存储的程序,并执行如下操作:
构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;接收用户输入的用户信息,所述用户信息包括至少一种属性信息;将所述用户信息生成相应的字符串;根据所述属性信息将相应的字符串设置为字典中的Key-Value;对所述Key-Value进行编码;将构建的字典写入所述Keychain中;若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
进一步地,所述对所述Key-Value进行编码包括:
调用编码函数并获取编码器;利用所述编码器对所述Key-Value进行编码。
进一步地,所述对所述Key-Value进行解码包括:
调用解码函数并获取解码器;利用所述解码器对所述Key-Value进行解码。
进一步地,所述处理器55还执行如下操作:
若应用再次启用时,从Keychain中读取所有用户信息。
进一步地,所述将构建的字典写入所述Keychain中包括:
对所述Keychain进行封闭并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口;根据所述数据接口,将构建的字典写入所述Keychain中。
本领域技术人员可以理解,图11中示出的数据管理设备实施例并不构成对数据管理设备具体构成的限定,在其他实施例中,数据管理设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。例如,在一些实施例中,数据管理设备可以仅包括存储器及处理器,在这样的实施例中,存储器及处理器的结构及功能与图11所示实施例一致,在此不再赘述。。
本发明提供了一种计算机可读存储介质,计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序被一个或者一个以上的处理器执行,以实现以下步骤:
构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;
接收用户输入的用户信息,所述用户信息包括至少一种属性信息;
将所述用户信息生成相应的字符串;
根据所述属性信息将相应的字符串设置为字典中的Key-Value;
对所述Key-Value进行编码;
将构建的字典写入所述Keychain中;
若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
进一步地,所述对所述Key-Value进行编码的步骤包括:
调用编码函数并获取编码器;
利用所述编码器对所述Key-Value进行编码。
进一步地,所述对所述Key-Value进行解码的步骤包括:
调用解码函数并获取解码器;
利用所述解码器对所述Key-Value进行解码。
进一步地,所述步骤还包括:
若应用再次启用时,从Keychain中读取所有用户信息。
进一步地,所述将构建的字典写入所述Keychain中的步骤包括:
对所述Keychain进行封装并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口;
根据所述数据接口,将构建的字典写入所述Keychain中。
本发明前述的存储介质包括:磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等各种可以存储程序代码的介质。
本发明所有实施例中的单元可以通过通用集成电路,例如CPU(Central Processing Unit,中央处理器),或通过ASIC (Application Specific Integrated
Circuit,专用集成电路)来实现。
本发明实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。
本发明实施例终端中的单元可以根据实际需要进行合并、划分和删减。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。

Claims (20)

  1. 一种基于Keychain的数据管理方法,其特征在于,所述方法包括:
    构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;
    接收用户输入的用户信息,所述用户信息包括至少一种属性信息;
    将所述用户信息生成相应的字符串;
    根据所述属性信息将相应的字符串设置为字典中的Key-Value;
    对所述Key-Value进行编码;
    将构建的字典写入所述Keychain中;
    若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
  2. 如权利要求1所述的方法,其特征在于,所述对所述Key-Value进行编码包括:
    调用编码函数并获取编码器;
    利用所述编码器对所述Key-Value进行编码。
  3. 如权利要求1所述的方法,其特征在于,所述对所述Key-Value进行解码包括:
    调用解码函数并获取解码器;
    利用所述解码器对所述Key-Value进行解码。
  4. 如权利要求1所述的方法,其特征在于,所述方法还包括:
    若应用再次启用时,从Keychain中读取所有用户信息。
  5. 如权利要求1-4任意一项所述的方法,其特征在于,所述将构建的字典写入所述Keychain中包括:
    对所述Keychain进行封装并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口;
    根据所述数据接口,将构建的字典写入所述Keychain中。
  6. 一种终端,其特征在于,所述终端包括:
    构建单元,用于构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;
    接收单元,用于接收用户输入的用户信息,所述用户信息包括至少一种属
    性信息;
    生成单元,用于将所述用户信息生成相应的字符串;
    设置单元,用于根据所述属性信息将相应的字符串设置为字典中的Key-Value;
    编码单元,用于对所述Key-Value进行编码;
    写入单元,用于将构建的字典写入所述Keychain中;
    解码单元,用于若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
  7. 如权利要求6所述的终端,其特征在于,所述编码单元包括:
    第一调用单元,用于调用编码函数并获取编码器;
    编码子单元,用于利用所述编码器对所述Key-Value进行编码。
  8. 如权利要求6所述的终端,其特征在于,所述解码单元包括:
    第二调用单元,用于调用解码函数并获取解码器;
    解码子单元,用于利用所述解码器对所述Key-Value进行解码。
  9. 如权利要求6所述的终端,其特征在于,所述终端还包括:
    读取单元,用于若应用再次启动时,从Keychain中读取所有用户信息。
  10. 如权利要求6-9任意一项所述的终端,其特征在于,所述写入单元包括:
    封装单元,用于对所述Keychain进行封装并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口;
    写入子单元,用于根据所述数据接口,将构建的字典写入所述Keychain中。
  11. 一种数据管理设备,其特征在于,该设备包括:输入装置、输出装置、收发装置、存储器以及处理器;
    输入装置,用于接收用户通过外部访问控制设备输入的用户数据;
    输出装置,用于对外输出访问控制设备的输出数据;
    收发装置,用于通过通信链路向其他设备发送数据或者从其他设备接收数据;
    存储器,用于存储带有各种功能的程序和数据;
    处理器,用于运行所述存储器中存储的程序,以执行如下操作:
    构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户
    的一种属性信息;
    接收用户输入的用户信息,所述用户信息包括至少一种属性信息;
    将所述用户信息生成相应的字符串;
    根据所述属性信息将相应的字符串设置为字典中的Key-Value;
    对所述Key-Value进行编码;
    将构建的字典写入所述Keychain中;
    若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
  12. 如权利要求11所述的设备,其特征在于,所述对所述Key-Value进行编码包括:
    调用编码函数并获取编码器;
    利用所述编码器对所述Key-Value进行编码。
  13. 如权利要求11所述的设备,其特征在于,所述对所述Key-Value进行解码包括:
    调用解码函数并获取解码器;
    利用所述解码器对所述Key-Value进行解码。
  14. 如权利要求11所述的设备,其特征在于,所述处理器还执行如下操作:
    若应用再次启用时,从Keychain中读取所有用户信息。
  15. 如权利要求11-14任意一项所述的设备,其特征在于,所述将构建的字典写入所述Keychain中包括:
    对所述Keychain进行封闭并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口;
    根据所述数据接口,将构建的字典写入所述Keychain中。
  16. 一种计算机可读存储介质,其特征在于,计算机可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序被一个或者一个以上的处理器执行,以实现以下步骤:
    构建字典,每个字典对应若干键值对Key-Value,每个Key-Value对应用户的一种属性信息;
    接收用户输入的用户信息,所述用户信息包括至少一种属性信息;
    将所述用户信息生成相应的字符串;
    根据所述属性信息将相应的字符串设置为字典中的Key-Value;
    对所述Key-Value进行编码;
    将构建的字典写入所述Keychain中;
    若接收到用户访问Key-Value的指令,对所述Key-Value进行解码。
  17. 如权利要求16所述的计算机可读存储介质,其特征在于,所述对所述Key-Value进行编码的步骤包括:
    调用编码函数并获取编码器;
    利用所述编码器对所述Key-Value进行编码。
  18. 如权利要求16所述的计算机可读存储介质,其特征在于,所述对所述Key-Value进行解码的步骤包括:
    调用解码函数并获取解码器;
    利用所述解码器对所述Key-Value进行解码。
  19. 如权利要求16所述的计算机可读存储介质,其特征在于,所述步骤还包括:
    若应用再次启用时,从Keychain中读取所有用户信息。
  20. 如权利要求16-19任意一项所述的计算机可读存储介质,其特征在于,所述将构建的字典写入所述Keychain中的步骤包括:
    对所述Keychain进行封装并生成数据接口,所述数据接口包括存储数据接口、读取数据接口以及删除数据接口;
    根据所述数据接口,将构建的字典写入所述Keychain中。
PCT/CN2017/076517 2016-11-15 2017-03-14 一种基于Keychain的数据管理方法、终端、设备及计算机可读存储介质 WO2018090508A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611036587.7A CN106778322A (zh) 2016-11-15 2016-11-15 一种基于Keychain的数据管理方法及终端
CN201611036587.7 2016-11-15

Publications (1)

Publication Number Publication Date
WO2018090508A1 true WO2018090508A1 (zh) 2018-05-24

Family

ID=58970358

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/076517 WO2018090508A1 (zh) 2016-11-15 2017-03-14 一种基于Keychain的数据管理方法、终端、设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN106778322A (zh)
WO (1) WO2018090508A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857389A (zh) * 2019-01-14 2019-06-07 平安科技(深圳)有限公司 模型数据生成方法、装置、计算机设备及存储介质
CN112130860A (zh) * 2020-09-23 2020-12-25 北京奇艺世纪科技有限公司 Json对象解析方法、装置、电子设备及存储介质
WO2024001212A1 (zh) * 2022-06-29 2024-01-04 中兴通讯股份有限公司 信息传输方法及装置、存储介质和电子装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102750495A (zh) * 2012-06-07 2012-10-24 北京锐安科技有限公司 iPhone手机加密备份文件的破解及还原系统
CN106066808A (zh) * 2016-05-30 2016-11-02 浪潮软件股份有限公司 一种ios应用构建服务器、集群和方法
CN106096337A (zh) * 2016-06-21 2016-11-09 北京医视时代科技发展有限公司 一种数字出版版权保护的系统和方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101616003B (zh) * 2008-06-25 2012-05-30 鸿富锦精密工业(深圳)有限公司 密码保护系统及方法
US8788842B2 (en) * 2010-04-07 2014-07-22 Apple Inc. System and method for content protection based on a combination of a user PIN and a device specific identifier

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102750495A (zh) * 2012-06-07 2012-10-24 北京锐安科技有限公司 iPhone手机加密备份文件的破解及还原系统
CN106066808A (zh) * 2016-05-30 2016-11-02 浪潮软件股份有限公司 一种ios应用构建服务器、集群和方法
CN106096337A (zh) * 2016-06-21 2016-11-09 北京医视时代科技发展有限公司 一种数字出版版权保护的系统和方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
TIAN ZHAOYANG ET AL.: "Developing iOS Client Based on API for MOE.FM", COMPUTER APPLICATION AND SOFTWARE, vol. 32, no. 3, 31 March 2015 (2015-03-31) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857389A (zh) * 2019-01-14 2019-06-07 平安科技(深圳)有限公司 模型数据生成方法、装置、计算机设备及存储介质
CN109857389B (zh) * 2019-01-14 2022-08-12 平安科技(深圳)有限公司 模型数据生成方法、装置、计算机设备及存储介质
CN112130860A (zh) * 2020-09-23 2020-12-25 北京奇艺世纪科技有限公司 Json对象解析方法、装置、电子设备及存储介质
CN112130860B (zh) * 2020-09-23 2023-09-05 北京奇艺世纪科技有限公司 Json对象解析方法、装置、电子设备及存储介质
WO2024001212A1 (zh) * 2022-06-29 2024-01-04 中兴通讯股份有限公司 信息传输方法及装置、存储介质和电子装置

Also Published As

Publication number Publication date
CN106778322A (zh) 2017-05-31

Similar Documents

Publication Publication Date Title
WO2019051908A1 (zh) 终端控制方法、装置及计算机可读存储介质
WO2019019340A1 (zh) 应用程序页面打开方法、装置、终端及可读存储介质
WO2019056752A1 (zh) 家电设备的配网方法、装置、系统及计算机可读存储介质
WO2018090508A1 (zh) 一种基于Keychain的数据管理方法、终端、设备及计算机可读存储介质
WO2019051944A1 (zh) 一种进程保护方法、装置、设备以及计算机可读存储介质
WO2019037319A1 (zh) 电量预警方法、服务器、移动终端及存储介质
WO2019019376A1 (zh) 业务流程管理方法、装置、设备及计算机可读存储介质
WO2018086294A1 (zh) 应用软件安全漏洞检测方法、系统、设备及存储介质
WO2019019378A1 (zh) 业务处理方法、装置、适配器及计算机可读存储介质
WO2019019374A1 (zh) 智能语音设备控制家电的方法、装置及系统
WO2019051890A1 (zh) 终端控制方法、装置及计算机可读存储介质
WO2018166107A1 (zh) 基于Hybrid的兼容方法、适配件、运行装置、系统以及计算机可读存储介质
WO2017119611A1 (en) Ear wearable type wireless device and system supporting the same
WO2019051895A1 (zh) 终端控制方法、装置及存储介质
WO2019051942A1 (zh) 一种任务分配方法、终端及计算机可读存储介质
WO2018176864A1 (zh) 数据库权限管理方法、系统、设备和计算机可读存储介质
WO2014030946A1 (en) Device and method for sharing content using the same
WO2015139639A1 (en) Method and apparatus for displaying application icons on terminal
WO2015127859A1 (en) Sensitive text detecting method and apparatus
WO2016133338A1 (en) Electronic device and method for installing an application
WO2015158133A1 (zh) 语音控制指令纠错方法和系统
WO2019051899A1 (zh) 终端控制方法、装置及存储介质
WO2012055343A1 (zh) 一种.net程序加密后的执行方法
WO2017105092A1 (en) Electronic device including shield structure
WO2018120457A1 (zh) 数据处理方法、装置、设备及计算机可读存储介质

Legal Events

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

Ref document number: 17872629

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 11/09/2019)

122 Ep: pct application non-entry in european phase

Ref document number: 17872629

Country of ref document: EP

Kind code of ref document: A1