Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyTlsCertHandler(tlsConfig *tls.Config, handler TlsCertHandler) error
- func CtxGetLog(ctx context.Context) zerolog.Logger
- func CtxWithLog(ctx context.Context, log zerolog.Logger) context.Context
- func InitLogger(level string) zerolog.Logger
- func RegisterEchoHandlers(svcHandler ServiceHandler, e *echo.Echo)
- func RunGracefully(ctx context.Context, server *http.Server, e *echo.Echo) error
- type EstErrorType
- type Service
- type ServiceHandler
- type TlsCertHandler
- type TlsCerts
Constants ¶
const MAX_CONTENT_LEN = 4096
Variables ¶
var (
ErrEst = errors.New("base EstError")
)
Functions ¶
func ApplyTlsCertHandler ¶
func ApplyTlsCertHandler(tlsConfig *tls.Config, handler TlsCertHandler) error
Apply the TlsCertHandler logic to the tlsConfig
func InitLogger ¶
func RegisterEchoHandlers ¶
func RegisterEchoHandlers(svcHandler ServiceHandler, e *echo.Echo)
Types ¶
type EstErrorType ¶
type EstErrorType int
const ( ErrInvalidSignatureAlgorithm EstErrorType = iota ErrSubjectMismatch ErrSubjectAltNameMismatch ErrInvalidBase64 ErrInvalidCsr ErrInvalidCsrSignature )
func (EstErrorType) Error ¶
func (e EstErrorType) Error() string
func (EstErrorType) Unwrap ¶
func (e EstErrorType) Unwrap() error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents a thin API to handle required operations of EST7030. This service implements the required parts of EST. Specifically:
"cas" - Section 4.1 "enroll" and "reenroll" - Section 4.2
Optional APIs are not implemented including:
4.3 - cmc 4.4 - server side key generation 4.5 - CSR attributes
func NewService ¶
func NewService(rootCa *x509.Certificate, ca *x509.Certificate, key crypto.Signer, certDuration time.Duration) Service
NewService creates an EST7030 API for a Factory
func (Service) CaCerts ¶
CaCerts return the CA certificate as per: https://www.rfc-editor.org/rfc/rfc7030.html#section-4.1.2
func (Service) Enroll ¶
Enroll perform EST7030 enrollment operation as per https://www.rfc-editor.org/rfc/rfc7030.html#section-4.2.1 Errors can be generic errors or of the type EstError
type ServiceHandler ¶
type ServiceHandler interface {
GetService(ctx context.Context, serverName string) (Service, error)
}
func NewStaticServiceHandler ¶
func NewStaticServiceHandler(svc Service) ServiceHandler
type TlsCertHandler ¶
type TlsCertHandler interface { Init(ctx context.Context) error Get(ctx context.Context, serverName string) (*TlsCerts, error) VerifyConnection(ctx context.Context, certs *TlsCerts, conn tls.ConnectionState) error }
TLSCertHandler provides a way to hook into Go's HTTPS implementation to support different TLS Certs based on the incoming SNI server name.
func NewStaticTlsCertHandler ¶
func NewStaticTlsCertHandler(certs *TlsCerts) (TlsCertHandler, error)
Createa a TlsCertHandler based on a static keyfile and certificate