forked from TrueCloudLab/certificates
Move CreateTemplateData.
This commit is contained in:
parent
28ff122f83
commit
3c84453cf4
2 changed files with 15 additions and 9 deletions
|
@ -14,6 +14,21 @@ const (
|
|||
// passed to the templates.
|
||||
type TemplateData map[string]interface{}
|
||||
|
||||
// NewTemplateData creates a new map for templates data.
|
||||
func NewTemplateData() TemplateData {
|
||||
return TemplateData{}
|
||||
}
|
||||
|
||||
// CreateTemplateData creates a new TemplateData with the given common name and SANs.
|
||||
func CreateTemplateData(commonName string, sans []string) TemplateData {
|
||||
return TemplateData{
|
||||
SubjectKey: Subject{
|
||||
CommonName: commonName,
|
||||
},
|
||||
SANsKey: CreateSANs(sans),
|
||||
}
|
||||
}
|
||||
|
||||
func (t TemplateData) Set(key string, v interface{}) {
|
||||
t[key] = v
|
||||
}
|
||||
|
|
|
@ -38,15 +38,6 @@ func CreateSANs(sans []string) []SubjectAlternativeName {
|
|||
return sanTypes
|
||||
}
|
||||
|
||||
func CreateTemplateData(commonName string, sans []string) TemplateData {
|
||||
return TemplateData{
|
||||
SubjectKey: Subject{
|
||||
CommonName: commonName,
|
||||
},
|
||||
SANsKey: CreateSANs(sans),
|
||||
}
|
||||
}
|
||||
|
||||
// generateSerialNumber returns a random serial number.
|
||||
func generateSerialNumber() (*big.Int, error) {
|
||||
limit := new(big.Int).Lsh(big.NewInt(1), 128)
|
||||
|
|
Loading…
Reference in a new issue