Make getPrivKey return nil if the private key is not found

It still returns an error if the addr manager is locked or something like
that.

Also replaces some panics with proper errors.

I've started writing a test to getPrivKey() but it was not easy and there's
that issue I emailed you about, wrt what package to put our whitebox tests on,
so I'll send a separate PR with the test.
nitpick: it's a type assertion and not a cast.