cim

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: GPL-3.0 Imports: 24 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCertP256

func CreateCertP256(priv *ecdsa.PrivateKey) (cert []byte)

func CreateIdentity2

func CreateIdentity2(priv, priv2 *ecdsa.PrivateKey, name string) bool

func ReadPemFileUsePath

func ReadPemFileUsePath(path string) ([]byte, error)

func VarifyCertByPubKey

func VarifyCertByPubKey(pubkey *ecdsa.PublicKey, cert []byte) error

Types

type CIM

type CIM interface {
	//cim uniq  id
	//GetIdentifier() string
	// construct consortium identity manager
	//SetUp(conf *CIMConfig) error
	SetUpFromCA(rootCAByte []byte) error
	GetRootCert() Identity
	//GetTLSRootCert() []byte
	// revoke cert list
	//GetCrlList() []*pkix.CertificateList
	GetTLSIntermediateCert() []byte
	GetSigningIdentity() SigningIdentity
	Validate(id Identity) error
	///CreateIdentity(priv string) bool
	ValidateByByte(certByte []byte) error
	ValidateRootCert(certByte []byte) error
}

consortium indentity manager

func CreateCim

func CreateCim(certbyte []byte) CIM

func GetLocalCIM

func GetLocalCIM() CIM

GetLocalCIM returns the local cim (and creates it if it doesn't exist)

func NewCIM

func NewCIM() (CIM, error)

type CIMManager

type CIMManager interface {

	// Get all the CIM
	GetCIMs() (map[string]CIM, error)
	GetCIM(identifier string) (CIM, error)
	// validate any identity
	Validate(id Identity)
	// contains filtered or unexported methods
}

type CimList

type CimList struct {
	CryptoType uint8
	CimMap     []CIM
	CIM_Epoch  *big.Int
	PTable     *vm.PerminTable
	// contains filtered or unexported fields
}

func NewCIMList

func NewCIMList(CryptoType uint8) *CimList

func (*CimList) AddCim

func (cl *CimList) AddCim(cimTemp CIM) error

func (*CimList) DelCim

func (cl *CimList) DelCim(cimTemp *CIM) error

func (*CimList) InitCertAndPermission

func (cl *CimList) InitCertAndPermission(height *big.Int, stateDB *state.StateDB) error

func (*CimList) SetCertEpoch

func (cl *CimList) SetCertEpoch(epoch *big.Int)

func (*CimList) UpdataCert

func (cl *CimList) UpdataCert(clist [][]byte)

func (*CimList) UpdataPermission

func (cl *CimList) UpdataPermission(db *state.StateDB) error

func (*CimList) VerifyCert

func (cl *CimList) VerifyCert(cert []byte) error

func (*CimList) VerifyPermission

func (cl *CimList) VerifyPermission(tx *types.Transaction, sender types.Signer, db state.StateDB) (bool, error)

func (*CimList) VerifyRootCert

func (cl *CimList) VerifyRootCert(cert []byte) error

type Configuration

type Configuration struct {
	Enabled   bool
	EcdsaPath string
	GmPath    string
}

type CryptoConfig

type CryptoConfig struct {
	SignatureHashFamily            string
	IdentityIdentifierHashFunction string
}

type Identity

type Identity interface {
	//ExpiresAt() time.Time
	//detemine if the signature  is this identity singed.
	//Verify(msg []byte, sig []byte) error
	VerifyByte(cert []byte) error
	// contains filtered or unexported methods
}

func GetIdentityFromByte

func GetIdentityFromByte(idBytes []byte) (Identity, error)

func NewIdentity

func NewIdentity(cert *x509.Certificate) (Identity, error)

type ReIdentity

type ReIdentity struct {
	Identity *x509.Certificate `json:"identity"       gencodec:"required"`
}

type SigningIdentity

type SigningIdentity interface {
	Identity
	Sign(msg []byte) ([]byte, error)
	GetPublicVersion() Identity
}

sign identity

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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