ecdh

package
v1.1.1015 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Get cipher from name
	GetCipherFromName = pkcs8.GetCipherFromName
	// Get hash from name
	GetHashFromName = pkcs8.GetHashFromName
)
View Source
var (
	ErrKeyMustBePEMEncoded = errors.New("go-cryptobin/ecdh: invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
	ErrNotPrivateKey       = errors.New("go-cryptobin/ecdh: key is not a valid ecdh private key")
	ErrNotPublicKey        = errors.New("go-cryptobin/ecdh: key is not a valid ecdh public key")
)

Functions

This section is empty.

Types

type ECDH added in v1.0.2048

type ECDH struct {

	// error list
	Errors []error
	// contains filtered or unexported fields
}

*

  • ecdh *
  • @create 2022-8-7
  • @author deatil

func FromECDHPrivateKey added in v1.0.2017

func FromECDHPrivateKey(key []byte) ECDH

From ECDH PrivateKey bytes

func FromECDHPrivateKeyDer added in v1.1.1013

func FromECDHPrivateKeyDer(der []byte) ECDH

From ECDH PrivateKey Der bytes

func FromECDHPrivateKeyWithPassword added in v1.0.2017

func FromECDHPrivateKeyWithPassword(key []byte, password string) ECDH

From ECDH PrivateKey bytes With Password

func FromECDHPublicKey added in v1.0.2017

func FromECDHPublicKey(key []byte) ECDH

From ECDH PublicKey bytes

func FromECDHPublicKeyDer added in v1.1.1013

func FromECDHPublicKeyDer(der []byte) ECDH

From ECDH PublicKey Der bytes

func FromPrivateKey added in v1.0.2014

func FromPrivateKey(key []byte) ECDH

From PrivateKey bytes

func FromPrivateKeyDer added in v1.1.1013

func FromPrivateKeyDer(der []byte) ECDH

From PublicKey Der bytes

func FromPrivateKeyWithPassword added in v1.0.2014

func FromPrivateKeyWithPassword(key []byte, password string) ECDH

From PrivateKey bytes With Password

func FromPublicKey added in v1.0.2014

func FromPublicKey(key []byte) ECDH

From PublicKey bytes

func FromPublicKeyDer added in v1.1.1013

func FromPublicKeyDer(der []byte) ECDH

From PublicKey Der bytes

func GenerateKey added in v1.0.2014

func GenerateKey(curve string) ECDH

GenerateKey

func GenerateKeyWithSeed added in v1.0.2026

func GenerateKeyWithSeed(reader io.Reader, curve string) ECDH

GenerateKey With Seed

func New

func New() ECDH

New ECDH

func NewECDH added in v1.0.2048

func NewECDH() ECDH

NewECDH

func (ECDH) AppendError added in v1.0.2048

func (this ECDH) AppendError(err ...error) ECDH

append error

func (ECDH) CheckKeyPair added in v1.0.2048

func (this ECDH) CheckKeyPair() bool

Check KeyPair

func (ECDH) CreateECDHPrivateKey added in v1.0.2048

func (this ECDH) CreateECDHPrivateKey() ECDH

生成私钥 pem 数据, 库自使用的 asn1 格式 Create PKCS8 PrivateKey PEM data and use the pkg asn1 encode

func (ECDH) CreateECDHPrivateKeyWithPassword added in v1.0.2048

func (this ECDH) CreateECDHPrivateKeyWithPassword(password string, opts ...any) ECDH

生成 PKCS8 私钥带密码 pem 数据, 库自使用的 asn1 格式 Create PKCS8 PrivateKey PEM data with password and use the pkg asn1 encode

func (ECDH) CreateECDHPublicKey added in v1.0.2048

func (this ECDH) CreateECDHPublicKey() ECDH

Create PublicKey PEM data and use the pkg asn1 encode

func (ECDH) CreatePrivateKey added in v1.0.2048

func (this ECDH) CreatePrivateKey() ECDH

Create PKCS8 PrivateKey PEM data example: obj := New().SetCurve("P256").GenerateKey() priKey := obj.CreatePrivateKey().ToKeyString()

func (ECDH) CreatePrivateKeyWithPassword added in v1.0.2048

func (this ECDH) CreatePrivateKeyWithPassword(password string, opts ...any) ECDH

Create PKCS8 PrivateKey PEM data with password CreatePrivateKeyWithPassword("123", "AES256CBC", "SHA256")

func (ECDH) CreatePublicKey added in v1.0.2048

func (this ECDH) CreatePublicKey() ECDH

Create PublicKey PEM data

func (ECDH) CreateSecretKey added in v1.0.2048

func (this ECDH) CreateSecretKey() ECDH

Create SecretKey from PrivateKey and PublicKey

func (ECDH) Error added in v1.0.2048

func (this ECDH) Error() error

return error

func (ECDH) FromECDHPrivateKey added in v1.0.2048

func (this ECDH) FromECDHPrivateKey(key []byte) ECDH

From ECDH PrivateKey bytes

func (ECDH) FromECDHPrivateKeyDer added in v1.0.2048

func (this ECDH) FromECDHPrivateKeyDer(der []byte) ECDH

From ECDH PrivateKey Der bytes

func (ECDH) FromECDHPrivateKeyWithPassword added in v1.0.2048

func (this ECDH) FromECDHPrivateKeyWithPassword(key []byte, password string) ECDH

From ECDH PrivateKey bytes With Password

func (ECDH) FromECDHPublicKey added in v1.0.2048

func (this ECDH) FromECDHPublicKey(key []byte) ECDH

From ECDH PublicKey bytes

func (ECDH) FromECDHPublicKeyDer added in v1.0.2048

func (this ECDH) FromECDHPublicKeyDer(der []byte) ECDH

From ECDH PublicKey Der bytes

func (ECDH) FromPrivateKey added in v1.0.2048

func (this ECDH) FromPrivateKey(key []byte) ECDH

From PrivateKey bytes

func (ECDH) FromPrivateKeyDer added in v1.0.2048

func (this ECDH) FromPrivateKeyDer(der []byte) ECDH

From PrivateKey Der bytes

func (ECDH) FromPrivateKeyWithPassword added in v1.0.2048

func (this ECDH) FromPrivateKeyWithPassword(key []byte, password string) ECDH

From PrivateKey bytes With Password

func (ECDH) FromPublicKey added in v1.0.2048

func (this ECDH) FromPublicKey(key []byte) ECDH

From PublicKey bytes

func (ECDH) FromPublicKeyDer added in v1.0.2048

func (this ECDH) FromPublicKeyDer(der []byte) ECDH

From PublicKey Der bytes

func (ECDH) GenerateKey added in v1.0.2048

func (this ECDH) GenerateKey() ECDH

GenerateKey

func (ECDH) GenerateKeyWithSeed added in v1.0.2048

func (this ECDH) GenerateKeyWithSeed(reader io.Reader) ECDH

GenerateKey With Seed

func (ECDH) GetCurve added in v1.0.2048

func (this ECDH) GetCurve() ecdh.Curve

Get curve

func (ECDH) GetErrors added in v1.0.2048

func (this ECDH) GetErrors() []error

get errors

func (ECDH) GetKeyData added in v1.0.2048

func (this ECDH) GetKeyData() []byte

Get keyData

func (ECDH) GetPrivateKey added in v1.0.2048

func (this ECDH) GetPrivateKey() *ecdh.PrivateKey

Get PrivateKey

func (ECDH) GetPublicKey added in v1.0.2048

func (this ECDH) GetPublicKey() *ecdh.PublicKey

Get PublicKey

func (ECDH) GetSecretData added in v1.0.2048

func (this ECDH) GetSecretData() []byte

Get secretData

func (ECDH) MakeKeyDer added in v1.0.2048

func (this ECDH) MakeKeyDer() ECDH

Make Key Der data

func (ECDH) MakePublicKey added in v1.0.2048

func (this ECDH) MakePublicKey() ECDH

Make PublicKey

func (ECDH) OnError added in v1.0.2048

func (this ECDH) OnError(fn func([]error)) ECDH

func (ECDH) ParseECDHPrivateKeyFromPEM added in v1.0.2048

func (this ECDH) ParseECDHPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)

