crypto

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSigningKeyLength = 1024
)

Variables

This section is empty.

Functions

func CheckSum

func CheckSum(b []byte) string

func CheckSumFromMap

func CheckSumFromMap[T string | []byte](items map[string]T) string

func NewSigningKey

func NewSigningKey() []byte

func NewSigningKeyWithLength

func NewSigningKeyWithLength(length int) []byte

Types

type KeyPair

type KeyPair struct {
	// contains filtered or unexported fields
}

func NewKeyPair

func NewKeyPair(opts ...Option) (*KeyPair, error)

func (*KeyPair) PrivateKey

func (o *KeyPair) PrivateKey() ([]byte, error)

PrivateKey returns the private SSH key in PEM format.

func (*KeyPair) PublicKey

func (o *KeyPair) PublicKey() ([]byte, error)

PublicKey returns the public SSH key in `authorized_keys` format.

type KeyPairType

type KeyPairType string
const (
	KeyPairRsa     KeyPairType = "rsa"
	KeyPairEcdsa   KeyPairType = "ecdsa"
	KeyPairEd25519 KeyPairType = "ed25519"
)

type Option

type Option func(*KeyPair)

func WithComment

func WithComment(comment string) Option

func WithEcdsaCurve

func WithEcdsaCurve(curve elliptic.Curve) Option

func WithPassphrase

func WithPassphrase(passphrase string) Option

func WithRsaLength

func WithRsaLength(length int) Option

func WithType

func WithType(keyPairType KeyPairType) Option

Jump to

Keyboard shortcuts

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