supremainc / BioStar2_device_SDK

35 stars 25 forks source link

How to write alphanumeric id on card #22

Open JBoerrigter opened 2 years ago

JBoerrigter commented 2 years ago

I tried to use the same logic the example provides and switched the numeric id to an alphanumeric id using the UTF8 Encoding to convert the string to an byte-array.

Examplecode:

BS2SmartCardData smartCard = Util.AllocateStructure<BS2SmartCardData>();
 smartCard.header.cardType = (byte)BS2CardTypeEnum.ACCESS;
 smartCard.header.numOfTemplate = 0; // fingerprint
 smartCard.header.numOfFaceTemplate = 1;
 smartCard.header.templateSize = BS2Environment.BS2_FACE_EX_TEMPLATE_SIZE;
 smartCard.header.cardAuthModeEx = (byte)BS2ExtCardAuthModeEnum.EXT_CARD_FACE;
 smartCard.header.useAlphanumericID = 1;

 cardIDArray = Encoding.UTF8.GetBytes(cardIdString); 
 Array.Clear(smartCard.cardID, 0, BS2Environment.BS2_CARD_DATA_SIZE);
 for (int idx = 0; idx < cardIDArray.Length; ++idx)
 {
     smartCard.cardID[BS2Environment.BS2_CARD_DATA_SIZE - idx - 1] = cardIDArray[idx];
 }

Writing the card results with the status "1" (BS_SDK_SUCCESS).

When i now want to authenticate with this card, the device respond with "Access Denied" instantly. (Using a numeric id works fine)

Any suggestions?

darktall99 commented 2 years ago

Hello. This is Mark in charge of SDK Technical support. I'll get back to you soon with RND Team's feedback

darktall99 commented 2 years ago

what version of the SDK do you use?