Documentation ¶
Index ¶
- func DecodeKeyPair(pwd string, privKey []byte, pubKey []byte) (PrivateKey, PublicKey, error)
- func GenerateKeyPair(cfg *CryptoConfig) ([]byte, []byte, error)
- func GetRandBytes(reader io.Reader, n int) ([]byte, error)
- func Seal(key string, data []byte) ([]byte, error)
- func Sign(priv PrivateKey, data []byte) ([]byte, error)
- func UnSeal(key string, data []byte) ([]byte, error)
- func Verify(pub PublicKey, data []byte, sig []byte) bool
- type CryptoAlgType
- type CryptoConfig
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeKeyPair ¶
GenerateKeyPair will generate key pair based on the configuration
func GenerateKeyPair ¶
func GenerateKeyPair(cfg *CryptoConfig) ([]byte, []byte, error)
GenerateKeyPair will generate key pair based on the configuration
func GetRandBytes ¶
GetRandBytes will generate rand bytes
Types ¶
type CryptoAlgType ¶
type CryptoAlgType int
CryptoAlgType is algorithm type
const ( RSA2048 CryptoAlgType = iota ECDSAP256 )
type CryptoConfig ¶
type CryptoConfig struct { Alg CryptoAlgType Pwd string }
CryptoConfig is configuration for the crypto
type PrivateKey ¶
type PrivateKey interface{}
PrivateKey represents a private key using an unspecified algorithm.
Click to show internal directories.
Click to hide internal directories.