func (ca *CA) IssuePrecertificateChain() ([]*x509.Certificate, error) {
	leaf, err := ca.IssuePrecertificate()
	if err != nil {
		return nil, fmt.Errorf("error issuing leaf precertificate: %s", err)
	}
	return []*x509.Certificate{leaf, ca.SigningCert}, nil
}
IssuePrecertificateChain creates a certificate chain, containing a new leaf
precertificate (as created by IssuePrecertificate) and the certificate for
the key that signed it (stored in the SigningCert field of the CA).

TODO(katjoyce): Add precert-signing-cert functionality.
package certgen
import (
	"crypto"
	crand "crypto/rand"
	"crypto/rsa"
	"fmt"
	"math"
	"math/big"
	"strconv"
	"strings"
	"time"
	"github.com/google/certificate-transparency-go/x509"
	"github.com/google/certificate-transparency-go/x509/pkix"
	"github.com/google/monologue/interval"
)
const (
	keySizeBits  = 2048
	certValidity = time.Hour * 24
)
var timeNowUTC = func() time.Time {
	return time.Now().UTC()
}
type CertificateConfig struct {
	SubjectCommonName         string
	SubjectOrganization       string
	SubjectOrganizationalUnit string
	SubjectLocality           string
	SubjectCountry            string
	SignatureAlgorithm        x509.SignatureAlgorithm
	DNSPrefix string
	NotAfterInterval *interval.Interval
}
type CA struct {
	SigningCert *x509.Certificate
	SigningKey  crypto.Signer
	CertConfig  CertificateConfig
}
func (ca *CA) IssueCertificate() (*x509.Certificate, error) {
	return ca.issueCertificate(false  )
}
func (ca *CA) IssueCertificateChain() ([]*x509.Certificate, error) {
	leaf, err := ca.IssueCertificate()
	if err != nil {
		return nil, fmt.Errorf("error issuing leaf certificate: %s", err)
	}
	return []*x509.Certificate{leaf, ca.SigningCert}, nil
}
func (ca *CA) IssuePrecertificate() (*x509.Certificate, error) {
	return ca.issueCertificate(true  )
}