keys

package
v0.0.0-...-5f18fe2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyRsa2048 = KeyType(iota)
	KeyRsa4096
	KeyEcdsa256
	KeyEcdsa384
	KeyEcdsa521
	KeyEd25519
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	Type    KeyType // Key type
	Comment string  // Key comment
	// contains filtered or unexported fields
}

Key structure

func KeyGen

func KeyGen(t KeyType) *Key

Generate a key

func (*Key) AuthorizedKey

func (key *Key) AuthorizedKey() string

Generate public key string for inclusion into authorized_keys file

func (*Key) BinFingerprintMD5

func (key *Key) BinFingerprintMD5() []byte

Generate MD5 binary fingerprint

func (*Key) BinFingerprintSHA256

func (key *Key) BinFingerprintSHA256() []byte

Generate SHA256 binary fingerprint

func (*Key) DecodePEM

func (key *Key) DecodePEM(data []byte) error

Decode key from PEM format

func (*Key) EncodePEM

func (key *Key) EncodePEM() []byte

Encode key into PEM format

func (*Key) FingerprintMD5

func (key *Key) FingerprintMD5() string

Generate MD5 fingerprin in OpenSSH text formatt

func (*Key) FingerprintSHA256

func (key *Key) FingerprintSHA256() string

Generate SHA256 fingerprint in OpenSSH text format

func (*Key) Id

func (key *Key) Id() string

Get key id

func (*Key) MarshalJSON

func (key *Key) MarshalJSON() ([]byte, error)

Marshal key to JSON

func (*Key) Signer

func (key *Key) Signer() ssh.Signer

Obtain ssh.Signer

func (*Key) UnmarshalJSON

func (key *Key) UnmarshalJSON(data []byte) error

Unmarshal key from JSON

type KeyType

type KeyType int

Key type

func (KeyType) MarshalJSON

func (t KeyType) MarshalJSON() ([]byte, error)

Marshal KeyType to JSON

func (KeyType) String

func (t KeyType) String() string

KeyType->string

func (*KeyType) UnmarshalJSON

func (t *KeyType) UnmarshalJSON(data []byte) error

Unmarshal KeyType from JSON

Jump to

Keyboard shortcuts

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