Documentation ¶
Overview ¶
Package certificate contains functions to load an Apple APNs PKCS#12 or PEM certificate from either an in memory byte array or a local file.
Index ¶
- Variables
- func FromP12Bytes(bytes []byte, password string) (tls.Certificate, error)
- func FromP12File(filename string, password string) (tls.Certificate, error)
- func FromPemBytes(bytes []byte, password string) (tls.Certificate, error)
- func FromPemFile(filename string, password string) (tls.Certificate, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrFailedToDecryptKey = errors.New("failed to decrypt private key") ErrFailedToParsePrivateKey = errors.New("failed to parse private key") ErrFailedToParseCertificate = errors.New("failed to parse certificate PEM data") ErrNoPrivateKey = errors.New("no private key") ErrNoCertificate = errors.New("no certificate") )
Possible errors when parsing a certificate.
Functions ¶
func FromP12Bytes ¶
func FromP12Bytes(bytes []byte, password string) (tls.Certificate, error)
FromP12Bytes loads a PKCS#12 certificate from an in memory byte array and returns a tls.Certificate.
Use "" as the password argument if the PKCS#12 certificate is not password protected.
func FromP12File ¶
func FromP12File(filename string, password string) (tls.Certificate, error)
FromP12File loads a PKCS#12 certificate from a local file and returns a tls.Certificate.
Use "" as the password argument if the PKCS#12 certificate is not password protected.
func FromPemBytes ¶
func FromPemBytes(bytes []byte, password string) (tls.Certificate, error)
FromPemBytes loads a PEM certificate from an in memory byte array and returns a tls.Certificate. This function is similar to the crypto/tls X509KeyPair function, however it supports PEM files with the cert and key combined, as well as password protected keys which are both common with APNs certificates.
Use "" as the password argument if the PEM certificate is not password protected.
func FromPemFile ¶
func FromPemFile(filename string, password string) (tls.Certificate, error)
FromPemFile loads a PEM certificate from a local file and returns a tls.Certificate. This function is similar to the crypto/tls LoadX509KeyPair function, however it supports PEM files with the cert and key combined in the same file, as well as password protected key files which are both common with APNs certificates.
Use "" as the password argument if the PEM certificate is not password protected.
Types ¶
This section is empty.