security

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

The security functional block contains OCPP 2.0 features aimed at providing E2E security between a CSMS and a Charging station.

Index

Constants

View Source
const CertificateSignedFeatureName = "CertificateSigned"
View Source
const ProfileName = "security"
View Source
const SecurityEventNotificationFeatureName = "SecurityEventNotification"
View Source
const SignCertificateFeatureName = "SignCertificate"

Variables

Functions

This section is empty.

Types

type CSMSHandler

type CSMSHandler interface {
	// OnSecurityEventNotification is called on the CSMS whenever a SecurityEventNotificationRequest is received from a charging station.
	OnSecurityEventNotification(chargingStationID string, request *SecurityEventNotificationRequest) (response *SecurityEventNotificationResponse, err error)
	// OnSignCertificate is called on the CSMS whenever a SignCertificateRequest is received from a charging station.
	OnSignCertificate(chargingStationID string, request *SignCertificateRequest) (response *SignCertificateResponse, err error)
}

Needs to be implemented by a CSMS for handling messages part of the OCPP 2.0 Security profile.

type CertificateSignedFeature

type CertificateSignedFeature struct{}

During the a certificate update procedure, the CSMS sends a new certificate, signed by a CA, to the Charging Station with a CertificateSignedRequest. The Charging Station verifies the signed certificate, installs it locally and responds with a CertificateSignedResponse to the the CSMS with the status Accepted or Rejected.

func (CertificateSignedFeature) GetFeatureName

func (f CertificateSignedFeature) GetFeatureName() string

func (CertificateSignedFeature) GetRequestType

func (f CertificateSignedFeature) GetRequestType() reflect.Type

func (CertificateSignedFeature) GetResponseType

func (f CertificateSignedFeature) GetResponseType() reflect.Type

type CertificateSignedRequest

type CertificateSignedRequest struct {
	CertificateChain  string                      `json:"certificateChain" validate:"required,max=10000"`
	TypeOfCertificate types.CertificateSigningUse `json:"typeOfCertificate,omitempty" validate:"omitempty,certificateSigningUse"`
}

The field definition of the CertificateSignedRequest PDU sent by the CSMS to the Charging Station.

func NewCertificateSignedRequest

func NewCertificateSignedRequest(certificateChain string) *CertificateSignedRequest

Creates a new CertificateSignedRequest, containing all required fields. Additional optional fields may be set afterwards.

func (CertificateSignedRequest) GetFeatureName

func (r CertificateSignedRequest) GetFeatureName() string

type CertificateSignedResponse

type CertificateSignedResponse struct {
	Status     CertificateSignedStatus `json:"status" validate:"required,certificateSignedStatus"`
	StatusInfo *types.StatusInfo       `json:"statusInfo,omitempty" validate:"omitempty"`
}

The field definition of the CertificateSignedResponse payload sent by the Charging Station to the CSMS in response to a CertificateSignedRequest.

func NewCertificateSignedResponse

func NewCertificateSignedResponse(status CertificateSignedStatus) *CertificateSignedResponse

Creates a new CertificateSignedResponse, containing all required fields. There are no optional fields for this message.

func (CertificateSignedResponse) GetFeatureName

func (c CertificateSignedResponse) GetFeatureName() string

type CertificateSignedStatus

type CertificateSignedStatus string

Status returned in response to CertificateSignedRequest, that indicates whether certificate signing has been accepted or rejected.

const (
	CertificateSignedStatusAccepted CertificateSignedStatus = "Accepted"
	CertificateSignedStatusRejected CertificateSignedStatus = "Rejected"
)

type ChargingStationHandler

type ChargingStationHandler interface {
	// OnCertificateSigned is called on a charging station whenever a CertificateSignedRequest is received from the CSMS.
	OnCertificateSigned(request *CertificateSignedRequest) (response *CertificateSignedResponse, err error)
}

Needs to be implemented by Charging stations for handling messages part of the OCPP 2.0 Security profile.

type SecurityEventNotificationFeature

type SecurityEventNotificationFeature struct{}

In case of critical security events, a Charging Station may immediately inform the CSMS of such events, via a SecurityEventNotificationRequest. The CSMS responds with a SecurityEventNotificationResponse to the Charging Station.

func (SecurityEventNotificationFeature) GetFeatureName

func (f SecurityEventNotificationFeature) GetFeatureName() string

