ed448

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

Overview

// 生成公钥私钥 / CreateKey: obj := ed448.

New().
GenerateKey()

objPriKey := obj.

CreatePrivateKey().
// CreatePrivateKeyWithPassword("123", "AES256CBC").
ToKeyString()

objPubKey := obj.

CreatePublicKey().
ToKeyString()

// 签名验证 / Sign or Verify: obj := ed448.New()

ctx := "123sedrftd35"

pri := `-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----` priEn := `-----BEGIN ENCRYPTED PRIVATE KEY-----...-----END ENCRYPTED PRIVATE KEY-----` sig := obj.

FromString("test-pass").
FromPrivateKey([]byte(pri)).
// FromPrivateKeyWithPassword([]byte(priEn), "123").
// 其他设置, 默认为 ED448 模式, ctx 为空
// SetOptions("ED448", "").
// SetOptions("ED448", ctx).
// SetOptions("ED448Ph", ctx).
Sign().
ToBase64String()

pub := `-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----` text := obj.

FromBase64String("MjkzNzYzMDE1NjgzNDExMTM0ODE1MzgxOTAxMDIxNzQ0Nzg3NTc3NTAxNTU2MDIwNzg4OTc1MzY4Mzc0OTE5NzcyOTg3NjI1MTc2OTErNDgzNDU3NDAyMzYyODAzMDM3MzE1NjE1NDk1NDEzOTQ4MDQ3NDQ3ODA0MDE4NDY5NDA1OTA3ODExNjM1Mzk3MDEzOTY4MTM5NDg2NDc=").
FromPublicKey([]byte(pub)).
// SetOptions("ED448", "").
// SetOptions("ED448", ctx).
// SetOptions("ED448Ph", ctx).
Verify([]byte("test-pass")).
ToVerify()

Index

Constants

View Source
const (
	SchemeED448   = ed448.ED448
	SchemeED448Ph = ed448.ED448Ph
)

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/ed448: invalid key: Key must be a PEM encoded PKCS8 key")
	ErrNotEdPrivateKey     = errors.New("go-cryptobin/ed448: key is not a valid ED448 private key")
	ErrNotEdPublicKey      = errors.New("go-cryptobin/ed448: key is not a valid ED448 public key")
)

Functions

This section is empty.

Types

type ED448

type ED448 struct {

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

*

  • ED448 *
  • @create 2023-10-25
  • @author deatil

func FromBase64String

func FromBase64String(data string) ED448

From Base64 String

func FromBytes

func FromBytes(data []byte) ED448

From Bytes

func FromHexString

func FromHexString(data string) ED448

From Hex String

func FromPrivateKey

func FromPrivateKey(key []byte) ED448

From PrivateKey bytes

func FromPrivateKeyDer

func FromPrivateKeyDer(der []byte) ED448

From PrivateKey Der bytes

func FromPrivateKeySeed

func FromPrivateKeySeed(seed []byte) ED448

From PrivateKey Seed bytes

func FromPrivateKeyWithPassword

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

From PrivateKey bytes With Password

func FromPublicKey

func FromPublicKey(key []byte) ED448

From PublicKey bytes

func FromPublicKeyDer

func FromPublicKeyDer(der []byte) ED448

From PublicKey Der bytes

func FromString

func FromString(data string) ED448

From String

func GenerateKey

func GenerateKey() ED448

GenerateKey

func GenerateKeyWithSeed

func GenerateKeyWithSeed(reader io.Reader) ED448

GenerateKey With Seed

func New

func New() ED448

New ED448

func NewED448

func NewED448() ED448

NewED448

func (ED448) AppendError

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

append error

func (ED448) CheckKeyPair

func (this ED448) CheckKeyPair() bool

Check KeyPair

func (ED448) CreatePrivateKey

func (this ED448) CreatePrivateKey() ED448

Create PrivateKey PEM data

func (ED448) CreatePrivateKeyWithPassword

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

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

func (ED448) CreatePublicKey

func (this ED448) CreatePublicKey() ED448

Create PublicKey PEM data

func (ED448) Error

func (this ED448) Error() error

return error

func (ED448) FromBase64String

func (this ED448) FromBase64String(data string) ED448

From Base64 String

func (ED448) FromBytes

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

From Bytes

func (ED448) FromHexString

func (this ED448) FromHexString(data string) ED448

From Hex String

func (ED448) FromPrivateKey

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

From PrivateKey bytes

func (ED448) FromPrivateKeyDer

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

From PrivateKey Der bytes

func (ED448) FromPrivateKeySeed

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

From PrivateKey Seed bytes

func (ED448) FromPrivateKeyString

func (this ED448) FromPrivateKeyString(keyString string) ED448

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

func (ED448) FromPrivateKeyWithPassword

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

From PrivateKey bytes With Password

func (ED448) FromPublicKey

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

From PublicKey bytes

func (ED448) FromPublicKeyDer

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

From PublicKey Der bytes

func (ED448) FromPublicKeyString

func (this ED448) FromPublicKeyString(keyString string) ED448

PublicKey hex string

func (ED448) FromString

func (this ED448) FromString(data string) ED448

From String

func (ED448) GenerateKey

func (this ED448) GenerateKey() ED448

GenerateKey

func (ED448) GenerateKeyWithSeed

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

GenerateKey With Seed

func (ED448) GetData

func (this ED448) GetData() []byte

Get data

func (ED448) GetErrors

func (this ED448) GetErrors() []error

Get Error list

func (ED448) GetKeyData

func (this ED448) GetKeyData() []byte

Get keyData

func (ED448) GetOptions

func (this ED448) GetOptions() *Options

Get Options

func (ED448) GetParsedData

func (this ED448) GetParsedData() []byte

Get parsedData

func (ED448) GetPrivateKey

func (this ED448) GetPrivateKey() ed448.PrivateKey

Get PrivateKey

func (ED448) GetPrivateKeySeed

func (this ED448) GetPrivateKeySeed() []byte

Get PrivateKeySeed

func (ED448) GetPrivateKeySeedString

func (this ED448) GetPrivateKeySeedString() string

Get PrivateKeySeed

func (ED448) GetPrivateKeyString

func (this ED448) GetPrivateKeyString() string

get PrivateKey data hex string

func (ED448) GetPublicKey

func (this ED448) GetPublicKey() ed448.PublicKey

Get PublicKey

func (ED448) GetPublicKeyString

func (this ED448) GetPublicKeyString() string

get PublicKey data hex string

func (ED448) GetVerify

func (this ED448) GetVerify() bool

Get verify

func (ED448) MakeKeyDer

func (this ED448) MakeKeyDer() ED448

Make Key Der data

func (ED448) MakePublicKey

func (this ED448) MakePublicKey() ED448

Make PublicKey

func (ED448) OnError

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

func (ED448) ParsePrivateKeyFromPEM

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

Parse PrivateKey From PEM

func (ED448) ParsePrivateKeyFromPEMWithPassword

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

Parse PrivateKey From PEM With Password

func (ED448) ParsePublicKeyFromPEM

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

Parse PublicKey From PEM

func (ED448) SetOptions

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

With options 可用类型 [ED448Ph | ED448]

func (ED448) Sign

func (this ED448) Sign() ED448

privateKey Sign

func (ED448) ToBase64String

func (this ED448) ToBase64String() string

output base64 data

func (ED448) ToBytes

func (this ED448) ToBytes() []byte

output bytes data

func (ED448) ToHexString

func (this ED448) ToHexString() string

output hex data

func (ED448) ToKeyBytes

func (this ED448) ToKeyBytes() []byte

output key bytes data

func (ED448) ToKeyString

func (this ED448) ToKeyString() string

output key string data

func (ED448) ToString

func (this ED448) ToString() string

output string data

func (ED448) ToVerify

func (this ED448) ToVerify() bool

output verify data

func (ED448) ToVerifyInt

func (this ED448) ToVerifyInt() int

output verify int data

func (ED448) Verify

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

publicKey Verify

func (ED448) WithData

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

With data

func (ED448) WithErrors

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

With error list

func (ED448) WithOptions

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

With options

func (ED448) WithParsedData

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

With parsedData

func (ED448) WithPrivateKey

func (this ED448) WithPrivateKey(data ed448.PrivateKey) ED448

With PrivateKey

func (ED448) WithPublicKey

func (this ED448) WithPublicKey(data ed448.PublicKey) ED448

With PublicKey

func (ED448) WithVerify

func (this ED448) WithVerify(data bool) ED448

With verify

type Options

type Options = ed448.Options

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