Documentation ¶
Index ¶
- func Deserialize(data []byte, keyProc cryptography.KeyProcessor) (nodeinfo.AuthorizationCertificate, error)
- func NewUnsignedCertificate(baseCert nodeinfo.Certificate, pKey string, role string, ref string) (nodeinfo.Certificate, error)
- func Serialize(authCert nodeinfo.AuthorizationCertificate) ([]byte, error)
- func SignCert(signer cryptography.Signer, pKey, role, registeredNodeRef string) (*cryptography.Signature, error)
- func VerifyAuthorizationCertificate(cs cryptography.Service, discoveryNodes []nodeinfo.DiscoveryNode, ...) (bool, error)
- type AuthorizationCertificate
- func (authCert *AuthorizationCertificate) GetDiscoverySigns() map[reference.Global][]byte
- func (authCert *AuthorizationCertificate) GetNodeRef() reference.Global
- func (authCert *AuthorizationCertificate) GetPublicKey() crypto.PublicKey
- func (authCert *AuthorizationCertificate) GetRole() member.PrimaryRole
- func (authCert *AuthorizationCertificate) SerializeNodePart() []byte
- func (authCert *AuthorizationCertificate) SignNodePart(key crypto.PrivateKey) ([]byte, error)
- type BootstrapNode
- type Certificate
- func (cert *Certificate) Dump() (string, error)
- func (cert *Certificate) GetDiscoveryNodes() []nodeinfo.DiscoveryNode
- func (cert *Certificate) GetMajorityRule() int
- func (cert *Certificate) GetMinRoles() (uint, uint, uint)
- func (cert *Certificate) SerializeNetworkPart() []byte
- func (cert *Certificate) SignNetworkPart(key crypto.PrivateKey) ([]byte, error)
- type CertificateManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deserialize ¶
func Deserialize(data []byte, keyProc cryptography.KeyProcessor) (nodeinfo.AuthorizationCertificate, error)
Deserialize deserializes data to AuthorizationCertificate interface
func NewUnsignedCertificate ¶
func NewUnsignedCertificate(baseCert nodeinfo.Certificate, pKey string, role string, ref string) (nodeinfo.Certificate, error)
NewUnsignedCertificate creates new unsigned certificate by copying
func Serialize ¶
func Serialize(authCert nodeinfo.AuthorizationCertificate) ([]byte, error)
Serialize serializes AuthorizationCertificate interface
func SignCert ¶
func SignCert(signer cryptography.Signer, pKey, role, registeredNodeRef string) (*cryptography.Signature, error)
SignCert is used for signing certificate by Discovery node
func VerifyAuthorizationCertificate ¶
func VerifyAuthorizationCertificate(cs cryptography.Service, discoveryNodes []nodeinfo.DiscoveryNode, authCert nodeinfo.AuthorizationCertificate) (bool, error)
VerifyAuthorizationCertificate verifies certificate from some node
Types ¶
type AuthorizationCertificate ¶
type AuthorizationCertificate struct { PublicKey string `json:"public_key"` Reference string `json:"reference"` Role string `json:"role"` DiscoverySigns map[reference.Global][]byte `json:"-" codec:"discoverysigns"` // contains filtered or unexported fields }
AuthorizationCertificate holds info about node from it certificate
func (*AuthorizationCertificate) GetDiscoverySigns ¶
func (authCert *AuthorizationCertificate) GetDiscoverySigns() map[reference.Global][]byte
GetDiscoverySigns return map of discovery nodes signs
func (*AuthorizationCertificate) GetNodeRef ¶
func (authCert *AuthorizationCertificate) GetNodeRef() reference.Global
GetNodeRef returns reference from node certificate
func (*AuthorizationCertificate) GetPublicKey ¶
func (authCert *AuthorizationCertificate) GetPublicKey() crypto.PublicKey
GetPublicKey returns public key reference from node certificate
func (*AuthorizationCertificate) GetRole ¶
func (authCert *AuthorizationCertificate) GetRole() member.PrimaryRole
GetRole returns role from node certificate
func (*AuthorizationCertificate) SerializeNodePart ¶
func (authCert *AuthorizationCertificate) SerializeNodePart() []byte
SerializeNodePart returns some node info decoded in bytes
func (*AuthorizationCertificate) SignNodePart ¶
func (authCert *AuthorizationCertificate) SignNodePart(key crypto.PrivateKey) ([]byte, error)
SignNodePart signs node part in certificate
type BootstrapNode ¶
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 ¶
func NewBootstrapNode(pubKey crypto.PublicKey, publicKey, host, noderef, role string) *BootstrapNode
func (*BootstrapNode) GetHost ¶
func (bn *BootstrapNode) GetHost() string
GetHost returns host of bootstrap node
func (*BootstrapNode) GetNodeRef ¶
func (bn *BootstrapNode) GetNodeRef() reference.Global
GetNodeRef returns reference of bootstrap node
func (*BootstrapNode) GetNodeSign ¶
func (bn *BootstrapNode) GetNodeSign() []byte
NodeSign returns signed information about some node
func (*BootstrapNode) GetPublicKey ¶
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"` BootstrapNodes []BootstrapNode `json:"bootstrap_nodes"` // contains filtered or unexported fields }
Certificate holds info about certificate
func ReadCertificate ¶
func ReadCertificate(publicKey crypto.PublicKey, keyProcessor cryptography.KeyProcessor, certPath string) (*Certificate, error)
ReadCertificate constructor creates new Certificate component
func ReadCertificateFromReader ¶
func ReadCertificateFromReader(publicKey crypto.PublicKey, keyProcessor cryptography.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 ¶
func (cert *Certificate) GetDiscoveryNodes() []nodeinfo.DiscoveryNode
GetDiscoveryNodes return bootstrap nodes array
func (*Certificate) GetMajorityRule ¶
func (cert *Certificate) GetMajorityRule() int
GetMajorityRule returns majority rule number
func (*Certificate) GetMinRoles ¶
func (cert *Certificate) GetMinRoles() (uint, uint, uint)
func (*Certificate) SerializeNetworkPart ¶
func (cert *Certificate) SerializeNetworkPart() []byte
func (*Certificate) SignNetworkPart ¶
func (cert *Certificate) SignNetworkPart(key crypto.PrivateKey) ([]byte, error)
SignNetworkPart signs network part in certificate
type CertificateManager ¶
type CertificateManager struct {
// contains filtered or unexported fields
}
CertificateManager is a component for working with current node certificate
func NewCertificateManager ¶
func NewCertificateManager(cert nodeinfo.Certificate) *CertificateManager
NewCertificateManager returns new CertificateManager instance
func NewManagerReadCertificate ¶
func NewManagerReadCertificate(publicKey crypto.PublicKey, keyProcessor cryptography.KeyProcessor, certPath string) (*CertificateManager, error)
NewManagerReadCertificate constructor creates new CertificateManager component
func (*CertificateManager) GetCertificate ¶
func (m *CertificateManager) GetCertificate() nodeinfo.Certificate
GetCertificate returns current node certificate