certificate

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 12 Imported by: 43

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 insolar.KeyProcessor) (insolar.AuthorizationCertificate, error)

Deserialize deserializes data to AuthorizationCertificate interface

func NewUnsignedCertificate added in v0.9.0

func NewUnsignedCertificate(baseCert insolar.Certificate, pKey string, role string, ref string) (insolar.Certificate, error)

NewUnsignedCertificate creates new unsigned certificate by copying

func Serialize added in v0.7.5

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

Serialize serializes AuthorizationCertificate interface

func SignCert added in v0.9.0

func SignCert(signer insolar.Signer, pKey, role, registeredNodeRef string) (*insolar.Signature, error)

SignCert is used for signing certificate by Discovery node

func VerifyAuthorizationCertificate added in v0.9.0

func VerifyAuthorizationCertificate(cs insolar.CryptographyService, discoveryNodes []insolar.DiscoveryNode, authCert insolar.AuthorizationCertificate) (bool, error)

VerifyAuthorizationCertificate verifies certificate from some node

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[insolar.Reference][]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[insolar.Reference][]byte

GetDiscoverySigns return map of discovery nodes signs

func (*AuthorizationCertificate) GetNodeRef added in v0.7.5

func (authCert *AuthorizationCertificate) GetNodeRef() *insolar.Reference

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() insolar.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"`
	NodeRole    string `json:"node_role"`
	// 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, role 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() *insolar.Reference

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

func (*BootstrapNode) GetRole added in v0.9.0

func (bn *BootstrapNode) GetRole() insolar.StaticRole

GetRole returns role 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 ReadCertificate added in v0.6.3

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

ReadCertificate constructor creates new Certificate component

func ReadCertificateFromReader added in v0.7.5

func ReadCertificateFromReader(publicKey crypto.PublicKey, keyProcessor insolar.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() []insolar.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() *insolar.Reference

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 {
	// 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 insolar.Certificate) *CertificateManager

NewCertificateManager returns new CertificateManager instance

func NewManagerReadCertificate added in v0.7.5

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

NewManagerReadCertificate constructor creates new CertificateManager component

func (*CertificateManager) GetCertificate added in v0.7.5

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

GetCertificate returns current node certificate

Jump to

Keyboard shortcuts

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