Documentation ¶
Overview ¶
Implements version 1 of the configuration parser.
It applies some defaults to the configurations: - Default Key Algorithm: EC P-256 - Default Signature Algorithm: ECDSAWithSHA256 for EC; RSAWIthSHA256 for RSA. - Default certificate validity: 5 years, starting from the current point in time.
Index ¶
- Constants
- Variables
- type Admission
- type AdmissionExtension
- type AnyExtension
- type AuthInfoAccess
- type AuthKeyId
- type AuthKeyIdContent
- type BasicConstraints
- type BasicConstraintsObj
- type CertConfig
- type CertPolicies
- type CertPolicy
- type CertValidity
- type CfgFileType
- type CustomExtension
- type ExtKeyUsage
- type ExtensionType
- type GeneralName
- type KeyUsage
- type Manipulations
- type NamingAuthority
- type PolicyQualifiers
- type ProfessionInfo
- type Profile
- type SingleAdmission
- type SingleAuthInfo
- type SubjAltNameComponent
- type SubjectAltName
- type SubjectKeyIdentifier
- type UserNotice
- type V1Configurator
Constants ¶
Variables ¶
var DurationSchemaString string
Functions ¶
This section is empty.
Types ¶
type Admission ¶ added in v0.1.0
type Admission struct { AdmissionAuthority GeneralName `json:"admissionAuthority"` Admissions []SingleAdmission `json:"admissions"` }
type AdmissionExtension ¶ added in v0.1.0
type AdmissionExtension struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content *Admission `json:"content"` }
func (AdmissionExtension) Builder ¶ added in v0.1.0
func (a AdmissionExtension) Builder() (cert.ExtensionBuilder, error)
func (AdmissionExtension) Oid ¶ added in v0.1.0
func (a AdmissionExtension) Oid() (asn1.ObjectIdentifier, error)
type AnyExtension ¶
type AnyExtension struct { *SubjectKeyIdentifier `json:"subjectKeyIdentifier"` *KeyUsage `json:"keyUsage"` *SubjectAltName `json:"subjectAlternativeName"` *BasicConstraints `json:"basicConstraints"` *CertPolicies `json:"certificatePolicies"` *AuthInfoAccess `json:"authorityInformationAccess"` *AuthKeyId `json:"authorityKeyIdentifier"` *ExtKeyUsage `json:"extendedKeyUsage"` *AdmissionExtension `json:"admission"` *CustomExtension `json:"custom"` Optional bool `json:"optional"` Override bool `json:"override"` }
Struct for unmarshaling JSON/YAML extensions. The config expects a list of objects, where each object has only one key-value pair. This ensures readability and preserves the order of extensions while still not having to unmarshal everything by hand. This is also enforced through the schema.
This means that only one pointer is not nil after parsing. We later use reflection to find out, which one it is and return the appropriate pointer value as a config.ExtensionConfig.
This struct must only include exactly one config.ExtensionConfig implementation for each extension.
To add an extension, simply write your config.ExtensionConfig implementation and add a pointer to this struct.
type AuthInfoAccess ¶
type AuthInfoAccess struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content []SingleAuthInfo `json:"content"` }
JSON/YAML representation for this extension. Also implements config.ExtensionConfig
func (AuthInfoAccess) Builder ¶
func (a AuthInfoAccess) Builder() (cert.ExtensionBuilder, error)
func (AuthInfoAccess) Oid ¶
func (a AuthInfoAccess) Oid() (asn1.ObjectIdentifier, error)
type AuthKeyId ¶
type AuthKeyId struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content AuthKeyIdContent `json:"content"` }
JSON/YAML representation for this extension. Also implements config.ExtensionConfig
type AuthKeyIdContent ¶
type AuthKeyIdContent struct {
Id string `json:"id"`
}
type BasicConstraints ¶
type BasicConstraints struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content *BasicConstraintsObj `json:"content"` }
JSON/YAML representation for this extension. Also implements config.ExtensionConfig
func (BasicConstraints) Builder ¶
func (b BasicConstraints) Builder() (cert.ExtensionBuilder, error)
func (BasicConstraints) Oid ¶
func (b BasicConstraints) Oid() (asn1.ObjectIdentifier, error)
type BasicConstraintsObj ¶
type CertConfig ¶
type CertConfig struct { Alias string `json:"alias"` Version int `json:"version"` Profile string `json:"profile"` SerialNumber int64 `json:"serialNumber"` IssuerUniqueId string `json:"issuerUniqueId"` SubjectUniqueId string `json:"subjectUniqueId"` Subject string `json:"subject"` Issuer string `json:"issuer"` Validity CertValidity `json:"validity"` KeyAlgorithm string `json:"keyAlgorithm"` SignatureAlgorithm string `json:"signatureAlgorithm"` Extensions []AnyExtension `json:"extensions"` Manipulations Manipulations `json:"manipulations"` }
Struct for YAML/JSON marshaling.
type CertPolicies ¶
type CertPolicies struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content []CertPolicy `json:"content"` }
JSON/YAML representation for this extension. Also implements config.ExtensionConfig
func (CertPolicies) Builder ¶
func (c CertPolicies) Builder() (cert.ExtensionBuilder, error)
func (CertPolicies) Oid ¶
func (c CertPolicies) Oid() (asn1.ObjectIdentifier, error)
type CertPolicy ¶
type CertPolicy struct { Oid string `json:"oid"` Qualifiers []PolicyQualifiers `json:"qualifiers"` }
type CertValidity ¶
type CertValidity struct { From string `json:"from"` Until string `json:"until"` Duration string `json:"duration"` }
Struct for YAML/JSON marshaling.
type CfgFileType ¶
type CfgFileType int
type CustomExtension ¶
type CustomExtension struct { OidStr string `json:"oid"` Raw string `json:"raw"` Critical bool `json:"critical"` }
JSON/YAML representation for this custom extensions. Also implements config.ExtensionConfig
func (CustomExtension) Builder ¶
func (c CustomExtension) Builder() (cert.ExtensionBuilder, error)
func (CustomExtension) Oid ¶
func (c CustomExtension) Oid() (asn1.ObjectIdentifier, error)
type ExtKeyUsage ¶
type ExtKeyUsage struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content []string `json:"content"` }
JSON/YAML representation for this extension. Also implements config.ExtensionConfig
func (ExtKeyUsage) Builder ¶
func (e ExtKeyUsage) Builder() (cert.ExtensionBuilder, error)
func (ExtKeyUsage) Oid ¶
func (e ExtKeyUsage) Oid() (asn1.ObjectIdentifier, error)
type ExtensionType ¶
type ExtensionType int
const ( TypeIllegal ExtensionType = iota TypeSubjectKeyIdentifier TypeKeyUsage TypeSubjectAltName TypeBasicConstraints TypeCertPolicies TypeAuthInfoAccess TypeAuthKeyId TypeAdmission TypeExtKeyUsage TypeCustomExtension )
type GeneralName ¶ added in v0.1.0
type KeyUsage ¶
type KeyUsage struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content []string `json:"content"` }
JSON/YAML representation for this extension. Also implements config.ExtensionConfig
type Manipulations ¶ added in v0.2.0
type Manipulations struct { Version *int `json:".version"` OuterSigAlg string `json:".signatureAlgorithm"` SigValue string `json:".signatureValue"` TbsSig string `json:".tbs.signature"` TbsPubKeyAlg string `json:".tbs.subjectPublicKey.algorithm"` TbsPubKey string `json:".tbs.subjectPublicKey.subjectPublicKey"` }
func (Manipulations) Apply ¶ added in v0.2.0
func (m Manipulations) Apply(c *config.CertificateContent) error
type NamingAuthority ¶ added in v0.1.0
type PolicyQualifiers ¶
type PolicyQualifiers struct { Cps string `json:"cps"` *UserNotice `json:"userNotice"` }
type ProfessionInfo ¶ added in v0.1.0
type ProfessionInfo struct { NamingAuthority `json:"namingAuthority"` ProfessionItems []string `json:"professionItems"` ProfessionOids []string `json:"professionOids"` RegistrationNumber string `json:"registrationNumber"` AddProfessionInfo string `json:"addProfessionInfo"` }
type Profile ¶
type Profile struct { ProfileName string `json:"name"` Version int `json:"version"` Validity CertValidity `json:"validity"` SubjectAttributes config.ProfileSubjectAttributes `json:"subjectAttributes"` Extensions []AnyExtension `json:"extensions"` }
Struct for YAML/JSON marshaling.
type SingleAdmission ¶ added in v0.1.0
type SingleAdmission struct { AdmissionAuthority GeneralName `json:"admissionAuthority"` NamingAuthority `json:"namingAuthority"` ProfessionInfos []ProfessionInfo `json:"professionInfos"` }
type SingleAuthInfo ¶
type SingleAuthInfo struct {
Ocsp string `json:"ocsp"`
}
type SubjAltNameComponent ¶
type SubjectAltName ¶
type SubjectAltName struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content []SubjAltNameComponent `json:"content"` }
JSON/YAML representation for this extension. Also implements config.ExtensionConfig
func (SubjectAltName) Builder ¶
func (s SubjectAltName) Builder() (cert.ExtensionBuilder, error)
func (SubjectAltName) Oid ¶
func (s SubjectAltName) Oid() (asn1.ObjectIdentifier, error)
type SubjectKeyIdentifier ¶
type SubjectKeyIdentifier struct { Raw string `json:"raw"` Critical bool `json:"critical"` Content string `json:"content"` }
JSON/YAML representation for this extension. Also implements config.ExtensionConfig
func (SubjectKeyIdentifier) Builder ¶
func (s SubjectKeyIdentifier) Builder() (cert.ExtensionBuilder, error)
func (SubjectKeyIdentifier) Oid ¶
func (s SubjectKeyIdentifier) Oid() (asn1.ObjectIdentifier, error)
type UserNotice ¶
type V1Configurator ¶
type V1Configurator struct{}
The implementor of config.Configurator for version 1.
func (V1Configurator) CertificateExample ¶
func (v V1Configurator) CertificateExample() string
func (V1Configurator) ParseConfiguration ¶
func (v V1Configurator) ParseConfiguration(s string) (any, error)
Implements ParseConfiguration from config.Configurator. It unmarshals the provided string and generate the appropriate configuration object with the stated defaults.
func (V1Configurator) ProfileExample ¶
func (v V1Configurator) ProfileExample() string