certificate

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deserialize added in v0.7.5

func Deserialize(data []byte, keyProc core.KeyProcessor) (core.AuthorizationCertificate, error)

Deserialize deserializes data to AuthorizationCertificate interface

func Serialize added in v0.7.5

func Serialize(authCert core.AuthorizationCertificate) ([]byte, error)

Serialize serializes AuthorizationCertificate interface

Types

type AuthorizationCertificate added in v0.7.5

type AuthorizationCertificate struct {
	PublicKey      string                    `json:"public_key"`
	Reference      string                    `json:"reference"`
	Role           string                    `json:"role"`
	DiscoverySigns map[core.RecordRef][]byte `json:"-" codec:"discoverysigns"`
	// contains filtered or unexported fields
}

AuthorizationCertificate holds info about node from it certificate

func (*AuthorizationCertificate) GetDiscoverySigns added in v0.7.5

func (authCert *AuthorizationCertificate) GetDiscoverySigns() map[core.RecordRef][]byte

GetDiscoverySigns return map of discovery nodes signs

func (*AuthorizationCertificate) GetNodeRef added in v0.7.5

func (authCert *AuthorizationCertificate) GetNodeRef() *core.RecordRef

GetNodeRef returns reference from node certificate

func (*AuthorizationCertificate) GetPublicKey added in v0.7.5

func (authCert *AuthorizationCertificate) GetPublicKey() crypto.PublicKey

GetPublicKey returns public key reference from node certificate

func (*AuthorizationCertificate) GetRole added in v0.7.5

func (authCert *AuthorizationCertificate) GetRole() core.StaticRole

GetRole returns role from node certificate

func (*AuthorizationCertificate) SerializeNodePart added in v0.7.5

func (authCert *AuthorizationCertificate) SerializeNodePart() []byte

SerializeNodePart returns some node info decoded in bytes

func (*AuthorizationCertificate) SignNodePart added in v0.7.5

func (authCert *AuthorizationCertificate) SignNodePart(key crypto.PrivateKey) ([]byte, error)

SignNodePart signs node part in certificate

type BootstrapNode added in v0.6.2

type BootstrapNode struct {
	PublicKey   string `json:"public_key"`
	Host        string `json:"host"`
	NetworkSign []byte `json:"network_sign"`
	NodeSign    []byte `json:"node_sign"`
	NodeRef     string `json:"node_ref"`
	// contains filtered or unexported fields
}

BootstrapNode holds info about bootstrap nodes

func NewBootstrapNode added in v0.7.5

func NewBootstrapNode(pubKey crypto.PublicKey, publicKey, host, noderef string) *BootstrapNode

func (*BootstrapNode) GetHost added in v0.6.3

func (bn *BootstrapNode) GetHost() string

GetHost returns host of bootstrap node

func (*BootstrapNode) GetNodeRef added in v0.6.3

func (bn *BootstrapNode) GetNodeRef() *core.RecordRef

GetNodeRef returns reference of bootstrap node

func (*BootstrapNode) GetNodeSign added in v0.7.5

func (bn *BootstrapNode) GetNodeSign() []byte

NodeSign returns signed information about some node

func (*BootstrapNode) GetPublicKey added in v0.6.3

func (bn *BootstrapNode) GetPublicKey() crypto.PublicKey

GetPublicKey returns public key reference of bootstrap node

type Certificate

type Certificate struct {
	AuthorizationCertificate
	MajorityRule int `json:"majority_rule"`
	MinRoles     struct {
		Virtual       uint `json:"virtual"`
		HeavyMaterial uint `json:"heavy_material"`
		LightMaterial uint `json:"light_material"`
	} `json:"min_roles"`
	PulsarPublicKeys    []string        `json:"pulsar_public_keys"`
	RootDomainReference string          `json:"root_domain_ref"`
	BootstrapNodes      []BootstrapNode `json:"bootstrap_nodes"`
	// contains filtered or unexported fields
}

