eddsa

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 获取 Cipher 类型
	GetCipherFromName = pkcs8.GetCipherFromName
	// 获取 hash 类型
	GetHashFromName = pkcs8.GetHashFromName
)
View Source
var (
	ErrKeyMustBePEMEncoded = errors.New("go-cryptobin/eddsa: invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
	ErrNotEdPrivateKey     = errors.New("go-cryptobin/eddsa: key is not a valid Ed25519 private key")
	ErrNotEdPublicKey      = errors.New("go-cryptobin/eddsa: key is not a valid Ed25519 public key")
)

Functions

This section is empty.

Types

type EdDSA

type EdDSA struct {

	// 错误
	Errors []error
	// contains filtered or unexported fields
}

*

  • EdDSA *
  • @create 2022-4-3
  • @author deatil

func FromBase64String

func FromBase64String(data string) EdDSA

Base64

func FromBytes

func FromBytes(data []byte) EdDSA

字节

func FromHexString

func FromHexString(data string) EdDSA

Hex

func FromPrivateKey

func FromPrivateKey(key []byte) EdDSA

私钥

func FromPrivateKeySeed

func FromPrivateKeySeed(seed []byte) EdDSA

私钥 Seed

func FromPrivateKeyWithPassword

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

私钥

func FromPublicKey

func FromPublicKey(key []byte) EdDSA

公钥

func FromString

func FromString(data string) EdDSA

字符

func GenerateKey

func GenerateKey() EdDSA

生成密钥

func GenerateKeyWithSeed

func GenerateKeyWithSeed(reader io.Reader) EdDSA

生成密钥

func New

func New() EdDSA

构造函数

func NewEdDSA

func NewEdDSA() EdDSA

构造函数

func (EdDSA) AppendError

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

添加错误

func (EdDSA) CheckKeyPair

func (this EdDSA) CheckKeyPair() bool

检测公钥私钥是否匹配

func (EdDSA) CreatePrivateKey

func (this EdDSA) CreatePrivateKey() EdDSA

生成私钥 pem 数据 使用: obj := New().GenerateKey() priKey := obj.CreatePrivateKey().ToKeyString()

func (EdDSA) CreatePrivateKeyWithPassword

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

生成 PKCS8 私钥带密码 pem 数据 CreatePrivateKeyWithPassword("123", "AES256CBC", "SHA256")

func (EdDSA) CreatePublicKey

func (this EdDSA) CreatePublicKey() EdDSA

生成公钥 pem 数据

func (EdDSA) Error

func (this EdDSA) Error() error

获取错误

func (EdDSA) FromBase64String

func (this EdDSA) FromBase64String(data string) EdDSA

Base64

func (EdDSA) FromBytes

func (this EdDSA) FromBytes(data []byte) EdDSA

字节

func (EdDSA) FromHexString

func (this EdDSA) FromHexString(data string) EdDSA

Hex

func (EdDSA) FromPrivateKey

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

私钥

func (EdDSA) FromPrivateKeyDer

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

DER 私钥

func (EdDSA) FromPrivateKeySeed

func (this EdDSA) FromPrivateKeySeed(seed []byte) EdDSA

私钥 Seed

func (EdDSA) FromPrivateKeyString

func (this EdDSA) FromPrivateKeyString(keyString string) EdDSA

PrivateKey hex string private-key: 07e4********;

func (EdDSA) FromPrivateKeyWithPassword

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

私钥带密码

func (EdDSA) FromPublicKey

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

公钥

func (EdDSA) FromPublicKeyDer

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

DER 公钥

func (EdDSA) FromPublicKeyString

func (this EdDSA) FromPublicKeyString(keyString string) EdDSA

PublicKey hex string

func (EdDSA) FromString

func (this EdDSA) FromString(data string) EdDSA

字符

func (EdDSA) GenerateKey

func (this EdDSA) GenerateKey() EdDSA

生成密钥

func (EdDSA) GenerateKeyWithSeed

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

生成密钥

func (EdDSA) GetData

func (this EdDSA) GetData() []byte

获取 data

func (EdDSA) GetErrors

func (this EdDSA) GetErrors() []error

获取错误

func (EdDSA) GetKeyData

func (this EdDSA) GetKeyData() []byte

获取 keyData

func (EdDSA) GetOptions

func (this EdDSA) GetOptions() *Options

获取 Options

func (EdDSA) GetParsedData

func (this EdDSA) GetParsedData() []byte

获取 parsedData

func (EdDSA) GetPrivateKey

func (this EdDSA) GetPrivateKey() ed25519.PrivateKey

获取 PrivateKey

func (EdDSA) GetPrivateKeySeed

func (this EdDSA) GetPrivateKeySeed() []byte

获取 PrivateKeySeed

func (EdDSA) GetPrivateKeySeedString

func (this EdDSA) GetPrivateKeySeedString() string

获取 PrivateKeySeed

func (EdDSA) GetPrivateKeyString

func (this EdDSA) GetPrivateKeyString() string

get PrivateKey data hex string

func (EdDSA) GetPublicKey

func (this EdDSA) GetPublicKey() ed25519.PublicKey

获取 PublicKey

func (EdDSA) GetPublicKeyString

func (this EdDSA) GetPublicKeyString() string

get PublicKey data hex string

func (EdDSA) GetVerify

func (this EdDSA) GetVerify() bool

获取验证后情况

func (EdDSA) MakeKeyDer

func (this EdDSA) MakeKeyDer() EdDSA

生成密钥 der 数据

func (EdDSA) MakePublicKey

func (this EdDSA) MakePublicKey() EdDSA

生成公钥

func (EdDSA) OnError

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

引出错误信息

func (EdDSA) ParsePrivateKeyFromPEM

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

解析私钥

func (EdDSA) ParsePrivateKeyFromPEMWithPassword

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

解析私钥带密码

func (EdDSA) ParsePublicKeyFromPEM

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

解析公钥

func (EdDSA) SetOptions

func (this EdDSA) SetOptions(name string, context ...string) EdDSA

设置 options 可用类型 [Ed25519ph | Ed25519ctx | Ed25519]

func (EdDSA) Sign

func (this EdDSA) Sign() EdDSA

私钥签名

func (EdDSA) ToBase64String

func (this EdDSA) ToBase64String() string

输出Base64

func (EdDSA) ToBytes

func (this EdDSA) ToBytes() []byte

输出字节

func (EdDSA) ToHexString

func (this EdDSA) ToHexString() string

输出Hex

func (EdDSA) ToKeyBytes

func (this EdDSA) ToKeyBytes() []byte

私钥/公钥

func (EdDSA) ToKeyString

func (this EdDSA) ToKeyString() string

私钥/公钥

func (EdDSA) ToString

func (this EdDSA) ToString() string

输出字符

func (EdDSA) ToVerify

func (this EdDSA) ToVerify() bool

验证结果

func (EdDSA) ToVerifyInt

func (this EdDSA) ToVerifyInt() int

验证结果,返回 int 类型

func (EdDSA) Verify

func (this EdDSA) Verify(data []byte) EdDSA

公钥验证

func (EdDSA) WithData

func (this EdDSA) WithData(data []byte) EdDSA

设置 data

func (EdDSA) WithErrors

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

设置错误

func (EdDSA) WithOptions

func (this EdDSA) WithOptions(op *Options) EdDSA

设置 options

func (EdDSA) WithParsedData

func (this EdDSA) WithParsedData(data []byte) EdDSA

设置 parsedData

func (EdDSA) WithPrivateKey

func (this EdDSA) WithPrivateKey(data ed25519.PrivateKey) EdDSA

设置 PrivateKey

func (EdDSA) WithPublicKey

func (this EdDSA) WithPublicKey(data ed25519.PublicKey) EdDSA

设置 PublicKey

func (EdDSA) WithVerify

func (this EdDSA) WithVerify(data bool) EdDSA

设置 verify

type Options

type Options = ed25519.Options

设置

type Opts

type Opts = pkcs8.Opts

配置

type PBKDF2Opts

type PBKDF2Opts = pkcs8.PBKDF2Opts

PBKDF2 配置

type ScryptOpts

type ScryptOpts = pkcs8.ScryptOpts

Scrypt 配置

Jump to

Keyboard shortcuts

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