Hello Sam_LI_2024,
Thank you for posting in Microsoft Community forum.
How did you enroll certificate for the smart card template?
Did you enroll it manually via MMC.exe?
Did you enroll this certificate using the Windows AD CS server?
It may be the issue with the subject name in the certificate template. You can try to change the subject name in the certificate template and check if it helps.
Here is a similar thread with the same error message "The file name is too long. 0x8007006f (WIN32/HTTP: 111 ERROR_BUFFER_OVERFLOW)" for your reference.
I hope the information above is helpful.
If you have any question or concern, please feel free to let us know.
Best Regards,
Daisy Zhou