r509 is a ruby library that allows you to create/parse CSRs, issue certs off arbitrary CAs, parse certs, create CRLs, run an OCSP responder, and much more