Files
ca/Documentation/api/server_service_aia.md
dissoupovandGitHub 27e411997c Added integration tests (#16)
* Refactor Backend service

* Added integration tests
2026-10-23 18:02:39 -05:00

6.4 KiB

aia

import "github.com/effective-security/trustyca/server/service/aia"

Package aia implements the Authority Information Access service: the public, read-only routes the issued certificates point at, served over plain HTTP without authentication, as a TLS verifier fetches them: the issuer certificate (AIA caIssuers, GET /v1/cert/{ikid}), the current CRL (CRL Distribution Point, GET /v1/crl/{ikid}) and the OCSP responder (GET and POST under /v1/ocsp and /v1/ocspi). The service is REST only; the JSON and gRPC API of the certificate information (pb.CIS) is the cis service of the wfe listener.

The service reads the CA tables and holds no issuer keys. An OCSP request is forwarded to privpb.Backend.SignOCSP: to the backend service of the same process, else over gRPC with the `aia` service client (the `trustyca-aia` identity), created on the first request (shared.BackendLocator). The signed response is cached by the hash of the request until its NextUpdate. Every lookup is by the key identifier of the issuer, or by the OCSP request itself: the service lists nothing.

The service is built by its Factory from the app container; a test wires a backend directly:

svc, err := aia.New(cfg, caReadonlyDb, shared.NewStaticBackendLocator(backend))
if err != nil {
	return err
}
svc.RegisterRoute(router)

Index

Constants

ServiceName provides the Service Name for this package

const ServiceName = "aia"

func Factory

func Factory(server gserver.GServer) any

Factory returns a factory of the service

type Service

Service defines the Authority Information Access service: the binary routes the issued certificates point at, served to any caller over the plain HTTP listener of the service, as RFC 5280 requires of the AIA and CRL Distribution Point URLs: the issuer certificate (AIA caIssuers), the current CRL (CDP) and the OCSP responder. The service is REST only, reads the CA tables and holds no issuer keys: OCSP requests are forwarded to the backend service (privpb.Backend) and the signed responses are cached until their NextUpdate.

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

func New

func New(cfg *config.Configuration, caDb db.CaReadonlyDb, backend *shared.BackendLocator) (*Service, error)

New returns the service over the CA tables. The backend locator returns the backend the OCSP requests are forwarded to; without one every OCSP request answers tryLater.

func (*Service) CRLHandler

func (s *Service) CRLHandler() restserver.Handle

CRLHandler serves the current CRL of the issuer with the key identifier in DER, the CRL Distribution Point of the certificates it issued

func (*Service) Close

func (s *Service) Close()

Close the subservices and its resources

func (*Service) GetOcspHandler

func (s *Service) GetOcspHandler() restserver.Handle

GetOcspHandler answers an OCSP request sent as the URL-encoded base64 of its DER encoding in the path (RFC 6960 A.1); the issuer segment of the route by issuer is not needed to answer, the request carries the issuer

func (*Service) IsReady

func (s *Service) IsReady() bool

IsReady indicates that the service is ready to serve its end-points

func (*Service) IssuerHandler

func (s *Service) IssuerHandler() restserver.Handle

IssuerHandler serves the certificate of the issuer with the key identifier in DER, the AIA caIssuers URL of the certificates it issued

func (*Service) Name

func (s *Service) Name() string

Name returns the service name

func (*Service) OCSPHandler

func (s *Service) OCSPHandler() restserver.Handle

OCSPHandler answers an OCSP request posted as the body, which is read up to maxOCSPRequestSize whatever the request declares

func (*Service) RegisterRoute

func (s *Service) RegisterRoute(r restserver.Router)

RegisterRoute adds the binary AIA, CDP and OCSP routes to the overall URL router; the service has no gRPC API

Generated by gomarkdoc