ed25519

package
v0.0.0-...-00d340d Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeyType_PubRSA public key of rsa
	KeyType_PubRSA = "RsaPublicKey"
	// KeyType_PriRSA private key of rsa
	KeyType_PriRSA = "RsaPrivateKey"
	// KeyType_PubED25119 public key of ed25519
	KeyType_PubED25119 = "EdDsaPublicKey"
	// KeyType_PriED25119 private key of ed25519
	KeyType_PriED25119 = "EdDsaPrivateKey"
)
View Source
const (
	// Usage_EncDec used for encrypt and decrypt
	Usage_EncDec = "EncryptDecrypt"
	// Usage_SignVerify used for signature and verify
	Usage_SignVerify = "SignVerify"
	// Usage_Other used for all other unused crypto option
	Usage_Other = "Other"
)
View Source
const (
	// PublicKeySize is the size, in bytes, of public keys as used in this package.
	PublicKeySize = 32
	// PrivateKeySize is the size, in bytes, of private keys as used in this package.
	PrivateKeySize = 64
	// SignatureSize is the size, in bytes, of signatures generated and verified by this package.
	SignatureSize = 64
)

Variables

This section is empty.

Functions

func Keypair

func Keypair() (pub *PublicKey, pri *PrivateKey, err error)

KeyPair generate keypair of ed25519

Types

type PrivateKey

type PrivateKey struct {
	Usage          string `json:"usage"`
	KeyType        string `json:"key_type"`
	PrivateKeyData []byte `json:"private_key_data"`
}

PrivateKey store private key and its information

func (*PrivateKey) GetRawData

func (privateKey *PrivateKey) GetRawData() []byte

GetRawData return the key

func (*PrivateKey) GetType

func (privateKey *PrivateKey) GetType() string

GetType return type of the key

func (*PrivateKey) GetUsage

func (privateKey *PrivateKey) GetUsage() string

GetUsage return usage of the key

func (*PrivateKey) Sign

func (privateKey *PrivateKey) Sign(message []byte) ([]byte, error)

Sign data with the privateKey

type PublicKey

type PublicKey struct {
	Usage         string `json:"usage"`
	KeyType       string `json:"key_type"`
	PublicKeyData []byte `json:"public_key_data"`
}

PublicKey store public key and its information

func (*PublicKey) GetRawData

func (publicKey *PublicKey) GetRawData() []byte

GetRawData return the key

func (*PublicKey) GetType

func (publicKey *PublicKey) GetType() string

GetType return type of the key

func (*PublicKey) GetUsage

func (publicKey *PublicKey) GetUsage() string

GetUsage return usage of the key

func (*PublicKey) Verify

func (publicKey *PublicKey) Verify(message []byte, signedMessage []byte) error

Verify signature with the publicKey

Jump to

Keyboard shortcuts

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