Documentation ¶
Index ¶
- Constants
- Variables
- func DecryptKey(encrypted string, key []byte, extraKey []byte) (res []byte, err error)
- func EncryptKey(text []byte, syKey []byte, extraKey []byte) (string, error)
- func GenFromPassword(password, passwordSalt []byte) []byte
- func Hash(data []byte) []byte
- type EccK1
- func (c EccK1) GenerateKey() (priKeyByte []byte, pubKeyByte []byte, err error)
- func (c EccK1) GetPriKeyPem(key interface{}) ([]byte, error)
- func (c EccK1) GetPubKeyPem(key interface{}) ([]byte, error)
- func (c EccK1) ParsePemPriKey(key []byte) (interface{}, error)
- func (c EccK1) ParsePemPubKey(key []byte) (interface{}, error)
- func (c EccK1) Sign(priKey []byte, digest []byte) (signature []byte, err error)
- func (c EccK1) Verify(from []byte, digest []byte, sig []byte) (bool, error)
- type KeySave
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 EncryptKey ¶
使用一个对称秘钥+额外的key(例如用户密码,或是某个环境变量)来加密某个key
Types ¶
type EccK1 ¶
type EccK1 struct {
// contains filtered or unexported fields
}
func (EccK1) GenerateKey ¶
func (EccK1) GetPriKeyPem ¶
func (EccK1) GetPubKeyPem ¶
func (EccK1) ParsePemPriKey ¶
func (EccK1) ParsePemPubKey ¶
Click to show internal directories.
Click to hide internal directories.