core: github.com/katzenpost/core/crypto/eddsa Index | Files

package eddsa

import "github.com/katzenpost/core/crypto/eddsa"

Package eddsa provides EdDSA (Ed25519) wrappers.

Index

Package Files

eddsa.go

Constants

const (
    // PublicKeySize is the size of a serialized PublicKey in bytes (32 bytes).
    PublicKeySize = ed25519.PublicKeySize

    // PrivateKeySize is the size of a serialized PrivateKey in bytes (64 bytes).
    PrivateKeySize = ed25519.PrivateKeySize

    // SignatureSize is the size of a serialized Signature in bytes (64 bytes).
    SignatureSize = ed25519.SignatureSize
)

type PrivateKey Uses

type PrivateKey struct {
    // contains filtered or unexported fields
}

PrivateKey is a EdDSA private key.

func Load Uses

func Load(privFile, pubFile string, r io.Reader) (*PrivateKey, error)

Load loads a new PrivateKey from the PEM encoded file privFile, optionally creating and saving a PrivateKey instead if an entropy source is provided. If pubFile is specified and a key has been created, the corresponding PublicKey will be written to pubFile in PEM format.

func NewKeypair Uses

func NewKeypair(r io.Reader) (*PrivateKey, error)

NewKeypair generates a new PrivateKey sampled from the provided entropy source.

func (*PrivateKey) Bytes Uses

func (k *PrivateKey) Bytes() []byte

Bytes returns the raw private key.

func (*PrivateKey) FromBytes Uses

func (k *PrivateKey) FromBytes(b []byte) error

FromBytes deserializes the byte slice b into the PrivateKey.

func (*PrivateKey) Identity Uses

func (k *PrivateKey) Identity() []byte

Identity returns the key's identity, in this case it's our public key in bytes.

func (*PrivateKey) InternalPtr Uses

func (k *PrivateKey) InternalPtr() *ed25519.PrivateKey

InternalPtr returns a pointer to the internal (`golang.org/x/crypto/ed25519`) data structure. Most people should not use this.

func (*PrivateKey) KeyType Uses

func (k *PrivateKey) KeyType() string

KeyType returns the key type string, in this case the constant variable whose value is "ed25519".

func (*PrivateKey) MarshalBinary Uses

func (k *PrivateKey) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface defined in https://golang.org/pkg/encoding/

func (*PrivateKey) PublicKey Uses

func (k *PrivateKey) PublicKey() *PublicKey

PublicKey returns the PublicKey corresponding to the PrivateKey.

func (*PrivateKey) Reset Uses

func (k *PrivateKey) Reset()

Reset clears the PrivateKey structure such that no sensitive data is left in memory.

func (*PrivateKey) Sign Uses

func (k *PrivateKey) Sign(msg []byte) []byte

Sign signs the message msg with the PrivateKey and returns the signature.

func (*PrivateKey) ToECDH Uses

func (k *PrivateKey) ToECDH() *ecdh.PrivateKey

ToECDH converts the PrivateKey to the corresponding ecdh.PrivateKey.

func (*PrivateKey) UnmarshalBinary Uses

func (k *PrivateKey) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface defined in https://golang.org/pkg/encoding/

type PublicKey Uses

type PublicKey struct {
    // contains filtered or unexported fields
}

PublicKey is a EdDSA public key.

func (*PublicKey) ByteArray Uses

func (k *PublicKey) ByteArray() [PublicKeySize]byte

ByteArray returns the raw public key as an array suitable for use as a map key.

func (*PublicKey) Bytes Uses

func (k *PublicKey) Bytes() []byte

Bytes returns the raw public key.

func (*PublicKey) Equal Uses

func (k *PublicKey) Equal(cmp *PublicKey) bool

Equal returns true iff the public key is byte for byte identical.

func (*PublicKey) FromBytes Uses

func (k *PublicKey) FromBytes(b []byte) error

FromBytes deserializes the byte slice b into the PublicKey.

func (*PublicKey) FromString Uses

func (k *PublicKey) FromString(s string) error

FromString deserializes the string s into the PublicKey.

func (*PublicKey) Identity Uses

func (k *PublicKey) Identity() []byte

Identity returns the key's identity, in this case it's our public key in bytes.

func (*PublicKey) InternalPtr Uses

func (k *PublicKey) InternalPtr() *ed25519.PublicKey

InternalPtr returns a pointer to the internal (`golang.org/x/crypto/ed25519`) data structure. Most people should not use this.

func (*PublicKey) MarshalBinary Uses

func (k *PublicKey) MarshalBinary() ([]byte, error)

MarshalBinary implements the BinaryMarshaler interface defined in https://golang.org/pkg/encoding/

func (*PublicKey) MarshalText Uses

func (k *PublicKey) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface defined in https://golang.org/pkg/encoding/

func (*PublicKey) Reset Uses

func (k *PublicKey) Reset()

Reset clears the PublicKey structure such that no sensitive data is left in memory. PublicKeys, despite being public may be considered sensitive in certain contexts (eg: if used once in path selection).

func (*PublicKey) String Uses

func (k *PublicKey) String() string

String returns the public key as a base64 encoded string.

func (*PublicKey) ToECDH Uses

func (k *PublicKey) ToECDH() *ecdh.PublicKey

ToECDH converts the PublicKey to the corresponding ecdh.PublicKey.

func (*PublicKey) ToPEMFile Uses

func (k *PublicKey) ToPEMFile(f string) error

ToPEMFile writes out the PublicKey to a PEM file at path f.

func (*PublicKey) UnmarshalBinary Uses

func (k *PublicKey) UnmarshalBinary(data []byte) error

UnmarshalBinary implements the BinaryUnmarshaler interface defined in https://golang.org/pkg/encoding/

func (*PublicKey) UnmarshalText Uses

func (k *PublicKey) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface defined in https://golang.org/pkg/encoding/

func (*PublicKey) Verify Uses

func (k *PublicKey) Verify(sig, msg []byte) bool

Verify returns true iff the signature sig is valid for the message msg.

Package eddsa imports 13 packages (graph) and is imported by 29 packages. Updated 2019-05-03. Refresh now. Tools for package owners.