func (SecurityEventNotificationFeature) GetRequestType

func (f SecurityEventNotificationFeature) GetRequestType() reflect.Type

func (SecurityEventNotificationFeature) GetResponseType

func (f SecurityEventNotificationFeature) GetResponseType() reflect.Type

type SecurityEventNotificationRequest

type SecurityEventNotificationRequest struct {
	Type      string          `json:"type" validate:"required,max=50"`                 // Type of the security event. This value should be taken from the Security events list.
	Timestamp *types.DateTime `json:"timestamp" validate:"required"`                   // Date and time at which the event occurred.
	TechInfo  string          `json:"techInfo,omitempty" validate:"omitempty,max=255"` // Additional information about the occurred security event.
}

The field definition of the SecurityEventNotification request payload sent by the Charging Station to the CSMS.

func NewSecurityEventNotificationRequest

func NewSecurityEventNotificationRequest(typ string, timestamp *types.DateTime) *SecurityEventNotificationRequest

Creates a new SecurityEventNotificationRequest, containing all required fields. Optional fields may be set afterwards.

func (SecurityEventNotificationRequest) GetFeatureName

func (r SecurityEventNotificationRequest) GetFeatureName() string

type SecurityEventNotificationResponse

type SecurityEventNotificationResponse struct {
}

This field definition of the SecurityEventNotification response payload, sent by the CSMS to the Charging Station in response to a SecurityEventNotificationRequest. In case the request was invalid, or couldn't be processed, an error will be sent instead.

func NewSecurityEventNotificationResponse

func NewSecurityEventNotificationResponse() *SecurityEventNotificationResponse

Creates a new SecurityEventNotificationResponse, which doesn't contain any required or optional fields.

func (SecurityEventNotificationResponse) GetFeatureName

func (c SecurityEventNotificationResponse) GetFeatureName() string

type SignCertificateFeature

type SignCertificateFeature struct{}

If a Charging Station detected, that its certificate is due to expire, it will generate a new public/private key pair, then send a SignCertificateRequest to the CSMS containing a valid Certificate Signing Request.

The CSMS responds with a SignCertificateResponse and will then forward the CSR to a CA server. Once the CA has issues a valid certificate, the CSMS will send a CertificateSignedRequest to the charging station (asynchronously).

func (SignCertificateFeature) GetFeatureName

func (f SignCertificateFeature) GetFeatureName() string

func (SignCertificateFeature) GetRequestType

func (f SignCertificateFeature) GetRequestType() reflect.Type

func (SignCertificateFeature) GetResponseType

func (f SignCertificateFeature) GetResponseType() reflect.Type

type SignCertificateRequest

type SignCertificateRequest struct {
	CSR             string                      `json:"csr" validate:"required,max=5500"`                                     // The Charging Station SHALL send the public key in form of a Certificate Signing Request (CSR) as described in RFC 2986 and then PEM encoded.
	CertificateType types.CertificateSigningUse `json:"certificateType,omitempty" validate:"omitempty,certificateSigningUse"` // Indicates the type of certificate that is to be signed.
}

The field definition of the SignCertificate request payload sent by the Charging Station to the CSMS.

func NewSignCertificateRequest

func NewSignCertificateRequest(csr string) *SignCertificateRequest

Creates a new SignCertificateRequest, containing all required fields. Optional fields may be set afterwards.

func (SignCertificateRequest) GetFeatureName

func (r SignCertificateRequest) GetFeatureName() string

type SignCertificateResponse

type SignCertificateResponse struct {
	Status     types.GenericStatus `json:"status" validate:"required,genericStatus"`  // Specifies whether the CSMS can process the request.
	StatusInfo *types.StatusInfo   `json:"statusInfo,omitempty" validate:"omitempty"` // Detailed status information.
}

This field definition of the SignCertificate response payload, sent by the CSMS to the Charging Station in response to a SignCertificateRequest. In case the request was invalid, or couldn't be processed, an error will be sent instead.

func NewSignCertificateResponse

func NewSignCertificateResponse(status types.GenericStatus) *SignCertificateResponse

Creates a new SignCertificateResponse, containing all required fields. Optional fields may be set afterwards.

func (SignCertificateResponse) GetFeatureName

func (c SignCertificateResponse) GetFeatureName() string

Jump to

Keyboard shortcuts

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