diff options
author | Gibheer <gibheer@gmail.com> | 2015-03-25 20:29:10 +0100 |
---|---|---|
committer | Gibheer <gibheer@gmail.com> | 2015-03-25 20:29:10 +0100 |
commit | b3f621a31251c225944125c17f9f97333ba33209 (patch) | |
tree | 33f01747fbaa740f6028515c8cb896d634da3799 | |
parent | 491630e33f356aee004fe1ae8eb61ef4fdd2ff80 (diff) |
provide more documentation for certificate types
-rw-r--r-- | certificate.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/certificate.go b/certificate.go index b186468..d065ab2 100644 --- a/certificate.go +++ b/certificate.go @@ -11,12 +11,15 @@ import ( "time" ) +// labels used in the pem file format to mark certificate sign requests and certificates const ( PemLabelCertificateRequest = "CERTIFICATE REQUEST" PemLabelCertificate = "CERTIFICATE" ) type ( + // Use CertificateData to fill in the minimum data you need to create a certificate + // sign request. CertificateData struct { Subject pkix.Name @@ -25,9 +28,13 @@ type ( IPAddresses []net.IP } + // Certificate is an alias on the x509.Certificate to add some methods. Certificate x509.Certificate + // CertificateRequest is an alias on the x509.CertificateRequest to add some methods. CertificateRequest x509.CertificateRequest + // CertificateOptions is used to provide the necessary information to create + // a certificate from a certificate sign request. CertificateOptions struct { SerialNumber *big.Int NotBefore time.Time @@ -40,6 +47,7 @@ type ( } ) +// Create a new set of certificate data. func NewCertificateData() *CertificateData { return &CertificateData{Subject: pkix.Name{}} } @@ -133,6 +141,7 @@ func (c *Certificate) MarshalPem() (marshalledPemBlock, error) { return pem.EncodeToMemory(block), nil } +// Check if the certificate options have the required fields set. func (co *CertificateOptions) Valid() error { if co.SerialNumber == nil { return fmt.Errorf("No serial number set!") } return nil |