Documentation ¶
Index ¶
- type ECDH
- type EllipticECDH
- func (e *EllipticECDH) GenerateKey(rand io.Reader) (*EllipticPrivateKey, *EllipticPublicKey, error)
- func (e *EllipticECDH) GenerateSharedSecret(priv *EllipticPrivateKey, pub *EllipticPublicKey) ([]byte, error)
- func (e *EllipticECDH) Marshal(pub *EllipticPublicKey) ([]byte, error)
- func (e *EllipticECDH) Unmarshal(data []byte) (*EllipticPublicKey, error)
- func (e *EllipticECDH) X509MarshalPrivateKey(priKey *EllipticPrivateKey) ([]byte, error)
- func (e *EllipticECDH) X509MarshalPublicKey(pub *EllipticPublicKey) ([]byte, error)
- func (e *EllipticECDH) X509UnmarshalPrivateKey(pemBytes []byte) (*EllipticPrivateKey, error)
- func (e *EllipticECDH) X509UnmarshalPublicKey(data []byte) (*EllipticPublicKey, error)
- type EllipticPrivateKey
- type EllipticPublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ECDH ¶
type ECDH interface { GenerateKey(io.Reader) (*EllipticPrivateKey, *EllipticPublicKey, error) Marshal(priKey *EllipticPublicKey) ([]byte, error) Unmarshal([]byte) (*EllipticPublicKey, error) // X509UnmarshalPublicKey(data []byte) (crypto.PublicKey, error) GenerateSharedSecret(*EllipticPrivateKey, *EllipticPublicKey) ([]byte, error) }
The main interface for ECDH key exchange.
type EllipticECDH ¶
type EllipticECDH struct { ECDH // contains filtered or unexported fields }
func NewEllipticECDH ¶
func NewEllipticECDH(curve elliptic.Curve) *EllipticECDH
NewEllipticECDH creates a new instance of ECDH with the given elliptic.Curve curve to use as the elliptical curve for elliptical curve diffie-hellman.
func (*EllipticECDH) GenerateKey ¶
func (e *EllipticECDH) GenerateKey(rand io.Reader) (*EllipticPrivateKey, *EllipticPublicKey, error)
func (*EllipticECDH) GenerateSharedSecret ¶
func (e *EllipticECDH) GenerateSharedSecret(priv *EllipticPrivateKey, pub *EllipticPublicKey) ([]byte, error)
GenerateSharedSecret takes in a public key and a private key and generates a shared secret.
RFC5903 Section 9 states we should only return x.
func (*EllipticECDH) Marshal ¶
func (e *EllipticECDH) Marshal(pub *EllipticPublicKey) ([]byte, error)
func (*EllipticECDH) Unmarshal ¶
func (e *EllipticECDH) Unmarshal(data []byte) (*EllipticPublicKey, error)
func (*EllipticECDH) X509MarshalPrivateKey ¶
func (e *EllipticECDH) X509MarshalPrivateKey(priKey *EllipticPrivateKey) ([]byte, error)
func (*EllipticECDH) X509MarshalPublicKey ¶
func (e *EllipticECDH) X509MarshalPublicKey(pub *EllipticPublicKey) ([]byte, error)
func (*EllipticECDH) X509UnmarshalPrivateKey ¶
func (e *EllipticECDH) X509UnmarshalPrivateKey(pemBytes []byte) (*EllipticPrivateKey, error)
func (*EllipticECDH) X509UnmarshalPublicKey ¶
func (e *EllipticECDH) X509UnmarshalPublicKey(data []byte) (*EllipticPublicKey, error)
type EllipticPrivateKey ¶
type EllipticPrivateKey struct { EllipticPublicKey D *big.Int }
Click to show internal directories.
Click to hide internal directories.