go1.20.5
GoThrough

pem.Decode

// 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 Decode(data []byte) (p *Block, rest []byte)

pem.Encode

// Encode writes the PEM encoding of b to out. func Encode(out io.Writer, b *Block) error

pem.EncodeToMemory

// 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. func EncodeToMemory(b *Block) []byte