uFCoder 2.58
|
Functions | |
UFR_STATUS DL_API | JCAppSelectByAid (IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16]) |
UFR_STATUS DL_API | JCAppPutPrivateKey (uint8_t key_type, uint8_t key_index, IN const uint8_t *key, uint16_t key_bit_len, const IN uint8_t *key_param, uint16_t key_parm_len) |
UFR_STATUS DL_API | JCAppSignatureBegin (uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *chunk, uint16_t chunk_len, IN const uint8_t *alg_param, uint16_t alg_parm_len) |
UFR_STATUS DL_API | JCAppSignatureUpdate (IN const uint8_t *chunk, uint16_t chunk_len) |
UFR_STATUS DL_API | JCAppSignatureEnd (VAR uint16_t *sig_len) |
UFR_STATUS DL_API | JCAppGenerateSignature (uint8_t cipher, uint8_t digest, uint8_t padding, uint8_t key_index, IN const uint8_t *plain_data, uint16_t plain_data_len, VAR uint16_t *sig_len, IN const uint8_t *alg_param, uint16_t alg_parm_len) |
UFR_STATUS DL_API | JCAppGetSignature (OUT uint8_t *sig, uint16_t sig_len) |
UFR_STATUS DL_API | JCAppPutObj (uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, uint8_t id_size) |
UFR_STATUS DL_API | JCAppPutObjSubject (uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size) |
UFR_STATUS DL_API | JCAppInvalidateCert (uint8_t obj_type, uint8_t obj_index) |
UFR_STATUS DL_API | JCAppGetObjId (uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size) |
UFR_STATUS DL_API | JCAppGetObjSubject (uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size) |
UFR_STATUS DL_API | JCAppGetObj (uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size) |
UFR_STATUS DL_API JCAppSelectByAid | ( | IN const uint8_t * | aid, |
uint8_t | aid_len, | ||
OUT uint8_t | selection_response[16] ) |
Using this function you can select the appropriate application on the card. For the DLSigner JCApp AID should be 'F0 44 4C 6F 67 69 63 00 01'. For the DLStorage JCApp AID should be 'F0 44 4C 6F 67 69 63 01 01'. Before calling this function, the NFC tag must be in ISO 14443-4 mode. For entering ISO 14443-4 mode use the SetISO14443_4_Mode() or SetISO14443_4_Mode_GetATS() function.
aid | Pointer to array containing AID (Application ID) i.e: "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01" for the DLSigner or "\xF0\x44\x4C\x6F\x67\x69\x63\x01\x01" for the DLStorage JCApp. |
aid_len | Length of the AID in bytes (9 for the DLSigner or DLStorage JCApps). |
selection_response | On Application successful selection, the card returns 16 bytes. In the current version only the first of those bytes (i.e. byte with index 0) is relevant and contains JCApp card type which is 0xA0 for actual revision. |
UFR_STATUS DL_API JCAppPutPrivateKey | ( | uint8_t | key_type, |
uint8_t | key_index, | ||
IN const uint8_t * | key, | ||
uint16_t | key_bit_len, | ||
const IN uint8_t * | key_param, | ||
uint16_t | key_parm_len ) |
In JCApp cards you can put two types of asymmetric crypto keys. Those are RSA and ECDSA private keys, three of each. Before you can use a JCApp card for digital signing you have to put an appropriate private key in it. There is no way to read out private keys from the card. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". This feature is disabled in the regular DLSigner JCApp. To acquire cards with this feature enabled you have to contact your supplier with a special request. Prior to calling this function you have to be logged in with an SO PIN code.
key_type | 0 for RSA private key and 1 for ECDSA private key. |
key_index | For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. |
key | Pointer to array containing key bytes. |
key_bit_len | Key length in bits. |
key_param | Reserved for future use (RFU). Use null for this parameter. |
key_parm_len | Reserved for future use (RFU). Use 0 for this parameter. |
UFR_STATUS DL_API JCAppSignatureBegin | ( | uint8_t | cipher, |
uint8_t | digest, | ||
uint8_t | padding, | ||
uint8_t | key_index, | ||
IN const uint8_t * | chunk, | ||
uint16_t | chunk_len, | ||
IN const uint8_t * | alg_param, | ||
uint16_t | alg_parm_len ) |
Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01".
cipher | 0 for the RSA private key and 1 for the ECDSA. |
digest | 0 for none digest (not supported with ECDSA) and 1 for SHA1 |
padding | 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. |
key_index | For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. |
chunk | Pointer to array containing first chunk of data. |
chunk_len | Length of the first chunk of data (max. 255). |
alg_param | Reserved for future use (RFU). Use null for this parameter. |
alg_parm_len | Reserved for future use (RFU). Use 0 for this parameter. |
UFR_STATUS DL_API JCAppSignatureUpdate | ( | IN const uint8_t * | chunk, |
uint16_t | chunk_len ) |
Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01".
chunk | Pointer to an array containing one of the chunks of data. |
chunk_len | Length of the current one of the remaining chunks of data (max. 255). |
UFR_STATUS DL_API JCAppSignatureEnd | ( | VAR uint16_t * | sig_len | ) |
Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01".
sig_len | Pointer to a 16-bit value in which you will get length of the signature in case of a successful executed chain of function calls, described in the introduction of this topic. |
UFR_STATUS DL_API JCAppGenerateSignature | ( | uint8_t | cipher, |
uint8_t | digest, | ||
uint8_t | padding, | ||
uint8_t | key_index, | ||
IN const uint8_t * | plain_data, | ||
uint16_t | plain_data_len, | ||
VAR uint16_t * | sig_len, | ||
IN const uint8_t * | alg_param, | ||
uint16_t | alg_parm_len ) |
This function virtually combines three successive calls of functions JCAppSignatureBegin(), JCAppSignatureUpdate() and JCAppSignatureEnd() and can be used in case your data for signing have 255 bytes or less. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". Prior to calling this function you have to be logged in with a User PIN code.
cipher | 0 for the RSA private key and 1 for the ECDSA. |
digest | 0 for none digest (not supported with ECDSA) and 1 for SHA1 |
padding | 0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme. |
key_index | For each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2. |
plain_data | Pointer to array containing data for signing. |
plain_data_len | Length of the data for signing (max. 255). |
sig_len | Pointer to a 16-bit value in which you will get the length of the signature in case of successful execution. |
alg_param | Reserved for future use (RFU). Use null for this parameter. |
alg_parm_len | Reserved for future use (RFU). Use 0 for this parameter. |
UFR_STATUS DL_API JCAppGetSignature | ( | OUT uint8_t * | sig, |
uint16_t | sig_len ) |
Finally, to get a signature, you have to call JCAppGetSignature(). Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". Prior calling of this function you have to be logged in with an User PIN code.
sig | Pointer to an array of “sig_len” bytes length. Value of the “sig_len” you've got as a parameter of the JCAppSignatureEnd() or JCAppGenerateSignature() functions. You have to allocate those bytes before calling this function. |
sig_len | Length of the allocated bytes in a sig array. |
UFR_STATUS DL_API JCAppPutObj | ( | uint8_t | obj_type, |
uint8_t | obj_index, | ||
IN uint8_t * | obj, | ||
int16_t | obj_size, | ||
IN uint8_t * | id, | ||
uint8_t | id_size ) |
Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". Prior to calling this function you have to be logged in with an SO PIN code.
obj_type | 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). |
obj_index | For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. |
obj | Pointer to an array containing an object (certificate). |
obj_size | Length of the object (certificate). |
id | Pointer to an array containing object id. Object id is a symbolic value and has to be unique on the card. |
id_size | Length of the object id. Minimum object id length can be 1 and maximum 253. |
UFR_STATUS DL_API JCAppPutObjSubject | ( | uint8_t | obj_type, |
uint8_t | obj_index, | ||
IN uint8_t * | subject, | ||
uint8_t | size ) |
Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". Prior to calling of this function you have to be logged in with an SO PIN code.
obj_type | 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). |
obj_index | For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. |
subject | Pointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index. |
size | Length of the subject. Maximum subject length is 255. |
UFR_STATUS DL_API JCAppInvalidateCert | ( | uint8_t | obj_type, |
uint8_t | obj_index ) |
Using this function you can delete certificate objects from a card. This includes subjects linked to a certificate. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". Prior to calling this function you have to be logged in with an SO PIN code.
obj_type | 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). |
obj_index | For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. |
UFR_STATUS DL_API JCAppGetObjId | ( | uint8_t | obj_type, |
uint8_t | obj_index, | ||
OUT uint8_t * | id, | ||
VAR uint16_t * | id_size ) |
This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". This function does not require to be logged in with any of the PIN codes.
obj_type | 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). |
obj_index | For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. |
id | When id == NULL, the function returns id_size. |
id_size | Before second call, *id_size should be set to a value of the exact bytes allocated. |
UFR_STATUS DL_API JCAppGetObjSubject | ( | uint8_t | obj_type, |
uint8_t | obj_index, | ||
OUT uint8_t * | subject, | ||
VAR uint16_t * | size ) |
This function you always have to call 2 times. Before the first call you have to set the parameter subject to null and you will get the size of the obj_type at obj_index. Before the second call you have to allocate an array of returned size bytes and pass that array using parameter subject. Before second call, *size should be set to a value of the exact bytes allocated. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". This function does not require to be logged in with any of the PIN codes.
obj_type | 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). |
obj_index | For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. |
subject | When subject == NULL, function returns size. |
size | Before second call, *size should be set to a value of the exact bytes allocated. |
UFR_STATUS DL_API JCAppGetObj | ( | uint8_t | obj_type, |
uint8_t | obj_index, | ||
OUT uint8_t * | obj, | ||
int16_t | size ) |
This function you always have to call 2 times. Before the first call you have to set parameter id to null and you will get the id_size of the obj_type at obj_index. Before the second call you have to allocate an array of the returned id_size bytes and pass that array using parameter id. Before second call, *id_size should be set to a value of the exact bytes allocated. Before calling this function, NFC tag must be in ISO 14443-4 mode and JCApp should be selected using JCAppSelectByAid() with AID = "\xF0\x44\x4C\x6F\x67\x69\x63\x00\x01". This function does not require to be logged in with any of the PIN codes.
obj_type | 0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority). |
obj_index | For each of the certificates containing RSA or ECDSA public keys there are 3 different corresponding private keys that should be set before placing the certificates themselves. Their indexes are from 0 to 2. For CA there are 12 memory slots so their indexes can be from 0 to 11. |
obj | When obj == NULL, function returns size. |
size | Before second call, *size should be set to a value of the exact bytes allocated. |