# US 2016/0253525 A1 · Implementation method for driving of software and hardware supporting opensc

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2016/0253525 A1
- Document ID: US20160253525A1
- Status: Published application
- Kind: A1
- Application number: 15/029,989
- Filed: 2014-09-18
- Published: 2016-09-01
- Earliest claimed: 2013-10-29
- Assignees: Feitian Technologies Co., Ltd.
- Applicants: Feitian Technologies Co., Ltd.
- Inventors: Zhou LU; Huazhang YU
- Web page: https://patentgrep.com/patent/US20160253525A1

## CPC

- G06F 21/77: in smart cards
- G06F 21/34: involving the use of external additional devices, e.g. dongles or smart cards
- G06F 21/6218: {to a system of files or objects, e.g. local or distributed file system or database}
- G06F 21/64: Protecting data integrity, e.g. using checksums, certificates or signatures
- H04L 63/0823: {using certificates (cryptographic mechanisms or cryptographic arrangements for entity authentication involving certificates H04L9/3263)}
- G06F 2221/2107: File encryption
- H04L 63/0853: {using an additional device, e.g. smartcard, SIM or a different communication terminal (cryptographic mechanisms or cryptographic arrangements for entity authentication involving additional secure or trusted devices H04L9/3234)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

Disclosed is an implementation method for driving of software and hardware supporting OpenSC. The method is implemented by middleware invoking an interface function, and comprises invocation of a function for initializing an interface, invocation of functions for establishing an encrypted communications environment, selecting a file interface, and selecting a file to operate, invocation of a function for setting a safe environment interface, and invocation of functions for building an APDU for setting a safe environment and setting a safe environment and a signature interface by sending the APDU, and building of a signed APDU and execution, by sending the APDU, of a signature operation on an original text to be signed.

## Claims

### Claim 1

A method for implementing software and hardware drive supporting OpenSC, which is implemented by invoking an interface function by a middleware, comprising:
building a cipher data communication environment according to a communication key type of a card, setting a key digit number supported by the card and returning an initialized result in a case that an initializing interface function is invoked;
performing an operation of selecting a file according to attribution of a first structure in the selecting a file interface function, returning a result of the operation of the selecting the file;
returning the result of the operation of the selecting the file in a case that a selecting a file interface function is invoked, wherein the result of the operation of the selecting the file contains file controlling information in a case that the operation of the selecting the file is successful;
obtaining key file attribution of file controlling information according to a second parameter of the setting a security environment interface function, building an Application Protocol Data Unit (APDU) for setting a security environment by using the key file attribution, setting the security environment by transmitting the APDU for setting the security environment and returning a setting result in a case that a setting a security environment interface function is invoked;
obtaining original data to be signed and a length of the original data to be signed according to a second parameter and a third parameter of the signature interface function, using the original data to be signed and the length of the original data to be signed to build signed APDU, performing signature operation on the original data to be signed by transmitting the a signed APDU and returning a result of a signature operation, wherein the result of the signature operation containing a signature value in a case that the signature operation is successful in a case that a signature interface function is invoked.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
invoking a corresponding card operating function to perform a corresponding operation on the card according to a second parameter of the card operating interface function in a case that a card operating interface function is invoked, wherein the corresponding operating function comprises:
clearing data and a file structure in the card by invoking a clearing a card interface function in a case that a value of the second parameter of the card operating interface function is a first value;
invoking a writing a key interface function to write a key in the card in a case that the value of the second parameter of the card operating interface function is a second value;
invoking a generating a key pair interface function to generate a key pair in the card in a case that the value of the second parameter of the card operating interface function is a third value.

### Claim 3 (depends on 2)

The method of claim 2, wherein, in the case that the clearing a card interface function is invoked, an operation of selecting a master file (MF) in the card is performed, a deleting an in-card file interface function is invoked to delete the master file.

### Claim 4 (depends on 1)

The method of claim 1, the method further comprising:
in a case that the deleting an in-card file interface function is invoked, the following steps are performed:
step 1 of selecting a file by invoking the selecting a file interface function according to a second parameter of the deleting an in-card file interface function and obtaining the file controlling information; and
step 2 of building an APDU for deleting a file according to the obtained file controlling information and deleting the file by transmitting the APDU for deleting a file.

### Claim 5 (depends on 2)

The method of claim 2, wherein in a case that the writing a key interface function is invoked, the following steps are performed:
step 1 of initializing information related to a key and a length of a key modular of the writing a key interface function according to a third parameter of the writing a key interface function;
step 2 of creating a private key file object in a memory of a computer, obtaining information related to the private key file object and creating a private key file in the card;
step 3 of setting a private key ID and the key modular length; and
step 4 of writing a private key in the card and releasing the private key file object created in the memory.

### Claim 6 (depends on 2)

The method of claim 2, wherein in a case that the generating a key pair interface function is invoked, the following steps are performed:
step 1 of initializing related information and a key modular length of a key of the generating a key pair interface function according to a third parameter of the generating a key pair interface function;
step 2 of creating a private key file object in a memory of a computer, obtaining related information of the private key file object and creating a private key file in the card;
step 3 of creating a public key file object in the memory of the computer, obtaining related information of the public key file object and creating a public key file in the card;
step 4 of setting a public key ID and a private key ID and the key modular length; and
step 5 of generating a key pair and releasing the public key file object and the private key file object which are created in the memory.

### Claim 7 (depends on 5)

The method of claim 5, wherein the private key file object is created by invoking a newly creating a file interface function; the related information of the private key file object is obtained according to a fifth parameter of the newly creating a file interface function.

### Claim 8 (depends on 1)

The method of claim 1, wherein the operation of performing selecting a file according to attribution of the first structure in the selecting a file interface function comprises: in a case that type attribution of the first structure is a second preset value, length attribution of the first structure is 2 and a first byte of file ID attribution of the first structure is a fourth preset value, a pseudo file controlling information is built as an operation result of the selecting a file.

### Claim 9 (depends on 8)

The method of claim 8, wherein the second preset value is SC_PATH_TYPE_DF_NAME and the fourth preset value is 0x29.

### Claim 10 (depends on 1)

The method of claim 1, further comprising:
in a case that the newly creating a file interface function is invoked, the following steps are performed:
step 1 of obtaining related information of the file from a configuration file according to a second parameter of the newly creating a file interface function; and
step 2 of creating a file in the card by invoking the creating a file interface function according to the obtained related information of the file;
in a case that a newly creating a standard file interface function is invoked, the following steps are performed:
step 1 of obtaining information related to a standard file from a configuration file according to a second parameter of the newly creating a standard file interface function; and
step 2 of creating a standard file in the card by invoking the creating a file interface function according to the information related to the standard file.

### Claim 11 (depends on 1)

The method of claim 1, further comprising:
in a case that a creating a file interface function is invoked, the following steps are performed:
step 1 of building file controlling information; and
step 2 of building APDU for creating a file according to the file controlling information and creating a file by transmitting the APDU for creating a file.

### Claim 12 (depends on 1)

The method of claim 1, further comprising:
in a case that a creating a PIN code interface function is invoked, the following steps are performed:
step 1 of defining and initializing a PIN code object;
step 2 of obtaining the PIN code object according to a first parameter of a writing a key interface function and invoking the writing a key interface function to write a secret file in the card; and
step 3 of buffering the PIN code object in the memory.

### Claim 13 (depends on 1)

The method of claim 1, wherein in a case that the interface function is invoked, the method further comprises:
locating a card which will perform a specific operation according to a parameter, in the interface function, wherein the card is an external incoming parameter; and
checking context environment attribution of the card.

### Claim 14 (depends on 10)

The method of claim 10, further comprising:
in a case that the creating a file interface function is invoked, the following steps are performed:
step 1 of building file controlling information; and
step 2 of building the APDU for creating a file according to the file controlling information and creating the file by transmitting the APDU for creating a file.

### Claim 15 (depends on 3)

The method of claim 3, further comprising:
in a case that a deleting an in-card file interface function is invoked, the following steps are performed:
step 1 of selecting a file by invoking the selecting a file interface function according to a second parameter of the deleting an in-card file interface function and obtaining file controlling information; and
step 2 of building an APDU for deleting a file according to the obtained file controlling information and deleting the file by transmitting the APDU for deleting a file.

### Claim 16 (depends on 6)

The method of claim 6, wherein the private key file object is created by invoking the newly creating a file interface function, the related information of the private key file object is obtained according to a fifth parameter of the newly creating a file interface function.
