eddsa

package
v1.0.3021 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 9 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("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key")
	ErrNotEdPrivateKey     = errors.New("key is not a valid Ed25519 private key")
	ErrNotEdPublicKey      = errors.New("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 added in v1.0.1018

func FromBase64String(data string) EdDSA

Base64

func FromBytes added in v1.0.1018

func FromBytes(data []byte) EdDSA

字节

func FromHexString added in v1.0.1018

func FromHexString(data string) EdDSA

Hex

func FromPrivateKey added in v1.0.1018

func FromPrivateKey(key []byte) EdDSA

私钥

func FromPrivateKeySeed added in v1.0.2015

func FromPrivateKeySeed(seed []byte) EdDSA

私钥 Seed

func FromPrivateKeyWithPassword added in v1.0.1018

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

私钥

func FromPublicKey added in v1.0.1018

func FromPublicKey(key []byte) EdDSA

公钥

func FromString added in v1.0.1018

func FromString(data string) EdDSA

字符

func GenerateKey added in v1.0.1018

func GenerateKey() EdDSA

生成密钥

func GenerateKeyWithSeed added in v1.0.2026

func GenerateKeyWithSeed(reader io.Reader) EdDSA

生成密钥

func New added in v1.0.1018

func New() EdDSA

构造函数

func NewEdDSA

func NewEdDSA() EdDSA

构造函数

func (EdDSA) AppendError added in v1.0.1026

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

添加错误

func (EdDSA) CheckKeyPair added in v1.0.1043

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 added in v1.0.2015

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

DER 私钥

func (EdDSA) FromPrivateKeySeed added in v1.0.2014

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

私钥 Seed

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 added in v1.0.2015

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

DER 公钥

func (EdDSA) FromString

func (this EdDSA) FromString(data string) EdDSA

字符

func (EdDSA) GenerateKey

func (this EdDSA) GenerateKey() EdDSA

生成密钥

func (EdDSA) GenerateKeyWithSeed added in v1.0.2026

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

生成密钥

func (EdDSA) GetData

func (this EdDSA) GetData() []byte

获取 data

func (EdDSA) GetErrors added in v1.0.1026

func (this EdDSA) GetErrors() []error

获取错误

func (EdDSA) GetKeyData

func (this EdDSA) GetKeyData() []byte

获取 keyData

func (EdDSA) GetOptions added in v1.0.2014

func (this EdDSA) GetOptions() *Options

获取 Options

func (EdDSA) GetParsedData added in v1.0.2049

func (this EdDSA) GetParsedData() []byte

获取 parsedData

func (EdDSA) GetPrivateKey

func (this EdDSA) GetPrivateKey() ed25519.PrivateKey

获取 PrivateKey

func (EdDSA) GetPrivateKeySeed added in v1.0.2014

func (this EdDSA) GetPrivateKeySeed() []byte

获取 PrivateKeySeed

func (EdDSA) GetPublicKey

func (this EdDSA) GetPublicKey() ed25519.PublicKey

获取 PublicKey

func (EdDSA) GetVerify added in v1.0.1032

func (this EdDSA) GetVerify() bool

获取验证后情况

func (EdDSA) MakeKeyDer added in v1.0.1033

func (this EdDSA) MakeKeyDer() EdDSA

生成密钥 der 数据

func (EdDSA) MakePublicKey

func (this EdDSA) MakePublicKey() EdDSA

生成公钥

func (EdDSA) OnError

func (this EdDSA) OnError(fn EdDSAErrorFunc) EdDSA

引出错误信息

func (EdDSA) ParsePrivateKeyFromPEM added in v1.0.1043

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

解析私钥

func (EdDSA) ParsePrivateKeyFromPEMWithPassword added in v1.0.1043

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

解析私钥带密码

func (EdDSA) ParsePublicKeyFromPEM added in v1.0.1043

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

解析公钥

func (EdDSA) SetOptions added in v1.0.2014

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 added in v1.0.1032

func (this EdDSA) ToVerify() bool

验证结果

func (EdDSA) ToVerifyInt added in v1.0.1033

func (this EdDSA) ToVerifyInt() int

验证结果,返回 int 类型

func (EdDSA) Verify added in v1.0.1033

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

公钥验证

func (EdDSA) WithData

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

设置 data

func (EdDSA) WithErrors added in v1.0.1026

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

设置错误

func (EdDSA) WithOptions added in v1.0.2014

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

设置 options

func (EdDSA) WithParsedData added in v1.0.2049

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 added in v1.0.1032

func (this EdDSA) WithVerify(data bool) EdDSA

设置 verify

type EdDSAErrorFunc

type EdDSAErrorFunc = func([]error)

错误方法

type Options added in v1.0.2014

type Options = ed25519.Options

设置

type Opts added in v1.0.1018

type Opts = pkcs8.Opts

配置

type PBKDF2Opts added in v1.0.1018

type PBKDF2Opts = pkcs8.PBKDF2Opts

PBKDF2 配置

type ScryptOpts added in v1.0.1018

type ScryptOpts = pkcs8.ScryptOpts

Scrypt 配置

Jump to

Keyboard shortcuts

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