identity

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Identity

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

Identity represents a loaded identity (X509 certificate and ECDSA private key pair).

func FromClient

func FromClient(c *client.Identity) (*Identity, error)

FromClient loads an identity from a client identity object.

func FromParts

FromParts creates an identity from the specified parts.

func New

func New(name string, opts ...Option) (*Identity, error)

New creates a new identity.

func (*Identity) CA

func (i *Identity) CA() *certificate.Certificate

CA returns the loaded X509 CA.

func (*Identity) Certificate

func (i *Identity) Certificate() *certificate.Certificate

Certificate returns the loaded X509 certificate.

func (*Identity) Name

func (i *Identity) Name() string

Name returns the name of the identity.

func (*Identity) PrivateKey

func (i *Identity) PrivateKey() *privatekey.PrivateKey

PrivateKey returns the loaded ECDSA private key.

func (*Identity) Sign

func (i *Identity) Sign(data ...[]byte) []byte

Sign returns a signature of the SHA256 hash over the specified data.

func (*Identity) ToClient

func (i *Identity) ToClient() *client.Identity

ToClient saves an identity into a client identity object.

type Option

type Option func(*newIdentity)

Option is a type representing an option for creating a new identity.

func UsingSigner

func UsingSigner(signer *Identity) Option

UsingSigner uses the specified identity to sign the new identity.

func WithIsCA

func WithIsCA(isCA bool) Option

WithIsCA indicates whether or not the new identity is a CA.

func WithOrganizationalUnit

func WithOrganizationalUnit(organizationalUnit string) Option

WithOrganizationalUnit sets the OU field in the new identity.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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