code: func ExtractCertificateRequest(cert *x509.Certificate) *CertificateRequest {
  	req := New()
  	req.CN = cert.Subject.CommonName
  	req.Names = getNames(cert.Subject)
  	req.Hosts = getHosts(cert)
  	req.SerialNumber = cert.Subject.SerialNumber
  
  	if cert.IsCA {
  		req.CA = new(CAConfig)
  		// CA expiry length is calculated based on the input cert
  		// issue date and expiry date.
  		req.CA.Expiry = cert.NotAfter.Sub(cert.NotBefore).String()
  		req.CA.PathLength = cert.MaxPathLen
  		req.CA.PathLenZero = cert.MaxPathLenZero
  	}
  
  	return req
  }
docs: // ExtractCertificateRequest extracts a CertificateRequest from
  // x509.Certificate. It is aimed to used for generating a new certificate
  // from an existing certificate. For a root certificate, the CA expiry
  // length is calculated as the duration between cert.NotAfter and cert.NotBefore.