keypair

package
v1.19.8 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypePemPublic   Type = "PUBLIC KEY"
	TypePemPrivate  Type = "PRIVATE KEY"
	TypeCertificate Type = "CERTIFICATE"

	FormatRSA     Format = "RSA"
	FormatDSA     Format = "DSA"
	FormatECDSA   Format = "EC"
	FormatOpenSSH Format = "OPENSSH"
)

Variables

This section is empty.

Functions

func DecodePemBlock

func DecodePemBlock(header PemType, content []byte) (*pem.Block, error)

func PemEncodeCertificate

func PemEncodeCertificate(content []byte) []byte

func PemEncodePrivate

func PemEncodePrivate(format Format, content []byte) []byte

func PemEncodePublic

func PemEncodePublic(format Format, content []byte) []byte

func PemMarshalPrivate

func PemMarshalPrivate(format Format, key crypto.PrivateKey) ([]byte, error)

func PemMarshalPublic

func PemMarshalPublic(format Format, key crypto.PublicKey) ([]byte, error)

func PemUnmarshalCertificate

func PemUnmarshalCertificate(content []byte) (*x509.Certificate, error)

func PemUnmarshalPrivate

func PemUnmarshalPrivate[T crypto.PrivateKey](format Format, content []byte) (key T, err error)

func PemUnmarshalPublic

func PemUnmarshalPublic[T crypto.PublicKey](format Format, content []byte) (key T, err error)

func SshMarshalPrivate

func SshMarshalPrivate(key crypto.PrivateKey, comment string) ([]byte, error)

func SshMarshalPublic

func SshMarshalPublic(key crypto.PublicKey) ([]byte, error)

Types

type Format

type Format string

type FormattedType

type FormattedType struct {
	Type
	Format
}

func (FormattedType) String

func (f FormattedType) String() string

type PemType

type PemType interface {
	String() string
}

type Type

type Type string

func (Type) Format

func (t Type) Format(f Format) FormattedType

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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