Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateKey(keyGenOpt heimdall.KeyGenOpts) (heimdall.PriKey, error)
- func LoadPriKey(keyDirPath, pwd string) (heimdall.PriKey, error)
- func LoadPriKeyWithoutPwd(keyDirPath string) (heimdall.PriKey, error)
- func LoadPubKey(keyId heimdall.KeyID, keyDirPath string) (heimdall.PubKey, error)
- func NewPriKey(internalPriKey *ecdsa.PrivateKey) heimdall.PriKey
- func NewPubKey(internalPubKey *ecdsa.PublicKey) heimdall.PubKey
- func Sign(pri heimdall.PriKey, message []byte, opts heimdall.SignerOpts) ([]byte, error)
- func SignWithKeyInLocal(keyDirPath string, message []byte, signerOpt heimdall.SignerOpts) ([]byte, error)
- func StorePriKey(key heimdall.PriKey, pwd, keyDirPath string, encOpt *encryption.Opts, ...) error
- func StorePriKeyWithoutPwd(key heimdall.PriKey, keyDirPath string) error
- func StorePubKey(key heimdall.PubKey, keyDirPath string) error
- func Verify(pub heimdall.PubKey, signature, message []byte, opts heimdall.SignerOpts) (bool, error)
- func VerifyWithCert(cert *x509.Certificate, signature, message []byte, opts heimdall.SignerOpts) (bool, error)
- type EncryptionHints
- type KeyFile
- type KeyGenOpt
- type KeyRecoverer
- type PriKey
- type PubKey
- type SignerOpts
Constants ¶
View Source
const ( ECP224 = "P-224" ECP256 = "P-256" ECP384 = "P-384" ECP521 = "P-521" )
Variables ¶
View Source
var ErrCurveNotSupported = errors.New("curve not supported")
View Source
var ErrEmptyKeyPath = errors.New("invalid keyPath - keyPath empty")
View Source
var ErrInvalidSignature = [...]error{ errors.New("invalid signature - garbage follows signature"), errors.New("invalid signature - signature's R value should not be nil"), errors.New("invalid signature - signature's S value should not be nil"), errors.New("invalid signature - signature's R value should be positive except zero"), errors.New("invalid signature - signature's S value should be positive except zero"), }
View Source
var ErrKeyType = errors.New("invalid key type - key type should be heimdall.PRIVATEKEY or heimdall.PUBLICKEY")
View Source
var ErrMultiplePriKey = errors.New("private key in directory should be one")
View Source
var ErrWrongKeyID = errors.New("wrong key id - failed to find key using key ID")
Functions ¶
func GenerateKey ¶
func GenerateKey(keyGenOpt heimdall.KeyGenOpts) (heimdall.PriKey, error)
func LoadPriKey ¶ added in v0.2.4
LoadPriKey loads private key with password.
func LoadPriKeyWithoutPwd ¶ added in v0.2.4
func LoadPubKey ¶ added in v0.2.4
LoadPubKey loads public key by key ID.
func SignWithKeyInLocal ¶
func StorePriKey ¶ added in v0.2.4
func StorePriKey(key heimdall.PriKey, pwd, keyDirPath string, encOpt *encryption.Opts, kdfOpt *kdf.Opts) error
StorePriKey stores private key with password.
func StorePriKeyWithoutPwd ¶ added in v0.2.4
func StorePubKey ¶ added in v0.2.4
StorePubKey stores public key.
func Verify ¶
Verify verifies the signature using pubKey(public key) and digest of original message, then returns boolean value.
func VerifyWithCert ¶
func VerifyWithCert(cert *x509.Certificate, signature, message []byte, opts heimdall.SignerOpts) (bool, error)
VerifyWithCert verify a signature with certificate.
Types ¶
type EncryptionHints ¶ added in v0.2.4
type EncryptionHints struct { EncOpt *encryption.Opts KDFOpt *kdf.Opts KDFSalt []byte }
struct for providing hints of encryption and key derivation function.
type KeyFile ¶ added in v0.2.4
type KeyFile struct { SKI []byte EncryptedKey string Hints *EncryptionHints }
struct for encrypted key's file format.
type KeyGenOpt ¶
func NewKeyGenOpt ¶
type PriKey ¶
type PriKey struct {
// contains filtered or unexported fields
}
PriKey is an implementation of heimdall PriKey for using ECDSA private key
func (*PriKey) KeyGenOpt ¶
func (priKey *PriKey) KeyGenOpt() heimdall.KeyGenOpts
type PubKey ¶
type PubKey struct {
// contains filtered or unexported fields
}
PubKey is an implementation of heimdall PubKey for using ECDSA public key
func (*PubKey) KeyGenOpt ¶
func (pubKey *PubKey) KeyGenOpt() heimdall.KeyGenOpts
type SignerOpts ¶
type SignerOpts struct {
// contains filtered or unexported fields
}
func NewSignerOpts ¶
func NewSignerOpts(hashOpt *hashing.HashOpt) *SignerOpts
func (*SignerOpts) Algorithm ¶
func (signerOpt *SignerOpts) Algorithm() string
func (*SignerOpts) HashOpt ¶
func (signerOpt *SignerOpts) HashOpt() *hashing.HashOpt
Click to show internal directories.
Click to hide internal directories.