Improved performance by adding more constraints whehn performing lookups

This helps because we have to do a lot less parsing of certificates
when looking up certificates for Trusted Anchors, CmsRecipients,
and CmsSigners.

Also optimized private key lookups when decrypting.