bungeemonkee / Configgy

A simple, powerful, extensible, testable .NET configuration library.
MIT License
41 stars 4 forks source link

Smart Card? #33

Open wjdavis5 opened 6 years ago

wjdavis5 commented 6 years ago

Trying to run test in VS2017 and it keeps asking me to connect a smart card. Any idea what that's about? Looks like its the Encrypt_With_No_Private_Key_Then_Decrypt_Throws_InvalidOperationException test method

I couldnt even cancel the test. Had to plug in my yubikey and input my pin for this to go away.

image

bungeemonkee commented 6 years ago

I cant reproduce this. But here's my guess: In order to work anywhere those encryption tests try to find any certificate on the system with both a public and private key that they can access given their current running permissions. They do this by iterating through all the certificate repositories they can access. I'd bet that at some point there was something attached to your system that created a certificate repository which I don't have for this smart card and trying to access it is causing windows to prompt you to re-attach that device. Have you ever had something like a YubiKey or an encrypted usb drive or something attached that wasn't when you ran these tests?

If I'm right there might be a way to have the test ignore that certificate repository so the window doesn't popup. But without being able to reproduce it myself and debug through the test I can't figure out how.

wjdavis5 commented 6 years ago

Hey, I absolutely use a YubiKey (for work) and a CAC (for military) in my machine. So what you're saying makes sense. It probably would be a good idea to not have tests pick up those sources though.

bungeemonkee commented 6 years ago

So I've looked into this and I don't see a way via those APIs to know that a cert is from an external device that might trigger that popup and thus avoid it. There are probably other solutions involving bundling on or more certs sufficient for testing with the tests themselves but I haven't really had time to investigate that yet. For now I'll leave this open and unresolved.