Documentation
¶
Overview ¶
Package pem implements the PEM data encoding, which originated in Privacy Enhanced Mail. The most common use of PEM encoding today is in TLS keys and certificates. See RFC 1421.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
Encode writes the PEM encoding of b to out.
Example ¶
package main
import (
"encoding/pem"
"log"
"os"
)
func main() {
block := &pem.Block{
Type: "MESSAGE",
Headers: map[string]string{
"Animal": "Gopher",
},
Bytes: []byte("test"),
}
if err := pem.Encode(os.Stdout, block); err != nil {
log.Fatal(err)
}
}
Output: -----BEGIN MESSAGE----- Animal: Gopher dGVzdA== -----END MESSAGE-----
func EncodeToMemory ¶
EncodeToMemory returns the PEM encoding of b.