keypair

package
v1.19.28 Latest Latest
Warning

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

Go to latest
Published: May 17, 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 PemMarshalPKCS8Private added in v1.19.16

func PemMarshalPKCS8Private(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 PemUnmarshalPKCS8Private added in v1.19.16

func PemUnmarshalPKCS8Private[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