agkey

package
v0.0.0-...-e64ac36 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_AGKEY_CAP_UNSUPPORT      = errors.New("unsupport capablity")
	ERR_AGKEY_NOT_FOUND          = errors.New("key not found")
	ERR_AGKEY_INVALID_CIPHERTEXT = errors.New("invalid cipher text")
	ERR_AGKEY_INVALID_PARAM      = errors.New("invalid params")
	ERR_AGKEY_UNEXCEPTED_KEY     = errors.New("unexpected key")
	ERR_AGKEY_KEY_UNSUPPORT      = errors.New("unsupport key")
)

Functions

func CreateAgKey

func CreateAgKey(maxNum int32, KeyFun KeyFunction, opts ...ko.KeyOption) (newKey *agkey, err error)

func ExportPubAgKey

func ExportPubAgKey(priKeyfile string, outfile string) error

func GeneratePriAgKey

func GeneratePriAgKey(num int32, cipher []byte, outfile string) error

func MarshalSm2PrivateKey

func MarshalSm2PrivateKey(key *sm2.PrivateKey) string

////////////////////////////////////////////////////

func MarshalSm2PublicKey

func MarshalSm2PublicKey(key *sm2.PublicKey) string

//////////////////////////////////////////////

func New

func New() *agkey

func ParsePKCS8PrivateKey

func ParsePKCS8PrivateKey(dHex string) (*sm2.PrivateKey, error)

func ParseSm2PublicKey

func ParseSm2PublicKey(dHex string) (*sm2.PublicKey, error)

Types

type AgkeyGenerate

type AgkeyGenerate struct {
	Key agkey
}

type KeyFunction

type KeyFunction func(num int32, opts *ko.KeyOptions) (keyId string, key any, err error)

构建或者获取key的函数, 返回kid 与 key