Documentation ¶
Overview ¶
Package eddsa provides EdDSA (Ed25519) wrappers.
Index ¶
- Constants
- type PrivateKey
- func (k *PrivateKey) Bytes() []byte
- func (k *PrivateKey) FromBytes(b []byte) error
- func (k *PrivateKey) Identity() []byte
- func (k *PrivateKey) InternalPtr() *ed25519.PrivateKey
- func (k *PrivateKey) KeyType() string
- func (k *PrivateKey) MarshalBinary() ([]byte, error)
- func (k *PrivateKey) PublicKey() *PublicKey
- func (k *PrivateKey) Reset()
- func (k *PrivateKey) Sign(msg []byte) []byte
- func (k *PrivateKey) ToECDH() *ecdh.PrivateKey
- func (k *PrivateKey) UnmarshalBinary(data []byte) error
- type PublicKey
- func (k *PublicKey) ByteArray() [PublicKeySize]byte
- func (k *PublicKey) Bytes() []byte
- func (k *PublicKey) Equal(cmp *PublicKey) bool
- func (k *PublicKey) FromBytes(b []byte) error
- func (k *PublicKey) FromString(s string) error
- func (k *PublicKey) Identity() []byte
- func (k *PublicKey) InternalPtr() *ed25519.PublicKey
- func (k *PublicKey) MarshalBinary() ([]byte, error)
- func (k *PublicKey) MarshalText() ([]byte, error)
- func (k *PublicKey) Reset()
- func (k *PublicKey) String() string
- func (k *PublicKey) ToECDH() *ecdh.PublicKey
- func (k *PublicKey) ToPEMFile(f string) error
- func (k *PublicKey) UnmarshalBinary(data []byte) error
- func (k *PublicKey) UnmarshalText(data []byte) error
- func (k *PublicKey) Verify(sig, msg []byte) bool
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 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey is a EdDSA private key.
func Load ¶
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 ¶
func NewKeypair(r io.Reader) (*PrivateKey, error)
NewKeypair generates a new PrivateKey sampled from the provided entropy source.
func (*PrivateKey) FromBytes ¶
func (k *PrivateKey) FromBytes(b []byte) error
FromBytes deserializes the byte slice b into the PrivateKey.
func (*PrivateKey) Identity ¶ added in v0.0.4
func (k *PrivateKey) Identity() []byte
Identity returns the key's identity, in this case it's our public key in bytes.
func (*PrivateKey) InternalPtr ¶
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 ¶ added in v0.0.4
func (k *PrivateKey) KeyType() string
KeyType returns the key type string, in this case the constant variable whose value is "ed25519".
func (*PrivateKey) MarshalBinary ¶ added in v0.0.7
func (k *PrivateKey) MarshalBinary() ([]byte, error)
MarshalBinary implements the BinaryMarshaler interface defined in https://golang.org/pkg/encoding/
func (*PrivateKey) PublicKey ¶
func (k *PrivateKey) PublicKey() *PublicKey
PublicKey returns the PublicKey corresponding to the PrivateKey.
func (*PrivateKey) Reset ¶
func (k *PrivateKey) Reset()
Reset clears the PrivateKey structure such that no sensitive data is left in memory.
func (*PrivateKey) Sign ¶
func (k *PrivateKey) Sign(msg []byte) []byte
Sign signs the message msg with the PrivateKey and returns the signature.
func (*PrivateKey) ToECDH ¶
func (k *PrivateKey) ToECDH() *ecdh.PrivateKey
ToECDH converts the PrivateKey to the corresponding ecdh.PrivateKey.
func (*PrivateKey) UnmarshalBinary ¶ added in v0.0.7
func (k *PrivateKey) UnmarshalBinary(data []byte) error
UnmarshalBinary implements the BinaryUnmarshaler interface defined in https://golang.org/pkg/encoding/
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is a EdDSA public key.
func (*PublicKey) ByteArray ¶
func (k *PublicKey) ByteArray() [PublicKeySize]byte
ByteArray returns the raw public key as an array suitable for use as a map key.
func (*PublicKey) FromString ¶
FromString deserializes the string s into the PublicKey.
func (*PublicKey) Identity ¶ added in v0.0.4
Identity returns the key's identity, in this case it's our public key in bytes.
func (*PublicKey) InternalPtr ¶
InternalPtr returns a pointer to the internal (`golang.org/x/crypto/ed25519`) data structure. Most people should not use this.
func (*PublicKey) MarshalBinary ¶
MarshalBinary implements the BinaryMarshaler interface defined in https://golang.org/pkg/encoding/
func (*PublicKey) MarshalText ¶
MarshalText implements the TextMarshaler interface defined in https://golang.org/pkg/encoding/
func (*PublicKey) Reset ¶
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) UnmarshalBinary ¶
UnmarshalBinary implements the BinaryUnmarshaler interface defined in https://golang.org/pkg/encoding/
func (*PublicKey) UnmarshalText ¶
UnmarshalText implements the TextUnmarshaler interface defined in https://golang.org/pkg/encoding/