crypto

package
v0.1.0-tcp-proxy Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCertificateAndPrivateKeyPairValidity

func CheckCertificateAndPrivateKeyPairValidity(certificate, privateKey []byte, threshold time.Duration) (bool, error)

CheckCertificateAndPrivateKeyPairValidity checks if the certificate and private key pair are valid.

func CheckCertificateNamesAndIPs

func CheckCertificateNamesAndIPs(certificateBytes []byte, entries []string) (bool, error)

CheckCertificateNamesAndIPs checks if the Kubernetes API Server certificate matches the Control Plane Endpoint and SAN stored in the kubeadm: it must check both IPs and DNS names, and returns a false if the required entry isn't available. In case of removal of entries, this function returns true nevertheless to avoid reloading a Control Plane uselessly.

func CheckPublicAndPrivateKeyValidity

func CheckPublicAndPrivateKeyValidity(publicKey, privateKey []byte) (bool, error)

CheckPublicAndPrivateKeyValidity checks if the given bytes for the private and public keys are valid.

func GenerateCertificatePrivateKeyPair

func GenerateCertificatePrivateKeyPair(template *x509.Certificate, caCertificate []byte, caPrivateKey []byte) (*bytes.Buffer, *bytes.Buffer, error)

GenerateCertificatePrivateKeyPair starts from the Certificate Authority bytes a certificate using the provided template, returning the bytes both for the certificate and its key.

func IsValidCertificateKeyPairBytes

func IsValidCertificateKeyPairBytes(certificateBytes, privateKeyBytes []byte, expirationThreshold time.Duration) (bool, error)

IsValidCertificateKeyPairBytes checks if the certificate matches the private key bounded to it.

func NewCertificateTemplate

func NewCertificateTemplate(commonName string) *x509.Certificate

NewCertificateTemplate returns the template that must be used to generate a certificate, used to perform the authentication against the DataStore.

func ParseCertificateBytes

func ParseCertificateBytes(content []byte) (*x509.Certificate, error)

ParseCertificateBytes takes the certificate bytes returning a x509 certificate by parsing it.

func ParsePrivateKeyBytes

func ParsePrivateKeyBytes(content []byte) (crypto.Signer, error)

ParsePrivateKeyBytes takes the private key bytes returning an RSA private key by parsing it.

func ParsePublicKeyBytes

func ParsePublicKeyBytes(content []byte) (*rsa.PublicKey, error)

ParsePublicKeyBytes takes the public key bytes returning an RSA public key by parsing it.

func VerifyCertificate

func VerifyCertificate(cert, ca []byte, usages ...x509.ExtKeyUsage) (bool, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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