     logger.info 'Client certificate created'
   catch err
     utils.logAndSetResponse this, 'internal server error', "Could not create a client cert via the API: #{err}", 'error'
+  this.body
 
 generateServerCert = (options) ->
   keystoreDoc = yield Keystore.findOne().exec()

  promises.push deferred.promise
  Q.denodeify pem.createCertificate options, (err, cert) ->
    if (err)
      console.log err
      response =
        err : err
      deferred.resolve()

  options = this.request.body
  if options.type is 'server'
    logger.info 'Generating server cert'
    result = yield generateServerCert options
  else
    logger.info 'Generating client cert'
    result = yield generateClientCert options
  this.status = 201
  this.body = result

generateClientCert = (options) ->
  keystoreDoc = yield Keystore.findOne().exec()
