Extracted a method to simplify the mess of repetative code.

The interface offered by the JCA makes me jump through a bunch of
hoops to get the right kind of secret key. I created a new private
function PBESecretKeySpec() to hold all the messy type conversion
code. Now it reads better.