armor

package
v0.19.161 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package armor implements OpenPGP ASCII Armor, see RFC 4880. OpenPGP Armor is very similar to PEM except that it has an additional CRC checksum.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

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.
	CRC     uint32
}

A Block represents an OpenPGP armored structure.

The encoded form is:

-----BEGIN Type-----
Headers

base64-encoded Bytes
'=' base64 encoded checksum
-----END Type-----

where Headers is a possibly empty sequence of Key: Value lines.

func Decode

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.

Jump to

Keyboard shortcuts

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