package pem

Import Path
	encoding/pem (on golang.org and go.dev)

Dependency Relation
	imports 6 packages, and imported by 3 packages

Involved Source Files
	d-> pem.go

Exported Type Names

type Block (struct) A Block represents a PEM encoded structure. The encoded form is: -----BEGIN Type----- Headers base64-encoded Bytes -----END Type----- where Headers is a possibly empty sequence of Key: Value lines. Bytes []byte Headers map[string]string Type string func Decode(data []byte) (p *Block, rest []byte) func crypto/x509.EncryptPEMBlock(rand io.Reader, blockType string, data, password []byte, alg x509.PEMCipher) (*Block, error) func Encode(out io.Writer, b *Block) error func EncodeToMemory(b *Block) []byte func crypto/x509.DecryptPEMBlock(b *Block, password []byte) ([]byte, error) func crypto/x509.IsEncryptedPEMBlock(b *Block) bool
Exported Values
func Decode(data []byte) (p *Block, rest []byte) Decode will find the next PEM formatted block (certificate, private key etc) in the input. It returns that block and the remainder of the input. If no PEM data is found, p is nil and the whole of the input is returned in rest.
func Encode(out io.Writer, b *Block) error Encode writes the PEM encoding of b to out.
func EncodeToMemory(b *Block) []byte EncodeToMemory returns the PEM encoding of b. If b has invalid headers and cannot be encoded, EncodeToMemory returns nil. If it is important to report details about this error case, use Encode instead.