With regards to the original problem of a short serial number
being the issue, the problem may be that some code is comparing
the MAX_CONTAINER_NAME_LEN as binary and not as a string.
We may have in OpenSC some field that is not initialized to null,
foe example the WCHAR wszGuid [MAX_CONTAINER_NAME_LEN + 1];
and this may be the problem.

Can you try and make sure this is initialized before the call?

On 12/8/2011 2:13 AM, Hunter William wrote:
>> -----Original Message-----
>> From: Douglas E. Engert [mailto:deeng...@anl.gov]
>> Sent: 08 December 2011 00:41
>>
>>> I did notice this - however, I also noticed that the piv_get_guid
>> routine returns values which
>>> are in a different format to the normal routine - it returns e.g.
>> "1A2B3C....." while the
>>> standard routine returns {1A2B3C......-....-....-.....}. Is this
>> correct? Surely the serialize
>>> routine should also be called for the card specific routines?
>>
>> I do not think that this is required. I have not looked at the code for
>> sometime, but I recall that the GUID is a string, and no checks are
>> done
>> to see if is required to be formatted as a GUID.
>>
>> The name having "Guid" in it may have been a bad choice for the
>> variable name.
>>
>> The minidriver actually converts the guid string + null to a wide
>> string.
>>    mbstowcs(p->wszGuid, guid, MAX_CONTAINER_NAME_LEN + 1);
>>
>> And the Microsoft CNG cardmod.h has:
>>    #define MAX_CONTAINER_NAME_LEN                  39
>> and
>>    WCHAR wszGuid [MAX_CONTAINER_NAME_LEN + 1];
>>
>> 32 hex characters for a GUID + { - - - - } is 38 characters, not 39.
>>
>> The Microsoft certutil when it prints the Microsoft created
>> key container created by the Microsoft PIV driver prints it as:
>>
>>    Key Container = c97a8e6b-d21d-b211-b719-00144f5fc105
>> Note no {} around it, but it does look like a GUID. But from my
>> note:
>>    http://www.opensc-project.org/pipermail/opensc-devel/2011-
>> January/015770.html
>> I see how it derived it from data on the card.
>>
>> A Microsoft auto enroll certificate in the keystore as a long Key
>> Container name:
>> Key Container = 544c7d4fa0af9d9dafcd2f27ab3af6e2_b892da20-6957-4560-
>> 86fc-63ef6c415dff
>>
>> certutil -verbose -store My
>> can show a lot of stuff.
>>
>> On an original Microsoft smart card there may have been a GUID, but it
>> looks lilke it is really just a string.
>>
>> I think it is just a string, and if a card driver created the string,
>> it
>> should be left as is.
>>
>
> Ok, that makes sense. I now see in some Microsoft documentation they even
> just use something like "MyKeys", so it does seem like GUID is just an
> unfortunate choice of names!
>
> Thanks,
> Will
>
>

-- 

  Douglas E. Engert  <deeng...@anl.gov>
  Argonne National Laboratory
  9700 South Cass Avenue
  Argonne, Illinois  60439
  (630) 252-5444
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to