Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorInvalidCommonName is given if an empty or invalid common name is given ErrorInvalidCommonName = errors.New("invalid common name") // ErrorInvalidSubjectAltName is given if an empty or invalid subject alt name is given ErrorInvalidSubjectAltName = errors.New("invalid subject alt name") // ErrorInvalidBitSize is given if an invalid bitsize is given ErrorInvalidBitSize = errors.New("invalid bit size") )
Functions ¶
func GenerateCA ¶
GenerateCA will generate a CA certificate pair and will return certificate, key and a possible error The Generated key will be in RSA format and has a bit size of 4096 and output of the Certificate and Key will be returned in PEM format as bytes.
func GenerateCertificate ¶
GenerateCertificate will generate a signed certificate pair and will return certificate, key and a possible error The Generated key will be in RSA format and has a bit size of 4096 and output of the Certificate and Key will be returned in PEM format as bytes.
The certificate will be signed by the given CA Certificate pair (caCrt and caKey). Validity of the CA Certificate pair is checked.
func GenerateRandomBigInt ¶
GenerateRandomBigInt generates a random big.int (decimal) needed for certificate serial numbers.
Types ¶
type Request ¶
type Request struct { Organization string OrganizationalUnit string Country string Province string Locality string StreetAddress string PostalCode string CommonName string SerialNumber *big.Int NameSerialNumber string SubjectAltNames []string NotBefore time.Time NotAfter time.Time BitSize int }
Request is the struct needed to generate a CA or Certificate pair
func NewRequest ¶
func NewRequest() *Request
NewRequest will create a new Request struct and set the NotBefore to now and the NotAfter to one day from now
func (*Request) GetPKIXName ¶
GetPKIXName extracts the Request object into a PKIX Name format for usage in constructing the certificate The NameSerialNumber is used as pkix.Name.SerialNumber here (if given).