certificate

package
v0.0.0-...-94e1a67 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureIdentityFileReader

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

AzureIdentityFileReader implements CertificateReader for file-based certificates that are used to authenticate with an Azure identity.

func NewAzureIdentityFileReader

func NewAzureIdentityFileReader(filePath string) *AzureIdentityFileReader

NewAzureIdentityFileReader creates a new file-based certificate reader.

func (*AzureIdentityFileReader) ReadCertificate

func (f *AzureIdentityFileReader) ReadCertificate() ([]*x509.Certificate, crypto.PrivateKey, error)

ReadCertificate reads and parses the certificate from the file. It expects the certificate to be in PEM or PKCS#12 format. Keys in PEM format or PKCS#12 certificates that use SHA256 for message authentication are not supported. ParseCertificates loads certificates and a private key, in PEM or PKCS#12 format, for use with [NewClientCertificateCredential]. Pass nil for password if the private key isn't encrypted. This function has limitations, for example it can't decrypt keys in PEM format or PKCS#12 certificates that use SHA256 for message authentication. If you encounter such limitations, consider using another module to load the certificate and private key.

type MockReader

type MockReader struct {
	Certs []*x509.Certificate
	Key   crypto.PrivateKey
	Err   error
}

MockReader is a simple mock for testing FirstPartyApplicationTokenCredentialRetriever

func (*MockReader) ReadCertificate

func (m *MockReader) ReadCertificate() ([]*x509.Certificate, crypto.PrivateKey, error)

type Reader

type Reader interface {
	// ReadCertificate reads and parses the certificate and private key.
	ReadCertificate() ([]*x509.Certificate, crypto.PrivateKey, error)
}

type WatchingAzureIdentityFileReader

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

WatchingAzureIdentityFileReader wraps AzureIdentityFileReader with caching and automatic reloading. It watches the certificate file and reloads when changes are detected.

func NewWatchingAzureIdentityFileReader

func NewWatchingAzureIdentityFileReader(ctx context.Context, filePath string) (*WatchingAzureIdentityFileReader, error)

NewWatchingAzureIdentityFileReader creates a new watching certificate reader. It loads the initial certificate and starts watching for changes. The logger is obtained from the context using utils.LoggerFromContext.

func (*WatchingAzureIdentityFileReader) ReadCertificate

ReadCertificate returns the cached certificate.

func (*WatchingAzureIdentityFileReader) Run

Run starts watching the certificate file for changes. When changes are detected, the reload callback is invoked. Watching continues until the context is canceled.

Jump to

Keyboard shortcuts

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