Merge pull request #2100 from alex/x509-cleanup

Shift around the x509 code, all the extensions are going to have the same thing