selfsigned

package
v0.0.0-...-8a7802e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CertificateBlockType is a possible value for pem.Block.Type.
	CertificateBlockType = "CERTIFICATE"
	// CertificateRequestBlockType is a possible value for pem.Block.Type.
	CertificateRequestBlockType = "CERTIFICATE REQUEST"
	// PrivateKeyBlockType is a possible value for pem.Block.Type.
	PrivateKeyBlockType = "PRIVATE KEY"
)

Variables

This section is empty.

Functions

func EncodePemCSR

func EncodePemCSR(csr *x509.CertificateRequest) []byte

func EncodePemCSRWithRaw

func EncodePemCSRWithRaw(raw []byte) []byte

func EncodePemCert

func EncodePemCert(cert *x509.Certificate) []byte

func EncodePemCertWithRaw

func EncodePemCertWithRaw(raw []byte) []byte

func EncodePemPrivKey

func EncodePemPrivKey(privateKey crypto.Signer) []byte

func EncodePemPrivKeyWithRaw

func EncodePemPrivKeyWithRaw(raw []byte) []byte

Types

type CertOptions

type CertOptions struct {
	Organization []string
	CommonName   string
	DNSNames     []string
}

CertOptions contains options for generating a new certificate.

type Signer

type Signer interface {
	// GenCSR generate CERTIFICATE REQUEST
	GenCSR(opts *CertOptions) (csrRaw []byte, err error)

	// GenCert generate CERTIFICATE
	GenCert(opts *CertOptions) (certRaw []byte, err error)

	// Sign use self sign csr, return new cert, must invoke GenCert first, otherwise return error
	Sign(csrRaw []byte, expireTime time.Duration) (certRaw []byte, err error)

	// PrivateKey get PRIVATE KEY
	PrivateKey() []byte
}

func NewSelfSigner

func NewSelfSigner() (Signer, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL