eddsa

package
v1.0.1018 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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")
)
View Source
var CipherMap = map[string]pkcs8.CipherBlock{
	"DESCBC":     pkcs8.DESCBC,
	"DESEDE3CBC": pkcs8.DESEDE3CBC,
	"AES128CBC":  pkcs8.AES128CBC,
	"AES192CBC":  pkcs8.AES192CBC,
	"AES256CBC":  pkcs8.AES256CBC,
}

Cipher 列表

View Source
var PEMCiphers = map[string]x509.PEMCipher{
	"DESCBC":     x509.PEMCipherDES,
	"DESEDE3CBC": x509.PEMCipher3DES,
	"AES128CBC":  x509.PEMCipherAES128,
	"AES192CBC":  x509.PEMCipherAES192,
	"AES256CBC":  x509.PEMCipherAES256,
}

pem 加密方式

Functions

This section is empty.

Types

type EdDSA

type EdDSA struct {

	// 错误
	Error 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 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 New added in v1.0.1018

func New() EdDSA

构造函数

func NewEdDSA

func NewEdDSA() EdDSA

构造函数

func (EdDSA) CreatePrivateKey

func (this EdDSA) CreatePrivateKey() EdDSA

私钥

func (EdDSA) CreatePrivateKeyWithPassword

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

私钥带密码 CreatePrivateKeyWithPassword("123", "AES256CBC", "SHA256")

func (EdDSA) CreatePublicKey

func (this EdDSA) CreatePublicKey() EdDSA

公钥

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) FromPrivateKeyWithPassword

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

私钥带密码

func (EdDSA) FromPublicKey

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

公钥

func (EdDSA) FromString

func (this EdDSA) FromString(data string) EdDSA

字符

func (EdDSA) GenerateKey

func (this EdDSA) GenerateKey() EdDSA

生成密钥

func (EdDSA) GetData

func (this EdDSA) GetData() []byte

获取 data

func (EdDSA) GetError

func (this EdDSA) GetError() error

获取错误

func (EdDSA) GetKeyData

func (this EdDSA) GetKeyData() []byte

获取 keyData

func (EdDSA) GetParedData

func (this EdDSA) GetParedData() []byte

获取 paredData

func (EdDSA) GetPrivateKey

func (this EdDSA) GetPrivateKey() ed25519.PrivateKey

获取 PrivateKey

func (EdDSA) GetPublicKey

func (this EdDSA) GetPublicKey() ed25519.PublicKey

获取 PublicKey

func (EdDSA) GetVeryed

func (this EdDSA) GetVeryed() bool

获取验证后情况

func (EdDSA) MakePublicKey

func (this EdDSA) MakePublicKey() EdDSA

生成公钥

func (EdDSA) OnError

func (this EdDSA) OnError(fn EdDSAErrorFunc) EdDSA

引出错误信息

func (EdDSA) ParseEdPrivateKeyFromPEM

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

解析私钥

func (EdDSA) ParseEdPrivateKeyFromPEMWithPassword

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

解析私钥带密码

func (EdDSA) ParseEdPublicKeyFromPEM

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

解析公钥

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) ToVeryed

func (this EdDSA) ToVeryed() bool

验证结果

func (EdDSA) Very

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

公钥验证

func (EdDSA) WithData

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

设置 data

func (EdDSA) WithError

func (this EdDSA) WithError(err error) EdDSA

设置错误

func (EdDSA) WithParedData

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

设置 paredData

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) WithVeryed

func (this EdDSA) WithVeryed(data bool) EdDSA

设置 veryed

type EdDSAErrorFunc

type EdDSAErrorFunc = func(error)

错误方法

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