Documentation ¶
Index ¶
- type Curve25519
- func (e *Curve25519) GenerateKey(rand io.Reader) (crypto.PrivateKey, crypto.PublicKey, error)
- func (e *Curve25519) GenerateSharedSecret(privKey crypto.PrivateKey, pubKey crypto.PublicKey) ([]byte, error)
- func (e *Curve25519) Marshal(p crypto.PublicKey) []byte
- func (e *Curve25519) Unmarshal(data []byte) (crypto.PublicKey, bool)
- type ECDH
- type Elliptic
- func (e *Elliptic) GenerateKey(rand io.Reader) (crypto.PrivateKey, crypto.PublicKey, error)
- func (e *Elliptic) GenerateSharedSecret(privKey crypto.PrivateKey, pubKey crypto.PublicKey) ([]byte, error)
- func (e *Elliptic) Marshal(p crypto.PublicKey) []byte
- func (e *Elliptic) Unmarshal(data []byte) (crypto.PublicKey, bool)
- type EllipticPrivateKey
- type EllipticPublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Curve25519 ¶
func (*Curve25519) GenerateKey ¶
func (e *Curve25519) GenerateKey(rand io.Reader) (crypto.PrivateKey, crypto.PublicKey, error)
GenerateKey 基于curve25519椭圆曲线算法生成秘钥对
func (*Curve25519) GenerateSharedSecret ¶
func (e *Curve25519) GenerateSharedSecret(privKey crypto.PrivateKey, pubKey crypto.PublicKey) ([]byte, error)
GenerateSharedSecret 实现秘钥协商接口
type ECDH ¶
type ECDH interface { GenerateKey(io.Reader) (crypto.PrivateKey, crypto.PublicKey, error) Marshal(crypto.PublicKey) []byte Unmarshal([]byte) (crypto.PublicKey, bool) }
ECDH 密钥交换算法接口
type Elliptic ¶
func (*Elliptic) GenerateKey ¶
GenerateKey 基于标准库的NIST椭圆曲线算法生成秘钥对
func (*Elliptic) GenerateSharedSecret ¶
func (e *Elliptic) GenerateSharedSecret(privKey crypto.PrivateKey, pubKey crypto.PublicKey) ([]byte, error)
GenerateSharedSecret 通过自己的私钥和对方的公钥协商一个共享密码
type EllipticPrivateKey ¶
type EllipticPrivateKey struct {
D []byte
}
Click to show internal directories.
Click to hide internal directories.