pkcs12

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package pkcs12 writes PKCS#12 files (RFC 7292) for the key export (PHASE1 step 18): the private key in a PBES2-encrypted bag (PBKDF2 with HMAC-SHA256, AES-256-CBC), the certificates in a plain bag, and an HMAC-SHA256 integrity MAC – what OpenSSL 3 writes by default and what Windows 10 (1709+), macOS, Java and OpenSSL import. Only encoding: the server never reads PKCS#12 files.

Index

Constants

View Source
const (
	KeyIterations = 600_000
	MACIterations = 2048 // the PKCS#12 KDF runs SHA-256 this often; OpenSSL's default
	MinPassword   = 12
)

Iterations of PBKDF2 for the key and of the PKCS#12 KDF for the MAC. OWASP 2023 recommends 600,000 for PBKDF2-HMAC-SHA256.

Variables

This section is empty.

Functions

func Encode

func Encode(rnd io.Reader, pkcs8 []byte, chain []*x509.Certificate, name, password string) ([]byte, error)

Encode builds a PKCS#12 file with the PKCS#8 key, its certificate first, then the chain (intermediates). name is the friendly name importers show. rnd nil means crypto/rand.

Types

This section is empty.

Jump to

Keyboard shortcuts

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