utils

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EfgsExtendedLogging = false

EfgsExtendedLogging Determines whether extended logging should be used - e.g. all raw EFGS requests and responses.

Functions

func CalculateExposureKeysHMAC

func CalculateExposureKeysHMAC(keys []keyserverapi.ExposureKey, hmacKey []byte) ([]byte, error)

CalculateExposureKeysHMAC calculates HMAC of given keys. Copied from Verification server code.

func GetCertificateFingerprint added in v0.5.0

func GetCertificateFingerprint(ctx context.Context, pair *X509KeyPair) (string, error)

GetCertificateFingerprint Gets fingerprint of given cert.

func GetCertificateSubject added in v0.5.0

func GetCertificateSubject(ctx context.Context, pair *X509KeyPair) (string, error)

GetCertificateSubject Gets subject of given cert.

func GetEfgsURLOrFail added in v0.5.0

func GetEfgsURLOrFail(env Environment) *urlutils.URL

GetEfgsURLOrFail Gets EFGS url from secrets and fails if it's not available.

func NewEFGSClient added in v0.5.0

func NewEFGSClient(ctx context.Context, nbtlsPair *X509KeyPair) (*http.Client, error)

NewEFGSClient Creates new secured client for EFGS.

Types

type CertType added in v0.5.0

type CertType string

CertType Type of certificate to work with.

const (
	//NBBS National backend batch-signing certificate.
	NBBS CertType = "nbbs"
	//NBTLS National backend mTLS certificate.
	NBTLS CertType = "nbtls"
)

type Environment added in v0.5.0

type Environment string

Environment Environment of EFGS.

const (
	//EnvLocal Our local testing environment.
	EnvLocal Environment = "local"
	//EnvAcc Acc env of EFGS.
	EnvAcc Environment = "acc"
	//EnvProd Prod env of EFGS.
	EnvProd Environment = "prod"
)

func GetEfgsEnvironmentOrFail added in v0.5.0

func GetEfgsEnvironmentOrFail() Environment

GetEfgsEnvironmentOrFail Gets EFGS environment from ENV variable and fails if it's not available.

type X509KeyPair added in v0.5.0

type X509KeyPair struct {
	Cert []byte
	Key  []byte
}

X509KeyPair X509 certificate and private key pair.

func LoadX509KeyPair added in v0.5.0

func LoadX509KeyPair(ctx context.Context, env Environment, certType CertType) (*X509KeyPair, error)

LoadX509KeyPair Loads certificate and key pair from Secrets Manager.

Jump to

Keyboard shortcuts

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