OK, I've now got this working (for me) using the GUI to generate certificates, and then loading them onto the yubikey.
The downside is that the private part of the key is generated by windows (not the yubikey), but I'm willing to accept that as a trade off at the moment.
The process is to create a duplicate of the Smarcard User template, changing (for a 2012R2 CA):
- General: 'Template display name:' to something sensible
- Cryptography: 'Minimum key size' to 2048 (1024 would probably be OK, but I prefer to go higher...)
- Issuance Requirements:
- This number of authorized signatures: 1
- Policy type required in signature: Application Policy
- Application policy: Certificate Request Agent
Once you have told the CA to issue certificates of this type, you can then use the 'enroll on behalf of' within the Windows certificate authority application (if you have the appropriate rights - ).
Right click on 'Personal->Certificates' under certmgr, and then choose 'All Tasks' => 'Advanced Operations' => 'Enroll On Behalf Of'. Choose your enrolling certificate at the next stage, and then choose the template you created above. Pick the use for whom this certificate is being created, and then hit next. This will create a certificate (stored within your store) that you can then upload to the yubikey neo.
Click on 'Personal -> Certificates', and right click on the generated certificate, choosing 'All Tasks -> Export'. Follow through, choosing 'Yes, export the private key' on the first page, and PKCS#12 with all options ticked on the next page. On the next page choose a password that you can type easily, and then choose where the file should be saved, and click finish.
Now, using the generated file run:
yubico-piv-tool.exe -s 9a -i <filename> -K PKCS12 -p <password> -a set-chuid -a import-key -a import-certficate
Finally, delete that file - and this should be working. This does not cover changing the management key or other information on the yubikey - that's left as an exercise for the reader.
Apologies if this is a duplicate of information elsewhere, I couldn't find it when I was looking originally.
One thing I will add - this can all be done via a VM - you do NOT need to have the utilities/etc running locally - and indeed, I've done this with my local machine (the one with the yubico plugged in) not actually a member of the test domain I was working on.