service

package
v0.0.0-...-d296433 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 18 Imported by: 0

README

Service

CertService 包含了生成密钥、生成 CSR、获取证书、签名 CSR、撤销证书和导出 PKCS#12 等功能,基于kratos实现:

  1. 生成密钥GenKey 方法用于生成一个新的私钥,并返回其字符串表示。
  2. 生成 CSRCSR 方法用于生成一个新的 CSR,并返回其字符串表示。
  3. 获取证书GetCert 方法从存储库中获取证书,如果证书不存在或获取失败,则返回错误。
  4. 签名 CSRCASignCSR 方法使用 CA 的私钥和证书签名 CSR,并保存生成的证书。
  5. 撤销证书RevokeCert 方法用于撤销证书,包括加载当前 CRL、创建新的 CRL、更新 CRL、保存 CRL 等操作。
  6. 导出 PKCS#12PKCS12 方法用于生成 PKCS#12 格式的证书,并返回其字符串表示。

结构定义详见cert.proto

TODO

  • 证书撤销列表(CRL)更新
  • 目前证书、私钥等在服务端是以common进行区分的,证书考虑以证书编号serial_number进行区分
  • PKCS12接口目前仅支持生成,后续需要增加导出的功能
  • 多级证书签发功能
  • 证书解析功能
  • 私钥加密功能
    • 3DES加解密功能已新增

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewCertService)

ProviderSet is service providers.

Functions

This section is empty.

Types

type CertService

type CertService struct {
	pb.UnimplementedCertServer
	// contains filtered or unexported fields
}

func NewCertService

func NewCertService(cert *biz.CAUseCase, root *conf.RootCert, logger log.Logger) (*CertService, error)

func (*CertService) CASignCSR

func (*CertService) CSR

func (s *CertService) CSR(ctx context.Context, req *pb.CSRRequest) (*pb.CSRResponse, error)

func (*CertService) GenKey

func (s *CertService) GenKey(ctx context.Context, req *pb.GenKeyRequest) (*pb.GenKeyResponse, error)

func (*CertService) GetCert

func (s *CertService) GetCert(ctx context.Context, req *pb.CertRequest) (*pb.CertResponse, error)

func (*CertService) PKCS12

func (s *CertService) PKCS12(ctx context.Context, req *pb.PKCS12Request) (*pb.PKCS12Response, error)

func (*CertService) RevokeCert

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