certificate_visitor.go 1021 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2021 Tencent Inc. All rights reserved.
  2. package core
  3. import (
  4. "context"
  5. "crypto/x509"
  6. )
  7. // CertificateGetter 平台证书提供器
  8. type CertificateGetter interface {
  9. // Get 获取证书序列号对应的平台证书
  10. Get(ctx context.Context, serialNumber string) (*x509.Certificate, bool)
  11. // GetAll 获取平台证书Map
  12. GetAll(ctx context.Context) map[string]*x509.Certificate
  13. // GetNewestSerial 获取最新的平台证书的证书序列号
  14. GetNewestSerial(ctx context.Context) string
  15. }
  16. // CertificateExporter 平台证书导出器,可获取平台证书内容,
  17. type CertificateExporter interface {
  18. // Export 获取证书序列号对应的平台证书内容
  19. Export(ctx context.Context, serialNumber string) (string, bool)
  20. // ExportAll 获取平台证书内容Map
  21. ExportAll(ctx context.Context) map[string]string
  22. }
  23. // CertificateVisitor 证书访问器,集 CertificateGetter 与 CertificateExporter 于一体
  24. type CertificateVisitor interface {
  25. CertificateGetter
  26. CertificateExporter
  27. }