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
- Variables
- type ED448
- func FromBase64String(data string) ED448
- func FromBytes(data []byte) ED448
- func FromHexString(data string) ED448
- func FromPrivateKey(key []byte) ED448
- func FromPrivateKeySeed(seed []byte) ED448
- func FromPrivateKeyWithPassword(key []byte, password string) ED448
- func FromPublicKey(key []byte) ED448
- func FromString(data string) ED448
- func GenerateKey() ED448
- func GenerateKeyWithSeed(reader io.Reader) ED448
- func New() ED448
- func NewED448() ED448
- func (this ED448) AppendError(err ...error) ED448
- func (this ED448) CheckKeyPair() bool
- func (this ED448) CreatePrivateKey() ED448
- func (this ED448) CreatePrivateKeyWithPassword(password string, opts ...any) ED448
- func (this ED448) CreatePublicKey() ED448
- func (this ED448) Error() error
- func (this ED448) FromBase64String(data string) ED448
- func (this ED448) FromBytes(data []byte) ED448
- func (this ED448) FromHexString(data string) ED448
- func (this ED448) FromPrivateKey(key []byte) ED448
- func (this ED448) FromPrivateKeyDer(der []byte) ED448
- func (this ED448) FromPrivateKeySeed(seed []byte) ED448
- func (this ED448) FromPrivateKeyWithPassword(key []byte, password string) ED448
- func (this ED448) FromPublicKey(key []byte) ED448
- func (this ED448) FromPublicKeyDer(der []byte) ED448
- func (this ED448) FromString(data string) ED448
- func (this ED448) GenerateKey() ED448
- func (this ED448) GenerateKeyWithSeed(reader io.Reader) ED448
- func (this ED448) GetData() []byte
- func (this ED448) GetErrors() []error
- func (this ED448) GetKeyData() []byte
- func (this ED448) GetOptions() *Options
- func (this ED448) GetParsedData() []byte
- func (this ED448) GetPrivateKey() ed448.PrivateKey
- func (this ED448) GetPrivateKeySeed() []byte
- func (this ED448) GetPublicKey() ed448.PublicKey
- func (this ED448) GetVerify() bool
- func (this ED448) MakeKeyDer() ED448
- func (this ED448) MakePublicKey() ED448
- func (this ED448) OnError(fn EdDSAErrorFunc) ED448
- func (this ED448) ParsePrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)
- func (this ED448) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (crypto.PrivateKey, error)
- func (this ED448) ParsePublicKeyFromPEM(key []byte) (crypto.PublicKey, error)
- func (this ED448) SetOptions(name string, context ...string) ED448
- func (this ED448) Sign() ED448
- func (this ED448) ToBase64String() string
- func (this ED448) ToBytes() []byte
- func (this ED448) ToHexString() string
- func (this ED448) ToKeyBytes() []byte
- func (this ED448) ToKeyString() string
- func (this ED448) ToString() string
- func (this ED448) ToVerify() bool
- func (this ED448) ToVerifyInt() int
- func (this ED448) Verify(data []byte) ED448
- func (this ED448) WithData(data []byte) ED448
- func (this ED448) WithErrors(errs []error) ED448
- func (this ED448) WithOptions(op *Options) ED448
- func (this ED448) WithParsedData(data []byte) ED448
- func (this ED448) WithPrivateKey(data ed448.PrivateKey) ED448
- func (this ED448) WithPublicKey(data ed448.PublicKey) ED448
- func (this ED448) WithVerify(data bool) ED448
- type EdDSAErrorFunc
- type Options
- type Opts
- type PBKDF2Opts
- type ScryptOpts
Constants ¶
View Source
const ( SchemeED448 = ed448.ED448 SchemeED448Ph = ed448.ED448Ph )
Variables ¶
View Source
var ( // 获取 Cipher 类型 GetCipherFromName = pkcs8.GetCipherFromName // 获取 hash 类型 GetHashFromName = pkcs8.GetHashFromName )
Functions ¶
This section is empty.
Types ¶
type ED448 ¶
type ED448 struct { // 错误 Errors []error // contains filtered or unexported fields }
*
- ED448 *
- @create 2023-10-25
- @author deatil
func FromPrivateKeyWithPassword ¶
私钥
func (ED448) CreatePrivateKeyWithPassword ¶
生成 PKCS8 私钥带密码 pem 数据 CreatePrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (ED448) FromPrivateKeyWithPassword ¶
私钥带密码
func (ED448) GenerateKeyWithSeed ¶
生成密钥
func (ED448) GetParsedData ¶ added in v1.0.2049
获取 parsedData
func (ED448) ParsePrivateKeyFromPEM ¶
func (this ED448) ParsePrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)
解析私钥
func (ED448) ParsePrivateKeyFromPEMWithPassword ¶
func (this ED448) ParsePrivateKeyFromPEMWithPassword(key []byte, password string) (crypto.PrivateKey, error)
解析私钥带密码
func (ED448) ParsePublicKeyFromPEM ¶
解析公钥
func (ED448) SetOptions ¶
设置 options 可用类型 [ED448Ph | ED448]
func (ED448) WithParsedData ¶ added in v1.0.2049
设置 parsedData
func (ED448) WithPrivateKey ¶
func (this ED448) WithPrivateKey(data ed448.PrivateKey) ED448
设置 PrivateKey
func (ED448) WithPublicKey ¶
设置 PublicKey
Click to show internal directories.
Click to hide internal directories.