Documentation ¶
Index ¶
- Variables
- func Belongs(pub KeyWithFilter, prv []byte, passphrase string) bool
- func DecryptAES(key, data []byte) ([]byte, error)
- func EncryptAES(key, data []byte) ([]byte, error)
- func IsAuthErr(err error) bool
- func PrivateKeyTypePrefix(key crypto.PrivateKey) string
- func SSHPrvKey(keyData []byte, passphrase string) (crypto.PrivateKey, error)
- func SSHPubKey(publicKey []byte) (crypto.PublicKey, error)
- func SharedSecret(prv crypto.PrivateKey, pub crypto.PublicKey) ([]byte, error)
- type Cipher
- type Key
- func (k *Key) AESKeys() ([]byte, [][]byte, error)
- func (k *Key) Cipher() *Cipher
- func (k *Key) IsRSA() bool
- func (k *Key) SigDigest(digest []byte) ([]byte, error)
- func (k *Key) Sign(data []byte) ([]byte, error)
- func (k *Key) Signer() *Signer
- func (k *Key) Verify(data []byte) ([]byte, bool)
- func (k *Key) VerifyDigest(digest, sign []byte) bool
- type KeyWithFilter
- type Signer
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotSupportedKey = errors.New("not an supported key")
View Source
var ErrPubKeyNotFound = errors.New("public key not found")
View Source
var ErrSignNotMatch = errors.New("sign not match")
Functions ¶
func Belongs ¶ added in v0.2.0
func Belongs(pub KeyWithFilter, prv []byte, passphrase string) bool
Belongs checks if pub key belongs to prv key.
func DecryptAES ¶
func EncryptAES ¶
func PrivateKeyTypePrefix ¶ added in v0.2.0
func PrivateKeyTypePrefix(key crypto.PrivateKey) string
func SSHPrvKey ¶ added in v0.2.0
func SSHPrvKey(keyData []byte, passphrase string) (crypto.PrivateKey, error)
SSHPrvKey returns a private key from a ssh private key.
func SharedSecret ¶ added in v0.2.0
Types ¶
type Cipher ¶ added in v0.0.5
type Cipher struct {
Key *Key
}
func (*Cipher) DecodeAESKey ¶ added in v0.2.0
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.0.5
func New(privateKey []byte, passphrase string, publicKeys ...KeyWithFilter) (*Key, error)
func (*Key) AESKeys ¶ added in v0.0.7
AESKeys returns the AES key and encrypted keys for each public key. If there's only one public key, the AES key will be the ECDH key. If there're multiple public keys, a random base AES key will be generated, then each ECDH key will be used to encrypt the base AES key.
func (*Key) VerifyDigest ¶ added in v0.2.0
type KeyWithFilter ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.