tls

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CERTTIFICATE_VALIDITY duration of certificate validity in days
	CERTIFICATE_VALIDITY = 365

	// SERVER_KEY_NAME - name of server cert private key
	SERVER_KEY_NAME = "server.key"

	// ROOT_KEY_NAME - name of root cert private key
	ROOT_KEY_NAME = "root.key"

	// SERVER_PEM_NAME - name of server pem
	SERVER_PEM_NAME = "server.pem"

	// ROOT_PEM_NAME - name of root pem
	ROOT_PEM_NAME = "root.pem"

	// SERVER_CLIENT_PEM - the name of server client cert
	SERVER_CLIENT_PEM = "serverclient.pem"

	// SERVER_CLIENT_KEY - the name of server client key
	SERVER_CLIENT_KEY = "serverclient.key"

	// SERVER_CLIENT_ENTRY - the server client cert key for DB
	SERVER_CLIENT_ENTRY = "servercliententry"
)

Variables

This section is empty.

Functions

func NewCName

func NewCName(commonName string) pkix.Name

NewCName creates a new pkix.Name with only a common name

func NewCSR

func NewCSR(key ed25519.PrivateKey, name pkix.Name) (*x509.CertificateRequest, error)

NewCSR creates a new certificate signing request for a

func NewEndEntityCert

func NewEndEntityCert(key ed25519.PrivateKey, req *x509.CertificateRequest, parent *x509.Certificate, days int) (*x509.Certificate, error)

NewEndEntityCert issues a new certificate from a parent certificate authority

func NewName

func NewName(commonName, country, org string) pkix.Name

NewName creates a new pkix.Name with common name, country, and organization

func ReadCertFromFile

func ReadCertFromFile(name string) (*x509.Certificate, error)

ReadCertFromFile reads a certificate from disk

func ReadKeyFromFile

func ReadKeyFromFile(name string) (*ed25519.PrivateKey, error)

ReadKeyFromFile reads a private key (ed25519) from disk

func SaveCertToFile

func SaveCertToFile(path, name string, cert *x509.Certificate) error

SaveCertToFile save a certificate to the specified path

func SaveKeyToFile

func SaveKeyToFile(path, name string, key ed25519.PrivateKey) error

SaveKeyToFile save a private key (ed25519) to the certs database

func SaveRequest

func SaveRequest(path, name string, csr *x509.CertificateRequest) error

SaveRequest saves a certificate request to the specified path

func SelfSignedCA

func SelfSignedCA(key ed25519.PrivateKey, req *x509.CertificateRequest, days int) (*x509.Certificate, error)

SelfSignedCA returns a new self-signed certificate

Types

type Key

type Key struct {
	// contains filtered or unexported fields
}

Key is the struct for an edwards representation point

func NewKey

func NewKey() *Key

NewKey generates a new key.

func ReadFrom

func ReadFrom(path string) (*Key, error)

ReadFrom reads a private key from path.

func (*Key) Curve25519PrivateKey

func (n *Key) Curve25519PrivateKey() (wgtypes.Key, error)

Key.Curve25519PrivateKey returns the private key in Montogomery form used for ECDH.

func (*Key) Ed25519PrivateKey

func (n *Key) Ed25519PrivateKey() (ed25519.PrivateKey, error)

Key.Ed25519PrivateKey returns the private key in Edwards form used for EdDSA.

func (*Key) Save

func (n *Key) Save(path string) error

Key.Save : saves the private key to path.

Jump to

Keyboard shortcuts

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