cryptosuite

package
v1.6.56 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncryptVersion1 = "V1"
)

Variables

View Source
var (
	ErrKeyParseError          = errors.New("key parse error")
	ErrInvalidAlgorithmFamily = errors.New("invalid algorithm family")
	ErrInvalidAlgorithm       = errors.New("invalid algorithm for ECDSA")
	ErrInvalidHash            = errors.New("invalid hash algorithm")
	ErrInvalidKeyType         = errors.New("invalid key type is provided")
	ErrEnrollmentIdMissing    = errors.New("enrollment id is empty")
	ErrAffiliationMissing     = errors.New("affiliation is missing")
	ErrTypeMissing            = errors.New("type is missing")
	ErrCertificateEmpty       = errors.New("certificate cannot be nil")
	ErrIdentityNameMissing    = errors.New("identity must have  name")
)

Functions

func DecryptKey

func DecryptKey(encrypted string, key []byte, extraKey []byte) (res []byte, err error)

func EncryptKey

func EncryptKey(text []byte, syKey []byte, extraKey []byte) (string, error)

使用一个对称秘钥+额外的key(例如用户密码,或是某个环境变量)来加密某个key

func GenFromPassword

func GenFromPassword(password, passwordSalt []byte) []byte

密码加盐

func Hash

func Hash(data []byte) []byte

Types

type EccK1

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

func NewEccK1

func NewEccK1() *EccK1

func (EccK1) GenerateKey

func (c EccK1) GenerateKey() (priKeyByte []byte, pubKeyByte []byte, err error)

func (EccK1) GetPriKeyPem

func (c EccK1) GetPriKeyPem(key interface{}) ([]byte, error)

func (EccK1) GetPubKeyPem

func (c EccK1) GetPubKeyPem(key interface{}) ([]byte, error)

func (EccK1) ParsePemPriKey

func (c EccK1) ParsePemPriKey(key []byte) (interface{}, error)

func (EccK1) ParsePemPubKey

func (c EccK1) ParsePemPubKey(key []byte) (interface{}, error)

func (EccK1) Sign

func (c EccK1) Sign(priKey []byte, digest []byte) (signature []byte, err error)

func (EccK1) Verify

func (c EccK1) Verify(from []byte, digest []byte, sig []byte) (bool, error)

type KeySave

type KeySave struct {
	Key        interface{}
	EncryptKey string
}

Jump to

Keyboard shortcuts

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