From c2b175bebef9028fd5de9912372af9275e9e6b9c Mon Sep 17 00:00:00 2001 From: David Schneider Date: Wed, 1 Jul 2020 22:57:50 +0200 Subject: [PATCH] Change docs --- cert.go | 5 +++-- doc.go | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cert.go b/cert.go index b008f60..7fa5f7f 100644 --- a/cert.go +++ b/cert.go @@ -50,8 +50,9 @@ func CreateWithKeyOptions(cert *x509.Certificate, keyOptions KeyOptions, signCer return certPEM, keyPEM, nil } -// Sign set some defaults on cert and signs it with signCert and signKey. -// The following defaults are set if the values are not set explicitly yet: +// Sign set some defaults on a certificate and signs it with the signCert and +// the signKey. The following defaults are set they are not set explicitly in the +// certificate: // // - SubjectKeyId is generated based on the publicKey // - The AuthorityKeyId is set based on the SubjectKeyId of the signCert diff --git a/doc.go b/doc.go index 98f9db9..5a4f181 100644 --- a/doc.go +++ b/doc.go @@ -1,6 +1,19 @@ /* Package pcert aims to ease the creation of x509 certificates and keys. -It allows to create and sign certificates and their coresponding keys in only a few simple steps. +This package provides the following main functions: + + - Create: creates a certificate and a key + - Request: creates a CSR and a key + - Sign: signs a certificate or a CSR with an existing certificate and key + +The results of the functions which return certificats, CSRs and keys are all +PEM encoded. + +All functions without special suffix refer to a certificates. Functions for CSR +and Key use an appropriate suffix. +For example the function Load loads a certificate from a file, whereas LoadKey +or LoadCSR are for keys resp. CSRs. + import ( "io/ioutil" @@ -10,6 +23,7 @@ It allows to create and sign certificates and their coresponding keys in only a func main() { cert := pcert.NewServerCertificate("www.example.local") + // self-signed certPEM, keyPEM, _ := pcert.Create(cert, nil, nil) _ = ioutil.WriteFile("server.crt", certPEM, 0644)