Move CMS signing code out of the algorithms and into CMS