Documentation ¶
Index ¶
- func GenerateCSR(cfg Configuration, privateKey *ecdsa.PrivateKey) ([]byte, error)
- func GenerateCert(cfg Configuration, privateKey *ecdsa.PrivateKey, signerCA []*x509.Certificate, ...) ([]byte, error)
- func GenerateIdentityCSR(cfg Configuration, deviceID string, privateKey *ecdsa.PrivateKey) ([]byte, error)
- func GenerateIdentityCert(cfg Configuration, deviceID string, privateKey *ecdsa.PrivateKey, ...) ([]byte, error)
- func GenerateIntermediateCA(cfg Configuration, privateKey *ecdsa.PrivateKey, signerCA []*x509.Certificate, ...) ([]byte, error)
- func GenerateRootCA(cfg Configuration, privateKey *ecdsa.PrivateKey) ([]byte, error)
- func NewIdentityCSRTemplate(deviceID string) (*x509.CertificateRequest, error)
- func OidFromExtKeyUsage(eku x509.ExtKeyUsage) (oid asn1.ObjectIdentifier, ok bool)
- type Configuration
- func (cfg Configuration) AsnExtensionKeyUsages() ([]asn1.ObjectIdentifier, error)
- func (cfg Configuration) AsnKeyUsages() (asn1.BitString, error)
- func (cfg Configuration) ToIPAddresses() ([]net.IP, error)
- func (cfg Configuration) ToPkixName() pkix.Name
- func (cfg Configuration) X509ExtKeyUsages() ([]x509.ExtKeyUsage, []asn1.ObjectIdentifier, error)
- func (cfg Configuration) X509KeyUsages() (x509.KeyUsage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCSR ¶
func GenerateCSR(cfg Configuration, privateKey *ecdsa.PrivateKey) ([]byte, error)
GenerateCSR creates CSR according to configuration.
func GenerateCert ¶
func GenerateCert(cfg Configuration, privateKey *ecdsa.PrivateKey, signerCA []*x509.Certificate, signerCAKey *ecdsa.PrivateKey) ([]byte, error)
func GenerateIdentityCSR ¶
func GenerateIdentityCSR(cfg Configuration, deviceID string, privateKey *ecdsa.PrivateKey) ([]byte, error)
GenerateIdentityCSR creates identity CSR according to configuration.
func GenerateIdentityCert ¶
func GenerateIdentityCert(cfg Configuration, deviceID string, privateKey *ecdsa.PrivateKey, signerCA []*x509.Certificate, signerCAKey *ecdsa.PrivateKey) ([]byte, error)
func GenerateIntermediateCA ¶
func GenerateIntermediateCA(cfg Configuration, privateKey *ecdsa.PrivateKey, signerCA []*x509.Certificate, signerCAKey *ecdsa.PrivateKey) ([]byte, error)
func GenerateRootCA ¶
func GenerateRootCA(cfg Configuration, privateKey *ecdsa.PrivateKey) ([]byte, error)
func NewIdentityCSRTemplate ¶
func NewIdentityCSRTemplate(deviceID string) (*x509.CertificateRequest, error)
func OidFromExtKeyUsage ¶
func OidFromExtKeyUsage(eku x509.ExtKeyUsage) (oid asn1.ObjectIdentifier, ok bool)
Types ¶
type Configuration ¶
type Configuration struct { Subject struct { Country []string `long:"c" description:"to set more values repeat option with parameter"` Organization []string `long:"o" description:"to set more values repeat option with parameter"` OrganizationalUnit []string `long:"ou" description:"to set more values repeat option with parameter"` Locality []string `long:"l" description:"to set more values repeat option with parameter"` CommonName string `long:"cn"` Province []string `long:"p" description:"to set more values repeat option with parameter"` StreetAddress []string `long:"sa" description:"to set more values repeat option with parameter"` PostalCode []string `long:"pc" description:"to set more values repeat option with parameter"` SerialNumber string `long:"sn"` } `group:"Subject" namespace:"subject"` SubjectAlternativeName struct { DNSNames []string `long:"domain" description:"to set more values repeat option with parameter"` IPAddresses []string `long:"ip" description:"to set more values repeat option with parameter"` } `group:"Subject Alternative Name" namespace:"san"` BasicConstraints struct { Ignore bool `long:"ignore" description:"bool, don't set basic constraints"` MaxPathLen int `long:"maxPathLen" default:"-1" description:"int, -1 means unlimited"` } `group:"Basic Constraints" namespace:"basicConstraints"` ValidFor time.Duration `long:"validFor" default:"8760h" description:"duration, format in NUMh"` KeyUsages []string `long:"ku" default:"digitalSignature" default:"keyAgreement" description:"to set more values repeat option with parameter"` ExtensionKeyUsages []string `long:"eku" default:"client" default:"server" description:"to set more values repeat option with parameter"` }
func (Configuration) AsnExtensionKeyUsages ¶
func (cfg Configuration) AsnExtensionKeyUsages() ([]asn1.ObjectIdentifier, error)
func (Configuration) AsnKeyUsages ¶
func (cfg Configuration) AsnKeyUsages() (asn1.BitString, error)
func (Configuration) ToIPAddresses ¶
func (cfg Configuration) ToIPAddresses() ([]net.IP, error)
func (Configuration) ToPkixName ¶
func (cfg Configuration) ToPkixName() pkix.Name
func (Configuration) X509ExtKeyUsages ¶
func (cfg Configuration) X509ExtKeyUsages() ([]x509.ExtKeyUsage, []asn1.ObjectIdentifier, error)
func (Configuration) X509KeyUsages ¶
func (cfg Configuration) X509KeyUsages() (x509.KeyUsage, error)
Click to show internal directories.
Click to hide internal directories.