Overview
If you want to write the template(Access on Card) with BioStar 2 Device SDK, one of the ways is that use Suprema device for scanning fingerprint and use Suprema device or DE-620 for issuing the card.
If you want to use DE-620, you will need the Dual-i SDK. Please contact Dual-i and request to download the SDK package. (https://www.duali.com/en/product/reader/desktop-reader/de-620--de-620r/) If you are using BioStar 2, you can connect the DE-620. Article: [FAQs] Using DE-620 with Suprema Integration Options
Some customers have asked that they can't write data to smart cards despite successfully integrating the SDK.
This article provides a guide on how to issue AoC cards, complete with sample code.
Tips for writing Smart Card
Reference SDK Version: Ver.2.9.9
If you're unfamiliar with AoC and SCC as used in Suprema, please refer to the article below first and then read this again.
Article: [BioStar 2] Issuing Smart Card / Access On Card & Secure Credential Card
To issue a Smart Card, use the BS2_WriteCard API and populate the BS2SmartCardData structure with the required data.
When issuing Smart Cards, there are differences in the data configuration for AoC cards and SCC cards.
In case of Secure Credential Card(SCC), users need to have card information which includes Card ID(24byte), issueCount(4byte) and TimeStamp(4byte). Also, cardObjs array of BS2UserBlob structure should be filled for SCC cards and the user should be updated after SCC issuing.
Starting with Device SDK 2.9.9, sample code has been added to demonstrate how data should be configured for AoC and SCC. Please check the "writeCard" feature example in the CardControl project within BSDemo.
1. How to calculate CRC(hdrCRC, cardCRC)
The crc (hdrCRC, cardCRC) portion of the Access on Card data must exactly match the calculated value for the card to be recognized as an Access on Card. Please note that CRC should be calculated based on valid data only. For example, even if you assigned the maximum size for template data(384*2 bytes), this doesn't mean that you need to calculate 384*2 always.
Please see if your CRC checksum(BS2_ComputeCRC16CCITT) is correct. You can see the sample code for CRC calculation in the "CardControl.cs"
2. Information of CIS
5. Secure Credential Card(SC card) needs to specify BS2CSNCard.data correctly.
In the case of Secure Credential Card(SCC), users need to have card information which includes Card ID(24byte), issueCount(4byte) and TimeStamp(4byte). Also, cardObjs array of BS2UserBlob structure should be filled for SCC cards and the user should be updated after SCC issuing.
The sample code below is an excerpt provided to aid in understanding the data structure. To grasp the entire process, please refer to the full SDK sample code. BioStar 2 Device SDK GitHub: https://github.com/supremainc/BioStar2_device_SDK/releases
[Smart Card: Secure Card]
if ((BS2CardTypeEnum)smartCard.header.cardType == BS2CardTypeEnum.SECURE)
{
//issue count
UInt32 issueCount = smartCard.header.issueCount;
byte[] issueBytes = BitConverter.GetBytes(issueCount);
if (!BitConverter.IsLittleEndian) Array.Reverse(issueBytes);
offset = BS2Environment.BS2_CARD_DATA_SIZE - 8;
Array.Copy(issueBytes, 0, smartCard.cardID, offset, 4);
//timestamp
UInt32 timestamp = Convert.ToUInt32(Util.ConvertToUnixTimestamp(DateTime.Now));
byte[] stampBytes = BitConverter.GetBytes(timestamp);
if (!BitConverter.IsLittleEndian) Array.Reverse(stampBytes);
offset = BS2Environment.BS2_CARD_DATA_SIZE - 4;
Array.Copy(stampBytes, 0, smartCard.cardID, offset, 4);
}[Smart Card: Access on Card]
if ((BS2CardTypeEnum)smartCard.header.cardType == BS2CardTypeEnum.ACCESS)
{
Console.WriteLine("Enter the ID of the access group which you want to add: [ID_1,ID_2 ...]");
Console.Write(">>>> ");
char[] delimiterChars = { ' ', ',', '.', ':', '\t' };
string[] accessGroupIDs = Console.ReadLine().Split(delimiterChars);
int idx = 0;
Array.Clear(smartCard.accessOnData.accessGroupID, 0, BS2Environment.BS2_SMART_CARD_MAX_ACCESS_GROUP_COUNT);
foreach (string accessGroupID in accessGroupIDs)
{
if (accessGroupID.Length > 0)
{
UInt16 item;
if (UInt16.TryParse(accessGroupID, out item))
{
smartCard.accessOnData.accessGroupID[idx++] = item;
if (idx >= BS2Environment.BS2_SMART_CARD_MAX_ACCESS_GROUP_COUNT)
{
break;
}
}
}
}6. Fingerprint Template or Face Template
Based on Smartcard structure, template data is stored in BS2SmartCardCredentials.
You can store either fingerprint or face template. Both fingerprint and face templates can not be stored together.
Thus, you have to set numOfFacetemplate = 0 if you want to store fingerprint template data. (If you only wnat to store face, please set numOfTemplate =0)
Fingerprint templates and face templates can be extracted through the device.
(If using a device with Visual Face, template extraction is possible using images only.)