import "encoding/pem"

プライバシーを強化したメールであるPEMデータエンコーディングを実装しています。

パッケージファイル

pem.go

Block型

BlockはPEMエンコーディングされた構造を表します。

type Block struct {

    Type    string            // The type, taken from the preamble (i.e. "RSA PRIVATE KEY").
    Headers map[string]string // Optional headers.
    Bytes   []byte            // The decoded bytes of the contents. Typically a DER encoded ASN.1 structure.
}

Decode関数

func Decode(data []byte) (p *Block, rest []byte)

Decodeはdataより次のPEM形式のブロック(証明書、秘密鍵等)を検索し、ブロックとdataの残りの部分を返します。PEMデータが見つからない場合はpはnil、restはdataとなります。