native

package
v3.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PrecomputedNum = 25

PrecomputedNum is the number of keys to precompute and keep cached.

Functions

func BuildPrincipals

func BuildPrincipals(hostID string, nodeName string, clusterName string, roles teleport.Roles) []string

BuildPrincipals takes a hostID, nodeName, clusterName, and role and builds a list of principals to insert into a certificate. This function is backward compatible with older clients which means:

  • If RoleAdmin is in the list of roles, only a single principal is returned: hostID
  • If nodename is empty, it is not included in the list of principals.

func GenerateKeyPair

func GenerateKeyPair(passphrase string) ([]byte, []byte, error)

GenerateKeyPair returns fresh priv/pub keypair, takes about 300ms to execute.

Types

type Keygen

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

keygen is a key generator that precomputes keys to provide quick access to public/private key pairs.

func New

func New(opts ...KeygenOption) (*Keygen, error)

New returns a new key generator.

func (*Keygen) Close

func (k *Keygen) Close()

Close stops the precomputation of keys (if enabled) and releases all resources.

func (*Keygen) GenerateHostCert

func (k *Keygen) GenerateHostCert(c services.HostCertParams) ([]byte, error)

GenerateHostCert generates a host certificate with the passed in parameters. The private key of the CA to sign the certificate must be provided.

func (*Keygen) GenerateKeyPair

func (k *Keygen) GenerateKeyPair(passphrase string) ([]byte, []byte, error)

GenerateKeyPair returns fresh priv/pub keypair, takes about 300ms to execute.

func (*Keygen) GenerateUserCert

func (k *Keygen) GenerateUserCert(c services.UserCertParams) ([]byte, error)

GenerateUserCert generates a host certificate with the passed in parameters. The private key of the CA to sign the certificate must be provided.

func (*Keygen) GetNewKeyPairFromPool

func (k *Keygen) GetNewKeyPairFromPool() ([]byte, []byte, error)

GetNewKeyPairFromPool returns precomputed key pair from the pool.

type KeygenOption

type KeygenOption func(k *Keygen) error

KeygenOption is a functional optional argument for key generator

func PrecomputeKeys

func PrecomputeKeys(count int) KeygenOption

PrecomputeKeys sets up a number of private keys to pre-compute in background, 0 disables the process

Jump to

Keyboard shortcuts

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