Parse ECDH PrivateKey From PEM

func (ECDH) ParseECDHPrivateKeyFromPEMWithPassword added in v1.0.2048

func (this ECDH) ParseECDHPrivateKeyFromPEMWithPassword(key []byte, password string) (crypto.PrivateKey, error)

Parse ECDH PrivateKey From PEM With Password

func (ECDH) ParseECDHPublicKeyFromPEM added in v1.0.2048

func (this ECDH) ParseECDHPublicKeyFromPEM(key []byte) (crypto.PublicKey, error)

Parse ECDH PublicKey From PEM

func (ECDH) ParsePrivateKeyFromPEM added in v1.0.2048

func (this ECDH) ParsePrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)

Parse PrivateKey From PEM

func (ECDH) ParsePrivateKeyFromPEMWithPassword added in v1.0.2048

func (this ECDH) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (crypto.PrivateKey, error)

Parse PrivateKey From PEM With Password

func (ECDH) ParsePublicKeyFromPEM added in v1.0.2048

func (this ECDH) ParsePublicKeyFromPEM(key []byte) (crypto.PublicKey, error)

Parse PublicKey From PEM

func (ECDH) SetCurve added in v1.0.2048

func (this ECDH) SetCurve(curve string) ECDH

set curve type string params [P521 | P384 | P256 | X25519]

func (ECDH) ToBase64String added in v1.0.2048

func (this ECDH) ToBase64String() string

output base64 data

func (ECDH) ToBytes added in v1.0.2048

func (this ECDH) ToBytes() []byte

output bytes data

func (ECDH) ToHexString added in v1.0.2048

func (this ECDH) ToHexString() string

output hex data

func (ECDH) ToKeyBytes added in v1.0.2048

func (this ECDH) ToKeyBytes() []byte

output key bytes data

func (ECDH) ToKeyString added in v1.0.2048

func (this ECDH) ToKeyString() string

output key string data

func (ECDH) ToString added in v1.0.2048

func (this ECDH) ToString() string

output string data

func (ECDH) WithCurve added in v1.0.2048

func (this ECDH) WithCurve(data ecdh.Curve) ECDH

set curve type

func (ECDH) WithErrors added in v1.0.2048

func (this ECDH) WithErrors(errs []error) ECDH

set error list

func (ECDH) WithKeyData added in v1.0.2048

func (this ECDH) WithKeyData(data []byte) ECDH

set keyData

func (ECDH) WithPrivateKey added in v1.0.2048

func (this ECDH) WithPrivateKey(data *ecdh.PrivateKey) ECDH

set PrivateKey

func (ECDH) WithPublicKey added in v1.0.2048

func (this ECDH) WithPublicKey(data *ecdh.PublicKey) ECDH

set PublicKey

func (ECDH) WithSecretData added in v1.0.2048

func (this ECDH) WithSecretData(data []byte) ECDH

set secretData

type Opts

type Opts = pkcs8.Opts

Options

type PBKDF2Opts

type PBKDF2Opts = pkcs8.PBKDF2Opts

PBKDF2 Options

type ScryptOpts

type ScryptOpts = pkcs8.ScryptOpts

Scrypt Options

Jump to

Keyboard shortcuts

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