parlca

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: ISC Imports: 11 Imported by: 0

Documentation

Overview

Package parlca provides a self-signed certificate authority

Index

Constants

View Source
const (
	/*
		NoPassword       PasswordType = "\tnoPassword"
		GeneratePassword PasswordType = "\tgeneratePassword"
		GenerateOnTheFly Strategy     = iota << 0
		UseFileSystem
		DefaultStrategy = GenerateOnTheFly
	*/
	DefaultCountry = "US"
)

Variables

This section is empty.

Functions

func EnsureClient

func EnsureClient(cert *x509.Certificate)

func EnsureSelfSigned

func EnsureSelfSigned(cert *x509.Certificate)

func EnsureServer

func EnsureServer(cert *x509.Certificate)

func EnsureTemplate

func EnsureTemplate(cert *x509.Certificate)

Types

type Certificate

type Certificate interface {
	DER() (der CertificateDER)
}

type CertificateAuthority

type CertificateAuthority interface {
	Check() (isValid bool, cert *x509.Certificate, err error) // gets x509.Certificate version
	DER() (bytes CertificateDER)                              // untyped bytes, der: Distinguished Encoding Rules binary format
	Sign(template *x509.Certificate, publicKey crypto.PublicKey) (certDER CertificateDER, err error)
	SetReader(reader io.Reader)
}

func NewSelfSigned

func NewSelfSigned(canonicalName string) (ca CertificateAuthority)

func NewCertificateAuthority()

type CertificateDER

type CertificateDER []byte

type DER

type DER []byte

type Ed25519KeyPair

type Ed25519KeyPair struct {
	// func (ed25519.PrivateKey).Equal(x crypto.PrivateKey) bool
	// func (ed25519.PrivateKey).Public() crypto.PublicKey
	// func (ed25519.PrivateKey).Seed() []byte
	// func (ed25519.PrivateKey).Sign(rand io.Reader, message []byte, opts crypto.SignerOpts) (signature []byte, err error)
	// implements crypto.Signer: Public, Sign
	ed25519.PrivateKey // type: []byte
}

func (*Ed25519KeyPair) Algo

func (key *Ed25519KeyPair) Algo() (algo x509.PublicKeyAlgorithm)

func (*Ed25519KeyPair) Bytes

func (key *Ed25519KeyPair) Bytes() (bytes KeyDER, err error)

func (*Ed25519KeyPair) HasKey

func (key *Ed25519KeyPair) HasKey() (hasKey bool)

func (*Ed25519KeyPair) Private

func (key *Ed25519KeyPair) Private() (signer crypto.Signer)

func (*Ed25519KeyPair) PrivateBytes

func (key *Ed25519KeyPair) PrivateBytes() (bytes []byte)

func (*Ed25519KeyPair) PublicBytes

func (key *Ed25519KeyPair) PublicBytes() (bytes []byte)

type KeyDER

type KeyDER []byte

type KeyGenerator

type KeyGenerator func(io.Reader) (keyPair KeyPair, err error) // creates private key, returns public key

type KeyPair

type KeyPair interface {
	PrivateKey
	Bytes() (bytes KeyDER, err error) // untyped key material, both private and public keys
	PublicBytes() (bytes []byte)      // untyped public key material
	Private() (signer crypto.Signer)  // typed key material implementing crypto.Signer for x509.CreateCertificate and tls.Certificate.PrivateKey
}

KeyPair implements crypto.Signer and can therefore be used as tls.Certificate.PrivateKey

func GenerateEd25519

func GenerateEd25519(reader io.Reader) (keyPair KeyPair, err error)

func NewEd25519

func NewEd25519() (keyPair KeyPair, err error)

type PrivateKey

type PrivateKey interface {
	HasKey() (hasKey bool) // has key material
	Algo() (algo x509.PublicKeyAlgorithm)
	PrivateBytes() (bytes []byte) // untyped private key material
}

PrivateKey does not contain public part of a key pair, only the private key

type SelfSigned

type SelfSigned struct {
	Reader io.Reader
	CaDER  CertificateDER // der: Distinguished Encoding Rules is a binary format
	KeyPair
}

func (*SelfSigned) Check

func (ca *SelfSigned) Check() (isValid bool, cert *x509.Certificate, err error)

func (*SelfSigned) DER

func (ca *SelfSigned) DER() (bytes CertificateDER)

func (*SelfSigned) HasDER

func (ca *SelfSigned) HasDER() (hasDER bool)

func (*SelfSigned) SetReader

func (ca *SelfSigned) SetReader(reader io.Reader)

func (*SelfSigned) Sign

func (ca *SelfSigned) Sign(template *x509.Certificate, publicKey crypto.PublicKey) (certDER CertificateDER, err error)

Jump to

Keyboard shortcuts

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