uFCoder 2.62
Loading...
Searching...
No Matches
PKI infrastructure and digital signature support

Functions

UFR_STATUS DL_API JCAppGenerateSignatureM (UFR_HANDLE hndUFR, 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)
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppGetObjIdM (UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *id, VAR uint16_t *id_size)
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppGetObjM (UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *obj, int16_t size)
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppGetObjSubjectM (UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, OUT uint8_t *subject, VAR uint16_t *size)
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppInvalidateCertM (UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index)
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppPutObjM (UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *obj, int16_t obj_size, IN uint8_t *id, uint8_t id_size)
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppPutObjSubjectM (UFR_HANDLE hndUFR, uint8_t obj_type, uint8_t obj_index, IN uint8_t *subject, uint8_t size)
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppPutPrivateKeyM (UFR_HANDLE hndUFR, 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)
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppSelectByAidM (UFR_HANDLE hndUFR, IN const uint8_t *aid, uint8_t aid_len, OUT uint8_t selection_response[16])
 Multi reader support. 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.
 
UFR_STATUS DL_API JCAppSignatureBeginM (UFR_HANDLE hndUFR, 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)
 Multi reader support. 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".
 
UFR_STATUS DL_API JCAppSignatureEndM (UFR_HANDLE hndUFR, VAR uint16_t *sig_len)
 Multi reader support. 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".
 
UFR_STATUS DL_API JCAppSignatureUpdateM (UFR_HANDLE hndUFR, IN const uint8_t *chunk, uint16_t chunk_len)
 Multi reader support. 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".
 

Detailed Description

Function Documentation

◆ JCAppGenerateSignatureM()

UFR_STATUS DL_API JCAppGenerateSignatureM ( UFR_HANDLE hndUFR,
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 )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
cipher0 for the RSA private key and 1 for the ECDSA.
digest0 for none digest (not supported with ECDSA) and 1 for SHA1
padding0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme.
key_indexFor each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2.
plain_dataPointer to array containing data for signing.
plain_data_lenLength of the data for signing (max. 255).
sig_lenPointer to a 16-bit value in which you will get the length of the signature in case of successful execution.
alg_paramReserved for future use (RFU). Use null for this parameter.
alg_parm_lenReserved for future use (RFU). Use 0 for this parameter.
Returns
Operation status

◆ JCAppGetObjIdM()

UFR_STATUS DL_API JCAppGetObjIdM ( UFR_HANDLE hndUFR,
uint8_t obj_type,
uint8_t obj_index,
OUT uint8_t * id,
VAR uint16_t * id_size )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
obj_type0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority).
obj_indexFor 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.
idWhen id == NULL, the function returns id_size.
id_sizeBefore second call, *id_size should be set to a value of the exact bytes allocated.
Returns
Operation status

◆ JCAppGetObjM()

UFR_STATUS DL_API JCAppGetObjM ( UFR_HANDLE hndUFR,
uint8_t obj_type,
uint8_t obj_index,
OUT uint8_t * obj,
int16_t size )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
obj_type0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority).
obj_indexFor 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.
objWhen obj == NULL, function returns size
sizeBefore second call, *size should be set to a value of the exact bytes allocated.
Returns
Operation status

◆ JCAppGetObjSubjectM()

UFR_STATUS DL_API JCAppGetObjSubjectM ( UFR_HANDLE hndUFR,
uint8_t obj_type,
uint8_t obj_index,
OUT uint8_t * subject,
VAR uint16_t * size )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
obj_type0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority).
obj_indexFor 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.
subjectWhen subject == NULL, function returns size.
sizeBefore second call, *size should be set to a value of the exact bytes allocated.
Returns
Operation status

◆ JCAppInvalidateCertM()

UFR_STATUS DL_API JCAppInvalidateCertM ( UFR_HANDLE hndUFR,
uint8_t obj_type,
uint8_t obj_index )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
obj_type0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority).
obj_indexFor 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.
Returns
Operation status

