pdu

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PEngine added in v0.1.0

type PEngine struct {
	// contains filtered or unexported fields
}

PEngine is the engine of pdu

func New added in v0.1.0

func New() *PEngine

New is used to create PEngine

func (PEngine) DecryptKey added in v0.1.0

func (e PEngine) DecryptKey(keyJSON []byte, pass string) (*crypto.PrivateKey, *crypto.PublicKey, error)

DecryptKey decrypt private key from file

func (PEngine) EncryptKey added in v0.1.0

func (e PEngine) EncryptKey(priKey *crypto.PrivateKey, pass string) ([]byte, error)

EncryptKey encryptKey into file

func (PEngine) GenKey added in v0.1.0

func (e PEngine) GenKey(params ...interface{}) (*crypto.PrivateKey, *crypto.PublicKey, error)

GenKey generate the private and public key pair

func (PEngine) MappingKey added in v0.1.0

func (e PEngine) MappingKey(privKey *crypto.PrivateKey, pubKey *crypto.PublicKey) (map[string]interface{}, map[string]interface{}, error)

MappingKey build private & public key content into map for display or marshal

func (PEngine) Marshal added in v0.1.0

func (e PEngine) Marshal(privKey *crypto.PrivateKey, pubKey *crypto.PublicKey) (privKeyBytes []byte, pubKeyBytes []byte, err error)

Marshal marshal private & public key to json

func (PEngine) Name added in v0.1.0

func (e PEngine) Name() string

Name return name of pdu (PDU)

func (PEngine) Sign added in v0.1.0

func (e PEngine) Sign(hash []byte, priKey *crypto.PrivateKey) (*crypto.Signature, error)

Sign is used to create signature of content by private key

func (PEngine) Unmarshal added in v0.1.0

func (e PEngine) Unmarshal(privKeyBytes, pubKeyBytes []byte) (privKey *crypto.PrivateKey, pubKey *crypto.PublicKey, err error)

Unmarshal unmarshal private & public key from json

func (PEngine) Verify added in v0.1.0

func (e PEngine) Verify(hash []byte, sig *crypto.Signature) (bool, error)

Verify is used to verify the signature

Jump to

Keyboard shortcuts

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