Certificate holds info about certificate

func NewCertificatesWithKeys added in v0.6.2

func NewCertificatesWithKeys(publicKey crypto.PublicKey, keyProcessor core.KeyProcessor) (*Certificate, error)

NewCertificatesWithKeys generate certificate from given keys DEPRECATED, this method generates invalid certificate

func ReadCertificate added in v0.6.3

func ReadCertificate(publicKey crypto.PublicKey, keyProcessor core.KeyProcessor, certPath string) (*Certificate, error)

ReadCertificate constructor creates new Certificate component

func ReadCertificateFromReader added in v0.7.5

func ReadCertificateFromReader(publicKey crypto.PublicKey, keyProcessor core.KeyProcessor, reader io.Reader) (*Certificate, error)

ReadCertificateFromReader constructor creates new Certificate component

func (*Certificate) Dump

func (cert *Certificate) Dump() (string, error)

Dump returns all info about certificate in json format

func (*Certificate) GetDiscoveryNodes added in v0.6.3

func (cert *Certificate) GetDiscoveryNodes() []core.DiscoveryNode

GetDiscoveryNodes return bootstrap nodes array

func (*Certificate) GetMajorityRule added in v0.8.3

func (cert *Certificate) GetMajorityRule() int

GetMajorityRule returns majority rule number

func (*Certificate) GetMinRoles added in v0.8.3

func (cert *Certificate) GetMinRoles() (uint, uint, uint)

func (*Certificate) GetRootDomainReference added in v0.6.3

func (cert *Certificate) GetRootDomainReference() *core.RecordRef

GetRootDomainReference returns RootDomain reference

func (*Certificate) SerializeNetworkPart added in v0.7.5

func (cert *Certificate) SerializeNetworkPart() []byte

func (*Certificate) SignNetworkPart added in v0.6.3

func (cert *Certificate) SignNetworkPart(key crypto.PrivateKey) ([]byte, error)

SignNetworkPart signs network part in certificate

type CertificateManager added in v0.7.5

type CertificateManager struct {
	CS core.CryptographyService `inject:""`
	// contains filtered or unexported fields
}

CertificateManager is a component for working with current node certificate

func NewCertificateManager added in v0.7.5

func NewCertificateManager(cert core.Certificate) *CertificateManager

NewCertificateManager returns new CertificateManager instance

func NewManagerCertificateWithKeys added in v0.7.5

func NewManagerCertificateWithKeys(publicKey crypto.PublicKey, keyProcessor core.KeyProcessor) (*CertificateManager, error)

NewManagerCertificateWithKeys generate manager with certificate from given keys DEPRECATED, this method generates invalid certificate, remove it after pulsar tests refactor

func NewManagerReadCertificate added in v0.7.5

func NewManagerReadCertificate(publicKey crypto.PublicKey, keyProcessor core.KeyProcessor, certPath string) (*CertificateManager, error)

NewManagerReadCertificate constructor creates new CertificateManager component

func NewManagerReadCertificateFromReader added in v0.7.5

func NewManagerReadCertificateFromReader(publicKey crypto.PublicKey, keyProcessor core.KeyProcessor, reader io.Reader) (*CertificateManager, error)

NewManagerReadCertificateFromReader constructor creates new CertificateManager component

func (*CertificateManager) GetCertificate added in v0.7.5

func (m *CertificateManager) GetCertificate() core.Certificate

GetCertificate returns current node certificate

func (*CertificateManager) NewUnsignedCertificate added in v0.7.5

func (m *CertificateManager) NewUnsignedCertificate(pKey string, role string, ref string) (core.Certificate, error)

NewUnsignedCertificate returns new certificate

func (*CertificateManager) VerifyAuthorizationCertificate added in v0.7.5

func (m *CertificateManager) VerifyAuthorizationCertificate(authCert core.AuthorizationCertificate) (bool, error)

VerifyAuthorizationCertificate verifies certificate from some node

Jump to

Keyboard shortcuts

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