◆ JCAppPutObjM()

UFR_STATUS DL_API JCAppPutObjM ( UFR_HANDLE hndUFR,
uint8_t obj_type,
uint8_t obj_index,
IN uint8_t * obj,
int16_t obj_size,
IN uint8_t * id,
uint8_t id_size )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
obj_type0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority).
obj_indexFor 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.
objPointer to an array containing an object (certificate).
obj_sizeLength of the object (certificate).
idPointer to an array containing object id. Object id is a symbolic value and has to be unique on the card.
id_sizeLength of the object id. Minimum object id length can be 1 and maximum 253.
Returns
Operation status

◆ JCAppPutObjSubjectM()

UFR_STATUS DL_API JCAppPutObjSubjectM ( UFR_HANDLE hndUFR,
uint8_t obj_type,
uint8_t obj_index,
IN uint8_t * subject,
uint8_t size )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
obj_type0 for certificate containing RSA public key, 1 for certificate containing ECDSA public key and 2 for the CA (certificate authority).
obj_indexFor 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.
subjectPointer to an array containing subject. Subject is a symbolic value linked to an appropriate certificate by the same obj_type and index.
sizeLength of the subject. Maximum subject length is 255.
Returns
Operation status

◆ JCAppPutPrivateKeyM()

UFR_STATUS DL_API JCAppPutPrivateKeyM ( UFR_HANDLE hndUFR,
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 )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
key_type0 for RSA private key and 1 for ECDSA private key.
key_indexFor each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2.
keyPointer to array containing key bytes.
key_bit_lenKey length in bits.
key_paramReserved for future use (RFU). Use null for this parameter.
key_parm_lenReserved for future use (RFU). Use 0 for this parameter.
Returns
Operation status

◆ JCAppSelectByAidM()

UFR_STATUS DL_API JCAppSelectByAidM ( UFR_HANDLE hndUFR,
IN const uint8_t * aid,
uint8_t aid_len,
OUT uint8_t selection_response[16] )

Multi reader support. 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.

Parameters
hndUFRhandle of the uFR device
aidPointer 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_lenLength of the AID in bytes (9 for the DLSigner or DLStorage JCApps).
selection_responseOn 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.
Returns
Operation status

◆ JCAppSignatureBeginM()

UFR_STATUS DL_API JCAppSignatureBeginM ( UFR_HANDLE hndUFR,
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 )

Multi reader support. 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".

Parameters
hndUFRhandle of the uFR device
cipher0 for the RSA private key and 1 for the ECDSA.
digest0 for none digest (not supported with ECDSA) and 1 for SHA1
padding0 for none (not supported with RSA) and 1 for pads the digest according to the PKCS#1 (v1.5) scheme.
key_indexFor each of the card types there are 3 different private keys that you can set. Their indexes are from 0 to 2.
chunkPointer to array containing first chunk of data.
chunk_lenLength of the first chunk of data (max. 255).
alg_paramReserved for future use (RFU). Use null for this parameter.
alg_parm_lenReserved for future use (RFU). Use 0 for this parameter.
Returns
Operation status

◆ JCAppSignatureEndM()

UFR_STATUS DL_API JCAppSignatureEndM ( UFR_HANDLE hndUFR,
VAR uint16_t * sig_len )

Multi reader support. 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".

Parameters
hndUFRhandle of the uFR device
sig_lenPointer 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.
Returns
Operation status

◆ JCAppSignatureUpdateM()

UFR_STATUS DL_API JCAppSignatureUpdateM ( UFR_HANDLE hndUFR,
IN const uint8_t * chunk,
uint16_t chunk_len )

Multi reader support. 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".

Parameters
hndUFRhandle of the uFR device
chunkPointer to an array containing one of the chunks of data.
chunk_lenLength of the current one of the remaining chunks of data (max. 255).
Returns
Operation status