Extracted Certificate functions from WriteGabbi

They don't belong there, created a new class to manage certificates.