Properly handle EC keys in certificates

Fixes issue #17