certification

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

README

Certificates

A certificate consists of

  • a tree.
  • a signature on the tree root hash valid under some public key.
  • an optional delegation that links that public key to root public key.

Read More

Documentation

Index

Constants

View Source
const (
	// RootKey is the root key of IC main net.
	RootKey = "" /* 266-byte string literal not displayed */
	// RootSubnetID is the subnet ID of the (NNS) root subnet.
	RootSubnetID = "tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe"
)

Variables

This section is empty.

Functions

func HashAny added in v0.5.0

func HashAny(v any) ([32]byte, error)

HashAny computes the hash of any value.

func PublicBLSKeyFromDER added in v0.5.0

func PublicBLSKeyFromDER(der []byte) (*bls.PublicKey, error)

func PublicBLSKeyToDER added in v0.5.0

func PublicBLSKeyToDER(publicKey []byte) ([]byte, error)

func PublicED25519KeyFromDER added in v0.5.0

func PublicED25519KeyFromDER(der []byte) (*ed25519.PublicKey, error)

func RepresentationIndependentHash added in v0.5.0

func RepresentationIndependentHash(m []KeyValuePair) ([32]byte, error)

RepresentationIndependentHash computes the hash of a map in a representation-independent way. https://internetcomputer.org/docs/current/references/ic-interface-spec/#hash-of-map

func VerifyCertificate added in v0.4.5

func VerifyCertificate(
	certificate Certificate,
	canisterID principal.Principal,
	rootPublicKey []byte,
) error

func VerifyCertifiedData added in v0.4.5

func VerifyCertifiedData(
	certificate Certificate,
	canisterID principal.Principal,
	rootPublicKey []byte,
	certifiedData []byte,
) error

func VerifySubnetCertificate added in v0.5.0

func VerifySubnetCertificate(
	certificate Certificate,
	subnetID principal.Principal,
	rootPublicKey []byte,
) error

Types

type CanisterRange added in v0.5.0

type CanisterRange struct {
	From principal.Principal
	To   principal.Principal
}

func (*CanisterRange) UnmarshalCBOR added in v0.5.0

func (c *CanisterRange) UnmarshalCBOR(bytes []byte) error

type CanisterRanges added in v0.5.0

type CanisterRanges []CanisterRange

func (CanisterRanges) InRange added in v0.5.0

func (c CanisterRanges) InRange(canisterID principal.Principal) bool

type Certificate

type Certificate struct {
	// Tree is the certificate tree.
	Tree hashtree.HashTree `cbor:"tree"`
	// Signature is the signature of the certificate tree.
	Signature []byte `cbor:"signature"`
	// Delegation is the delegation of the certificate.
	Delegation *Delegation `cbor:"delegation"`
}

Certificate is a certificate gets returned by the IC.

func (Certificate) VerifyTime added in v0.5.0

func (c Certificate) VerifyTime(ingressExpiry time.Duration) error

VerifyTime verifies the time of a certificate.

type Delegation

type Delegation struct {
	// SubnetId is the subnet ID of the delegation.
	SubnetId principal.Principal `cbor:"subnet_id"`
	// The nested certificate typically does not itself again contain a
	// delegation, although there is no reason why agents should enforce that
	// property.
	Certificate Certificate `cbor:"certificate"`
}

Delegation is a delegation of a certificate.

func (*Delegation) UnmarshalCBOR

func (d *Delegation) UnmarshalCBOR(bytes []byte) error

UnmarshalCBOR unmarshals a delegation.

type KeyValuePair added in v0.5.0

type KeyValuePair struct {
	Key   string
	Value any
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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