identity

package
v0.0.0-...-85e540a Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0 Imports: 16 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 FromBase64

func FromBase64(data string) (*Identity, error)

FromBase64 loads an identity from a base64 encoded string.

func FromBytes

func FromBytes(data []byte) (*Identity, error)

FromBytes loads an identity from JSON data.

func FromFile

func FromFile(file string) (*Identity, error)

FromFile loads an identity from a JSON file.

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) ToBase64

func (i *Identity) ToBase64() (string, error)

ToBase64 saves the identity to a base64 encoded string.

func (*Identity) ToBytes

func (i *Identity) ToBytes() ([]byte, error)

ToBytes saves the identity to JSON data.

func (*Identity) ToFile

func (i *Identity) ToFile(file string) error

ToFile saves the identity to a JSON file.

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