cryptox

package
v0.0.0-...-19e231a Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cryptox provides extensions to standard crypto functionality.

Index

Constants

View Source
const (
	PEM_X509     string = "CERTIFICATE"
	PEM_RSA             = "RSA PRIVATE KEY"
	PEM_PKCS8           = "ENCRYPTED PRIVATE KEY"
	PEM_PKCS8INF        = "PRIVATE KEY"
)

Variables

View Source
var (
	ErrPKCS8NotPem           = errors.New("PKCS8PrivateKey: invalid .p8 PEM file")
	ErrPKCS8NotECDSA         = errors.New("PKCS8PrivateKey: key must be of type ecdsa.PrivateKey")
	ErrPEMMissingPrivateKey  = errors.New("PEM: private key not found")
	ErrPEMMissingCertificate = errors.New("PEM: certificate not found")
)

Functions

func ClientCertFromP12Bytes

func ClientCertFromP12Bytes(bytes []byte, password string) (tls.Certificate, error)

ClientCertFromP12Bytes 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 ClientCertFromP12File

func ClientCertFromP12File(filename string, password string) (tls.Certificate, error)

ClientCertFromP12File 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 ClientCertFromPemBytes

func ClientCertFromPemBytes(bytes []byte, password string) (tls.Certificate, error)

ClientCertFromPemBytes 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 ClientCertFromPemFile

func ClientCertFromPemFile(filename string, password string) (tls.Certificate, error)

ClientCertFromPemFile 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.

func PKCS8PrivateKeyFromBytes

func PKCS8PrivateKeyFromBytes(bytes []byte) (*ecdsa.PrivateKey, error)

PKCS8PrivateKeyFromBytes decodes a .p8 certificate from an in memory byte slice and returns an *ecdsa.PrivateKey.

func PKCS8PrivateKeyFromFile

func PKCS8PrivateKeyFromFile(filename string) (*ecdsa.PrivateKey, error)

PKCS8PrivateKeyFromFile loads a .p8 certificate from a local file and returns a *ecdsa.PrivateKey.

func RootCAFromPemBytes

func RootCAFromPemBytes(bytes []byte) (tls.Certificate, error)

RootCAFromPemBytes loads a PEM certificate from an in memory byte array and returns a tls.Certificate.

func RootCAFromPemFile

func RootCAFromPemFile(filename string) (tls.Certificate, error)

RootCAFromPemFile loads a PEM certificate from a local file and returns a tls.Certificate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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