Documentation
¶
Index ¶
- func CertificateInfo(certPath string) (*x509.Certificate, error)
- func FormatIp(ipStr string) (string, error)
- func GenKeyAndCert(hosts []string, keyFile, certFile string, types int) error
- func GenerateKey(root bool) (*rsa.PrivateKey, error)
- func GenerateRoot() (*x509.Certificate, *rsa.PrivateKey, error)
- func GmCertificateInfo(certPath string) (*x509.Certificate, error)
- func IsIP(host string) bool
- func IsIPv4(ip string) bool
- func IsIPv6(ip string) bool
- func IsSameIP(ipFirst, ipSecond string) bool
- func Pkcs12Encode(cert, key []byte, password string) (string, error)
- func ReadGmPrivKey(key []byte) (*sm2.PrivateKey, error)
- func ReadGmRootCert(cert []byte) (*x509.Certificate, error)
- func ReadPrivKey(key []byte) (*rsa.PrivateKey, error)
- func ReadPrivKeyFile(filename string) (*rsa.PrivateKey, error)
- func ReadRootCert(cert []byte) (*x509.Certificate, error)
- func ReadRootCertFile(filename string) (*x509.Certificate, error)
- func SerialNumber() *big.Int
- func UserAndHostname() string
- func WritePEM(filepath string, pem []byte) error
- type CACert
- type GmCACert
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CertificateInfo ¶
func CertificateInfo(certPath string) (*x509.Certificate, error)
func GenKeyAndCert ¶ added in v1.6.3
GenKeyAndCert 生成密钥和证书 types 0 为签名证书,1 为加密证书
func GenerateKey ¶
func GenerateKey(root bool) (*rsa.PrivateKey, error)
func GenerateRoot ¶
func GenerateRoot() (*x509.Certificate, *rsa.PrivateKey, error)
GenerateRoot return cert, privDER, nil
func GmCertificateInfo ¶ added in v1.6.7
func GmCertificateInfo(certPath string) (*x509.Certificate, error)
func Pkcs12Encode ¶ added in v1.3.2
func ReadGmPrivKey ¶ added in v1.6.7
func ReadGmPrivKey(key []byte) (*sm2.PrivateKey, error)
func ReadGmRootCert ¶ added in v1.6.7
func ReadGmRootCert(cert []byte) (*x509.Certificate, error)
func ReadPrivKey ¶
func ReadPrivKey(key []byte) (*rsa.PrivateKey, error)
func ReadPrivKeyFile ¶
func ReadPrivKeyFile(filename string) (*rsa.PrivateKey, error)
func ReadRootCert ¶
func ReadRootCert(cert []byte) (*x509.Certificate, error)
func ReadRootCertFile ¶
func ReadRootCertFile(filename string) (*x509.Certificate, error)
func SerialNumber ¶ added in v1.6.5
func UserAndHostname ¶ added in v1.6.5
func UserAndHostname() string
Types ¶
type CACert ¶
type CACert struct {
Cert *x509.Certificate
Key *rsa.PrivateKey
}
type GmCACert ¶ added in v1.6.6
type GmCACert struct {
Cert *x509.Certificate
Key *sm2.PrivateKey
Hosts []string // 证书支持的主机名列表
}
GmCACert 国密CA证书结构体
func GenerateGmRoot ¶ added in v1.6.6
GenerateGmRoot 生成国密根证书
func (*GmCACert) GenerateGmCert ¶ added in v1.6.6
GenerateGmCert 使用国密根证书生成子证书 types 0 为签名证书,1 为加密证书
func (*GmCACert) SaveGmCertAndKey ¶ added in v1.6.6
SaveGmCertAndKey 保存国密证书和密钥到文件
Click to show internal directories.
Click to hide internal directories.