certificate

package
v0.0.0-...-d8025ed Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: MIT Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToDecryptKey           = errors.New("failed to decrypt private key")
	ErrFailedToParsePKCS1PrivateKey = errors.New("failed to parse PKCS1 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 pem 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.

Jump to

Keyboard shortcuts

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