v0.12.3 Latest Latest

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

Go to latest
Published: Mar 2, 2017 License: MPL-2.0, MIT Imports: 16 Imported by: 0


This is a fork of the from the original PKCS#12 parsing code published in the Azure repository go-pkcs12. This fork adds serializing a x509 certificate and private key as PKCS#12 binary blob (aka .PFX file). Due to the specific nature of this code it was not accepted for inclusion in the official Go crypto repository.

The methods used for decoding PKCS#12 have been moved to the test files to further discourage the use of this library for decoding. Please use the official pkcs12 library for decode support.



Package pkcs12 provides some implementations of PKCS#12.

This implementation is distilled from and referenced documents. It is intended for decoding P12/PFX-stored certificate+key for use with the crypto/tls package.



This section is empty.


View Source
var (
	// ErrDecryption represents a failure to decrypt the input.
	ErrDecryption = errors.New("pkcs12: decryption error, incorrect padding")

	// ErrIncorrectPassword is returned when an incorrect password is detected.
	// Usually, P12/PFX data is signed to be able to verify the password.
	ErrIncorrectPassword = errors.New("pkcs12: decryption password incorrect")


func Encode

func Encode(derBytes []byte, privateKey interface{}, password string) ([]byte, error)

Encode converts a certificate and a private key to the PKCS#12 byte stream format.

derBytes is a DER encoded certificate. privateKey is an RSA


type EncodeError

type EncodeError string

func (EncodeError) Error

func (e EncodeError) Error() string

type NotImplementedError

type NotImplementedError string

NotImplementedError indicates that the input is not currently supported.

func (NotImplementedError) Error

func (e NotImplementedError) Error() string


Path Synopsis
Package rc2 implements the RC2 cipher This code is licensed under the MIT license.
Package rc2 implements the RC2 cipher This code is licensed under the MIT license.

Jump to

Keyboard shortcuts

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