Documentation ¶
Index ¶
- Constants
- func CreateCertificateRequest(template *x509.CertificateRequest) (csr []byte, pemBytes []byte, err error)
- func EncodeCertificateToPEM(derBytes []byte) []byte
- func EncodePrivateKeyToPEM(privateKey PrivateKey) ([]byte, error)
- func ExtKeyUsageToStr(keyUsage x509.ExtKeyUsage) string
- func KeyUsageToStr(keyUsage x509.KeyUsage) string
- func ParseCSR(csrBytes []byte) (*x509.CertificateRequest, error)
- func ParseCertificate(certBytes []byte) (*x509.Certificate, error)
- func ParseCertificateChain(pemBytes []byte) ([]*x509.Certificate, error)
- func PrivateKeyAlgorithm(priv PrivateKey) x509.SignatureAlgorithm
- func RandomSerial() *big.Int
- func StrToExtKeyUsage(s string) x509.ExtKeyUsage
- func StrToKeyUsage(s string) x509.KeyUsage
- func ValidCertificateAlgorithm(isCA bool, keyAlgorithm x509.SignatureAlgorithm, ...) error
- func VerifySignature(pub PublicKey, hash []byte, signature []byte) bool
- type PrivateKey
- type PublicKey
Constants ¶
View Source
const ( CertificatePEMBlockType = "CERTIFICATE" CrlPEMBlockType = "X509 CRL" CsrPEMBlockType = "CERTIFICATE REQUEST" OldCsrPEMBlockType = "NEW CERTIFICATE REQUEST" RsaPrivateKeyPEMBlockType = "RSA PRIVATE KEY" EcdsaPrivateKeyPEMBlockType = "EC PRIVATE KEY" Pkcs8PrivateKeyPEMBlockType = "PRIVATE KEY" EncryptedPKCS8PrivateKeyPEMBLockType = "ENCRYPTED PRIVATE KEY" )
Variables ¶
This section is empty.
Functions ¶
func CreateCertificateRequest ¶
func CreateCertificateRequest(template *x509.CertificateRequest) (csr []byte, pemBytes []byte, err error)
CreateCertificateRequest create CSR and return PEM privateKey: signer private key
func EncodeCertificateToPEM ¶
func EncodePrivateKeyToPEM ¶
func EncodePrivateKeyToPEM(privateKey PrivateKey) ([]byte, error)
func ExtKeyUsageToStr ¶
func ExtKeyUsageToStr(keyUsage x509.ExtKeyUsage) string
func KeyUsageToStr ¶
func ParseCSR ¶
func ParseCSR(csrBytes []byte) (*x509.CertificateRequest, error)
ParseCSR parse x509 CSR PEM block
func ParseCertificate ¶
func ParseCertificate(certBytes []byte) (*x509.Certificate, error)
ParseCertificate parse x509 certificate PEM block or DER bytes
func ParseCertificateChain ¶
func ParseCertificateChain(pemBytes []byte) ([]*x509.Certificate, error)
func PrivateKeyAlgorithm ¶
func PrivateKeyAlgorithm(priv PrivateKey) x509.SignatureAlgorithm
PrivateKeyAlgorithm return private key algorithm
func RandomSerial ¶
func StrToExtKeyUsage ¶
func StrToExtKeyUsage(s string) x509.ExtKeyUsage
func StrToKeyUsage ¶
func ValidCertificateAlgorithm ¶
func ValidCertificateAlgorithm(isCA bool, keyAlgorithm x509.SignatureAlgorithm, signatureAlgorithm x509.SignatureAlgorithm) error
ValidCertificateAlgorithm check
Types ¶
type PrivateKey ¶
type PrivateKey interface { crypto.PrivateKey crypto.Signer }
PublicKey PrivateKey and Signer interfaces crypto.PrivateKey의 설명을 보면 함수가 다 있다고 함.
func GenerateKey ¶
func GenerateKey(algorithm x509.SignatureAlgorithm) (privateKey PrivateKey, err error)
GenerateKey generate private and public key pair
func ParsePrivateKey ¶
func ParsePrivateKey(keyPemBytes []byte) (PrivateKey, error)
ParsePrivateKey parse pem formatted priate key
Click to show internal directories.
Click to hide internal directories.