The present invention relates to an implementing method for increasing a number of certificates supported by a PIV application and an apparatus therefor, which belongs to information security technology field.
In prior art, a default number of certificates supported by a PIV application is 4, if the number of the certificates is more than 4, an extra driver is needed to be installed on a host computer, while the extra installed driver may lead to compatibility problem and occupies resource of the host computer, which caused that the operating process becomes more complicated.
The object of the present disclosure is to provide an implementing method for increasing a number of certificates supported by a PIV application and an apparatus therefor, which breaks number limit of certificates supported by the PIV application and simplifies relevant operating as well.
According to one aspect of the present disclosure, there is provided an implementing method for increasing a number of certificates supported by a PIV application, which includes the following steps:
According to a second aspect of the present disclosure, there is provided an apparatus for increasing a number of certificates supported by a PIV application, which includes at least one processor, a storage and at least one processor executable instruction stored in the storage, the at least one processor executes a computer executable instruction to implement the method described above.
According to a third aspect of the present disclosure, there is provided a computer readable storage medium. The computer readable storage medium includes a computer program, when the computer program runs on an apparatus for increasing a number of certificates supported by a PIV application, the apparatus for increasing a number of certificates supported by a PIV application executes the method described above.
According to a fourth aspect of the present disclosure, there is provided a chip. The chip is coupled to the storage and is configured to execute a computer program stored in the storage to implement the method described above.
According to the present invention, there is provided an implementing method for increasing a number of certificates supported by a PIV application, the method requires no extra driver installed and breaks number limit of those certificates supported by the PIV application, and simplifies relevant operating as well.
The technical solutions in the embodiments of the present disclosure will be clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present disclosure. It is obvious that the described embodiments are only a part of the embodiments of the present disclosure, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without inventive efforts are within the scope of the present invention.
Embodiment 1 provides an implementing method for increasing a number of certificates supported by a PIV application. As shown in
The method further includes: when a USB interruption triggering happens, a USB interruption process is performed. As shown in
In Embodiment 1, in Step 103, after setting data endpoint address to be endpoint address of the first CCID interface, the method further includes: closing a delay timer of the first CCID interface.
In Step 108, after setting the data endpoint address to be endpoint address of the second CCID interface, the method further includes: closing a delay timer of the second CCID interface.
In Step 10A, after the virtual machine stores instruction data of the APDU instruction in the cache of the first CCID interface, the method further includes: activating the delay timer of the first CCID interface, sending a delay request to the host computer via the first CCID interface according to time of the delay timer of the first CCID interface at a regular preset time interval.
In Step 20A, after the virtual machine stores instruction data of the APDU instruction in the cache of the second CCID interface, the method further includes: activating the delay timer of the first CCID interface, sending a delay request to the host computer via the second CCID interface according to time of the delay timer of the second CCID interface at a regular preset time interval.
In Embodiment 1, Step 10A specifically is: the virtual machine of the key device determines whether the first CCID interface receives an APDU instruction used for PIV application authentication, if yes, the virtual machine of the key device stores instruction data of the APDU instruction used for PIV application authentication in the cache of the first CCID interface, if no, execute Step 20A.
Step 20A specifically is: the virtual machine of the key device determines whether the second CCID interface receives an APDU instruction used for PIV application authentication, if yes, the virtual machine of the key device stores instruction data of the APDU instruction used for PIV application authentication in the cache of the second CCID interface, if no, go back to Step 10A.
In Embodiment 1, before Step 101, the method further includes a process for loading a certificate, which includes the following steps:
Step 01, the virtual machine of the key device receives a certificate importing instruction sent from the host computer, sends instruction data of the certificate importing instruction to the PIV application of the key device;
Step 02, the PIV application of the key device sets a PIV certification number of an imported certificate according to value of a preset byte in the instruction data of the certificate importing instruction.
In Embodiment 1, before Step 101, the method further includes a process for loading a certificate, which includes the following steps:
In Embodiment 1, Step 101 specifically is: the virtual machine of the key device powers up, declares HID interface, a first CCID interface and a second CCID interface to the host computer.
After Step 102, the method further includes: the virtual machine determines whether the HID interface has instruction data, if yes, execute Step m1; if no, execute Step 103;
In USB interruption process, before Step 10A, the process further includes:
In Step 20A, if no, going back to Step 10A specifically is: if no, ending the USB interruption process.
In Embodiment 1, Step m2 specifically is: the virtual machine determines type of the instruction data, when the instruction data is MSG data, execute Step m3, when the instruction data is CBOR data, the virtual machine fills CBOR data to obtain extension APDU data, sends the extension APDU data to the FIDO application; when the instruction data is INIT data, the virtual machine performs operation on the INIT data to obtain an operating result, execute Step m5.
Embodiment 2 provides an implementing method for increasing a number of certificates supported by a PIV application. As shown in
In Embodiment 2, the virtual machine of the key device organizes the response for the configuration descriptor obtaining instruction according to number of interfaces and interface configuration descriptors, for example, the response for the configuration descriptor obtaining instruction is:
In this case, 02 of 09 02 C3 00 02 01 00 80 14 represents that the number of interfaces is 2;
Step 204, the virtual machine of the key device declares a first CCID interface and a second CCID interface to the host computer;
Step 205, the virtual machine of the key device waits for receiving an instruction sent from the host computer;
Step 206, the virtual machine of the key device determines whether instruction data is in cache of the first CCID interface, if yes, sets data endpoint address to be endpoint value of the first CCID interface, execute Step 207, if no, execute Step 212.
Specifically, in Step 206, when the virtual machine of the key device determines that instruction data is in the cache of the first CCID interface, the virtual machine of the key device records the g_in_ep_addr of the data endpoint address as IN endpoint value of the first CCID interface and records the g_out_ep_addr of the data endpoint address as OUT endpoint value of the first CCID interface, execute Step 207.
Step 207, the virtual machine of the key device closes a delay timer of the first CCID interface;
Step 208, the virtual machine of the key device acquires APDU data used for PIV application authentication according to the instruction data and sends the APDU data used for PIV application authentication to the PIV application of the key device.
In Embodiment 2, the virtual machine of the key device extracts CCID protocol head from the instruction data to obtain the APDU data used for PIV application authentication. For example, the key device extracts CCID head, i.e. 6f 10 00 00 00 00 58 00 00 00 from the instruction data, i.e. 6f 10 00 00 00 00 58 00 00 00 00 87 07 9a 0b 9b 1a 3e ea 16 af 0f a7 cf 9e 6c, to obtain APDU data, i.e. 00 87 07 9a 0b 9b 1a 3e ea 16 af 0f a7 cf 9e 6c.
The virtual machine of the key device sends the APDU data used for PIV application authentication to PIV application of the key device;
Step 209, the PIV application of the key device invokes API interface to obtain a CCID interface number.
Specifically, in Step 209, the PIV application of the key device invokes APDU.getProtocol( ) interface, determines CCID interface number according to result of invoking APDU.getProtocol( ) interface.
For example, in Embodiment 2, if the result of invoking APDU.getProtocol( ) interface is 0xA0, the CCID interface number is determined to be number of the first CCID interface, i.e. 01; if the result of invoking APDU.getProtocol( ) interface is 0xA1, the CCID interface number is determined to be number of the second CCID interface, i.e. 02.
Step 210, the PIV application of the key device acquires PIV device certificate number according to the CCID interface number and a general certificate number in the APDU data used for PIV application authentication, acquires PIV certificate according to the PIV device certificate number and acquires an operating result according to the PIV certificate.
In Step 210, acquiring an operating result according to the PIV certificate can be: performing signing according to key assorted with the PIV certificate to obtain an operating result of signing.
In Embodiment 2, before executing Step 201, the method further includes a process for loading a certificate, which includes the following steps:
Step a2 specifically is: the PIV application of the key device acquires value of a preset byte of the instruction data of the certificate importing instruction, sets PIV certificate number of the imported certificate according to a first preset corresponding relation and the value of the preset byte.
For example, in Embodiment 2, in Step a1, the virtual machine of the key device receives a certificate importing instruction sent from the host computer, i.e. 6f04010000002300000010db3fffff5c035fc1055382061870820603082060b308204f3a00302 01020213210000037df1a74983916c36e00030000037d300d06092a864886f70d01010b050 0304631133011060a0992268993f22c6401191603434f4d311a3018060a0992268993f22c64 0119160a49414d51413356495341,
In Step a2, the PIV application of the key device acquires the value, i.e. c105, of the sixth byte and the tenth byte of the instruction data, sets the PIV device certificate number, i.e. 9a, of the imported certificate according to the first preset corresponding relation and value, i.e. c105, of the preset byte.
Specifically, the first preset corresponding relation is: corresponding relation between the value of the preset byte and the PIV device certificate number; the specific corresponding relation is:
For example, a first value of the preset byte, i.e. c105, corresponds to a first PIV device certificate number, i.e. 9a;
In Embodiment 2, a process for loading the certificate before Step 201 can be implemented by the following steps:
For example, in Embodiment 2, in Step a1, the virtual machine of key device receives the certificate importing instruction sent from the host computer, i.e. 6f040100000023 00000010db3fffff5c035fc105538206187082060t3082060b308204f3a003020102021321000 0037df1a74983916c3f6e00030000037d300d06092a864886f70d01010b0500304631133011 060a0992268993f22c6401191603434f4d311a3018060a0992268993f22c640119160a49414 d51413356495341,
Step b2, the PIV application of the key device acquires CCID interface number of the certificate importing instruction, sets PIV device certificate number of the imported certificate according to a value of a preset byte in the instruction data of the certificate importing instruction and the acquired interface number.
In Embodiment 2, Step b2 specifically is: the PIV application of the key device invokes API function to acquire the CCID interface number of the certificate importing instruction, sets the PIV device certificate number of the imported certificate according to the a value of a preset byte in the instruction data of the certificate importing instruction and the acquired interface number in accordance with a second preset corresponding relation.
In Step b2, the PIV application of the key device invokes APDU.getProtocol( ) interface to obtain an invoking result, acquires the CCID interface number of the certificate importing instruction according to the invoking result.
For example, in Step b2, the PIV application of the key device invokes APDU.getProtocol( ) interface, if result of invoking the interface is 0xA0, it means that the CCID interface number is the first CCID interface number, i.e. 01; if the result of invoking the interface is 0xA1, it means that the CCID interface number is the second CCID interface number, i.e. 02.
Specifically, the second preset corresponding relation is: the corresponding relation among a value of a preset byte, a CCID interface number of the certificate importing instruction and a PIV device certificate number.
In Embodiment 2, a value of a preset byte is corresponding to a value corresponding to a general device certificate number; a general device certificate number is a PIV application general device certificate number.
Specifically, the second preset corresponding relation is:
For example, a first value of the preset byte, i.e. c105, and the first CCID interface number of the certificate importing instruction, i.e. 01, correspond to a first PIV device certificate number, i.e. 9a;
In this case, the first value c105 corresponds to the first general device certificate number 9a;
For example, in Step b2, the PIV application of the key device invokes APDU.getProtocol( ) interface, if the result of invoking interface is 0xA1, it means that the CCID interface number is the number of the second CCID interface, i.e. 02; based on the second preset corresponding relation, the PIV device certificate number of the imported certificate is set to be 9f according to the value of the preset byte, i.e. c105 in the instruction data of the certificate importing instruction and the acquired interface number 02.
In Embodiment 2, for example, the PIV application of the key device loads 6 certificates, the PIV device certificate numbers are: 9a, 9c, 9d, 9f, 91 and 92.
In Embodiment 2, the PIV application of the key device presets a corresponding relation between a PIV device certificate number and its corresponding CCID interface number and general certificate number;
Specifically, for example, the corresponding relation between the PIV device certificate number and its corresponding CCID interface number and the general certificate number is:
In Embodiment 2, in Step 209, the PIV application of the key device invokes APDU.getProtocol( ) interface, if the result of invoking the interface is 0xA0, it means that the CCID interface number is the first CCID interface number, i.e. 01.
Step 209 specifically is: the PIV application of the key device acquires the general device certificate number, i.e. 9a, according to the fourth byte of the APDU data, then determines that the PIV device certificate number is 9a according to the general device certificate 9a and the interface number 01 acquired in Step 209, acquires PIV certificate according to the PIV device certificate number 9a, acquires an operating result according to the PIV certificate.
For example, in Embodiment 2, in Step 209, the PIV application of the key device invokes APDU.getProtocol( ) interface, if the result of invoking the interface is 0xA1, it means that the CCID interface number is the number of the second CCID interface, i.e. 02.
The PIV application of the key device acquires the general device certificate number, i.e. 9a, according to the fourth byte of the APDU data, then determines that the PIV device certificate number is 9f according to the general device certificate number 9a and the interface number 02 acquired in Step 209, acquires PIV certificate according to the PIV device certificate number 9f, performs operation according to the PIV certificate to acquire an operating result.
Step 211, the virtual machine of the key device returns an operating result to the host computer according to data endpoint address, go back to Step 206.
In Embodiment 2, Step 211 specifically is:
Step 212, the virtual machine of the key device determines whether instruction data is in cache of the second CCID interface, if yes, set the data endpoint address to be endpoint value of the second CCID interface, execute Step 213, if no, go back to Step 206.
Specifically, in Step 212, when the virtual machine of the key device determines that instruction data is in the cache of the second CCID interface, the virtual machine of the key device records g_in_ep_addr of the data endpoint address as IN endpoint value of the second CCID interface and records g_out_ep_addr of the data endpoint address as OUT endpoint value of the second CCID interface, execute Step 214;
Step 213, the virtual machine of the key device closes a delay timer of the second CCID interface, execute Step 208.
In Embodiment 2, the method further includes: when a USB interruption is triggered, a USB interruption process is executed. As shown in
In Embodiment 2, the virtual machine of the key device determines type of the instruction received by the first CCID interface according to an instruction type identification; for example, the instruction sent from the host computer received by the first CCID interface of the virtual machine of the key device is: 6f 10 00 00 00 00 58 00 00 00 00 87 07 9a 0b 9b 1a 3e ea 16 af 0f a7 cf 9e 6c, the type of the instruction is determined to be APDU instruction according the instruction type identification 6f; the APDU instruction is determined to be PIV application authentication instruction according to the twelfth byte 87.
Step A3, the virtual machine of the key device stores the APDU instruction data in cache of the first CCID interface.
In Step 213, for example, the virtual machine of the key device stores the instruction data of the PIV application authentication instruction in cache of the first CCID interface.
Step A4, the virtual machine of the key device activates the delay timer of the first CCID interface;
Step A5, the virtual machine of the key device determines whether the second CCID interface receives an instruction, if yes, execute Step A6, if no, go back to Step A1;
Step A6, the virtual machine of the key device determines type of the instruction received by the second CCID interface, if the instruction is non-APDU instruction, the virtual machine of the key device returns a response for non-APDU instruction to the host computer via the second CCID interface, go back to Step A1, if the instruction is APDU instruction, then execute Step A7.
In Embodiment 2, the virtual machine of the key device determines type of the instruction received by the first CCID interface according to an instruction identification, for example, the virtual machine of the key device determines that the instruction sent from the host computer received by the second CCID interface is: 6f 10 00 00 00 00 58 00 00 00 00 87 07 9a 0b 9b 1a 3e ea 16 af 0f a7 cf 9e 6c, determines that the type of the instruction is APDU instruction according to the instruction type identification 6f; the APDU instruction is determined to be PIV application authentication instruction according to the twelfth byte 87.
Step A7, the virtual machine of the key device stores the APDU instruction data in the cache of the second CCID interface.
Specifically, in Step A6, the virtual machine of the key device stores the instruction data of the PV application authentication instruction in the second CCID interface cache.
Step A8, the virtual machine of the key device activates the delay timer of the second CCID interface.
In Embodiment 2, after the virtual machine of the key device activates the first CCID interface timer, the method further includes: the virtual machine of the key device sends a delay request to the host computer at a preset time interval regularly according to the timing of the delay timer of the first CCID interface;
Embodiment 3 provides an implementing method for increasing a number of certificates supported by a PIV application. As Shown in
In the present embodiment 3, before executing Step 301, the method further includes a process for loading a certificate, the process of loading certificate is the same as the process of loading certificate described in Embodiment 2; no more detail is given here.
In Embodiment 3, for example, the PIV application of the key device has loaded 6 certificate.
In Embodiment 3, the PIV application of the key device preset corresponding relation among the PIV device certification number and its corresponded CCID interface number and general certificate number;
Step 312, the virtual machine of the key device determines interface type according to the USB interface type identification, uses the operating result to organizes response data according to the interface type;
Step 313, the virtual machine of the key device returns the response data to the host computer according to the data endpoint address, go back to Step 206;
Step 314, the virtual machine of the key device determines whether instruction data is in cache of the second CCID interface, if yes, set the data endpoint address to be endpoint value of the second CCID interface, set usb_type to be CCID interface, execute Step 315, if no, go back to Step 307;
Step 315, the virtual machine of the key device closes a delay timer of the second CCID interface;
Step 316, the virtual machine of the key device determines whether the type of data received by the HID interface is APDU instruction according to instruction type identification, if yes, execute Step 317; if no, execute Step 320 after the virtual machine processes the instruction;
Step 317, the virtual machine of the key device sends the APDU to FIDO application;
Step 318, the FIDO application of the key device processes the APDU data to obtain an operating result;
Step 319, the virtual machine of the key device acquires the interface type and an interface number according to the USB interface type identification, organizes response data according to the interface type;
Step 320, the virtual machine of the key device acquires the data endpoint address of the interface according to the interface number and returns the response data to the host computer, go back to Step 305. a
In Embodiment 3, the method further includes: when a USB interruption is triggered, execute a USB interruption process. As shown in
Preferably, Embodiment 3 of the present disclosure further provides an apparatus of increasing a number of certificates supported by a PIV application. The apparatus includes at least one processor, a storage and at least one processor executable instruction stored in the storage, the at least one processor executes the computer executable instruction to implement the method of Embodiment 3. When the apparatus is a chip system, the apparatus may be constituted by a chip, or include a chip and other separated elements, which is not limited by Embodiment 3; the chip is coupled to the storage and is configured to execute computer program stored in the storage to implement the method of managing mnemonic word disclosed in Embodiment 3.
The Embodiment 3 described above may be implemented by using software, hardware, firmware, or any combination thereof. When a software program is used to implement the Embodiment 3, the Embodiment 3 may be implemented completely or partially in a form of a computer program product. The computer program product includes one or more computer program instructions. When the computer program instructions are loaded and executed on a computer, the procedures or functions according to the Embodiment 3 of this application are all or partially generated. The computer instructions may be stored in a computer-readable storage medium or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a base station, apparatus, server, or data center to another base station, apparatus, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or DSL) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible by a computer, or a data storage device, such as a server or a data center, integrating one or more usable media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, an SSD), or the like.
Although the application is described with reference to the embodiments, in a procedure of implementing the application that claims protection, one of ordinary skill in the art may understand and implement another variation of the disclosed embodiments by viewing the accompanying drawings, disclosed content, and the appended claims. In the claims, “comprise” (comprising) does not exclude another component or another operation, and “a” or “one” does not exclude a case of plurality. A single processor or another unit may implement several functions enumerated in the claims. Some measures are recorded in dependent claims that are different from each other, but this does not mean that these measures cannot be combined to produce a great effect.
It should be understood that various changes and modifications to the presently preferred embodiments disclosed herein will be apparent to those skilled in the art. Such changes and modifications can be made without departing from the spirit and scope of the inventive subject matter and without diminishing its intended advantages. It is therefore intended that such changes and modifications be covered by the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
202110769859.9 | Jul 2021 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2022/100353 | 6/22/2022 | WO |