Skip to content

Commit

Permalink
Change docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dvob committed Jul 1, 2020
1 parent 6c5be7e commit c2b175b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion doc.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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)
Expand Down

0 comments on commit c2b175b

Please sign in to comment.