curve25519

package
v1.0.5005 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeSecret

func ComputeSecret(private *PrivateKey, peersPublic *PublicKey) (secret []byte)

生成密码

func GenerateKey

func GenerateKey(rand io.Reader) (*PrivateKey, *PublicKey, error)

生成密钥对

func MarshalPrivateKey

func MarshalPrivateKey(key *PrivateKey) ([]byte, error)

Marshal PrivateKey to der

func MarshalPublicKey

func MarshalPublicKey(key *PublicKey) ([]byte, error)

Marshal PublicKey to der

Types

type PrivateKey

type PrivateKey struct {
	PublicKey

	X []byte
}

私钥

func ParsePrivateKey

func ParsePrivateKey(derBytes []byte) (*PrivateKey, error)

Parse PrivateKey der

func (*PrivateKey) ComputeSecret

func (this *PrivateKey) ComputeSecret(peersPublic *PublicKey) (secret []byte)

生成密码

func (*PrivateKey) Public

func (this *PrivateKey) Public() crypto.PublicKey

type PublicKey

type PublicKey struct {
	Y []byte
}

公钥

func GeneratePublicKey

func GeneratePublicKey(private *PrivateKey) (*PublicKey, error)

从私钥获取公钥

func ParsePublicKey

func ParsePublicKey(derBytes []byte) (*PublicKey, error)

Parse PublicKey der

func (*PublicKey) Check

func (this *PublicKey) Check() (err error)

检测

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL