Various adjustments to the key and certificate handling code.