MacOS – Decrypting Login Keychain encrypted with smartcard

authenticationkeychainmacos

I set up login with smartcard (actually a yubikey, but over
PKCS#11/PIV).

I restarted and logged in with my smartcard+pin instead
of with my password, and I was prompted to give my old password to
update my keychain. I foolishly entered my current password
confusedly.

I then rebooted again and was asked for my current keychain password
as it wasn't the password I entered on boot (apparently). I tried both
my current and previous passwords and neither work. I suspect it's
been set to something based on my smartcard encrypting something, but
I have no idea what and can't find it online.

Not only do I not have access to my keychain now, but I'm constantly
prompted for my keychain password.

Suggestions as to how to figure out my current keychain password? or
to induce logging in with smartcard/PIN instead of password so it
magically works?

Best Answer

If you performed your initial login and profile setup using your "smartcard" then your login keychain password will be your PIN.

If you find this is not the case (& no passwords you enter work either), you may just have to trash your login keychain by deleting the login.keychain & login.keychain-db files from ~/Library/Keychains, restarting, logging in again with your "smartcard" & PIN to create a new login keychain, the password for which will then be the same as your PIN.