utils

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCSR

func GenerateCSR(private any, req *pb.CSRRequest) (string, error)

生成CSR

func GenerateKey

func GenerateKey(req *pb.GenKeyRequest) (any, error)

生成密钥对

func GenerateRootCert

func GenerateRootCert(priv any, config *conf.RootCert) (string, string, error)

生成根证书和CRL

func LoadCRL

func LoadCRL(crlStr string) (*x509.RevocationList, error)

load crl from pem string

func LoadCSR

func LoadCSR(csr string) (*x509.CertificateRequest, error)

load CSR

func LoadCert

func LoadCert(cert string) (*x509.Certificate, error)

load 证书

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

PKCS5Padding 填充

func PKCS5UnPadding

func PKCS5UnPadding(origData []byte) []byte

PKCS5UnPadding 去填充

func PrivatePemToKey

func PrivatePemToKey(privStr string) (any, error)

func PrivateToPEM

func PrivateToPEM(priv any) (string, error)

privateKey转PEM格式

func SignCert

func SignCert(priv any, parent *x509.Certificate, csr *x509.CertificateRequest, day int) (string, *big.Int, error)

func Str2BigInt

func Str2BigInt(str string) (*big.Int, bool)

func StrToIP

func StrToIP(ips []string) (netIPs []net.IP, err error)

string格式的IP地址转换成net.IP

func TripleDESDecrypt

func TripleDESDecrypt(crypted, key []byte) ([]byte, error)

3DES解密

func TripleDESEncrypt

func TripleDESEncrypt(origData, key []byte) ([]byte, error)

3DES加密

Types

This section is empty.

Jump to

Keyboard shortcuts

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