Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateSharedKey(priv PrivateKey, pub PublicKey) ([]byte, error)
- func GenerateTLSCertificate(privateKey PrivateKey) (*tls.Certificate, error)
- type KeyAlgorithm
- type KeyUsage
- type PrivateKey
- func (k PrivateKey) IsEmpty() bool
- func (k PrivateKey) MarshalJSON() ([]byte, error)
- func (k PrivateKey) MarshalString() (string, error)
- func (k PrivateKey) MarshalText() ([]byte, error)
- func (k PrivateKey) PublicKey() PublicKey
- func (k PrivateKey) Sign(message []byte) []byte
- func (k PrivateKey) String() string
- func (k *PrivateKey) UnmarshalJSON(s []byte) error
- func (k *PrivateKey) UnmarshalString(s string) error
- func (k *PrivateKey) UnmarshalText(s []byte) error
- type PublicKey
- func (k PublicKey) Equals(w PublicKey) bool
- func (k PublicKey) IsEmpty() bool
- func (k PublicKey) MarshalJSON() ([]byte, error)
- func (k PublicKey) MarshalString() (string, error)
- func (k PublicKey) MarshalText() ([]byte, error)
- func (k PublicKey) String() string
- func (k *PublicKey) UnmarshalJSON(s []byte) error
- func (k *PublicKey) UnmarshalString(s string) error
- func (k *PublicKey) UnmarshalText(s []byte) error
- func (k PublicKey) Verify(message []byte, signature []byte) error
Constants ¶
View Source
const ( // P256 curve P256 string = "P-256" // P384 curve P384 string = "P-384" // P521 curve P521 string = "P-521" )
View Source
const ( ErrUnsupportedKeyAlgorithm = errors.Error("key algorithm not supported") ErrInvalidSignature = errors.Error("invalid signature") )
View Source
const ( Ed25519Private KeyAlgorithm = 0x1300 // well known value Ed25519Public KeyAlgorithm = 0xED // well known value PeerKey KeyUsage = 0x6E00 // codec code for nimona _peer_ key IdentityKey KeyUsage = 0x6E01 // codec code for nimona _identity_ key )
Variables ¶
View Source
var ( EmptyPublicKey = PublicKey{} EmptyPrivateKey = PrivateKey{} )
Functions ¶
func CalculateSharedKey ¶ added in v0.7.0
func CalculateSharedKey( priv PrivateKey, pub PublicKey, ) ([]byte, error)
CalculateSharedKey calculates a shared secret given a private an public key
func GenerateTLSCertificate ¶ added in v0.5.0
func GenerateTLSCertificate(privateKey PrivateKey) (*tls.Certificate, error)
GenerateTLSCertificate for TLS serverset
Types ¶
type KeyAlgorithm ¶ added in v0.18.0
type KeyAlgorithm uint64
type PrivateKey ¶
type PrivateKey struct { Usage KeyUsage Algorithm KeyAlgorithm RawKey ed25519.PrivateKey }
func CalculateEphemeralSharedKey ¶ added in v0.18.0
func CalculateEphemeralSharedKey( pub PublicKey, ) (PrivateKey, []byte, error)
CalculateEphemeralSharedKey creates a new ec25519 key pair, calculates a shared secret given a public key, and returns the created public key and secret
func NewEd25519PrivateKey ¶ added in v0.18.0
func NewEd25519PrivateKey(keyType KeyUsage) (PrivateKey, error)
func NewEd25519PrivateKeyFromSeed ¶ added in v0.18.0
func NewEd25519PrivateKeyFromSeed( seed []byte, keyType KeyUsage, ) PrivateKey
func NewSharedKey ¶ added in v0.15.4
func NewSharedKey( priv PrivateKey, pub PublicKey, ) (PrivateKey, []byte, error)
NewSharedKey calculates a shared secret given a private and a public key, and returns it
func (PrivateKey) IsEmpty ¶ added in v0.5.0
func (k PrivateKey) IsEmpty() bool
func (PrivateKey) MarshalJSON ¶ added in v0.18.0
func (k PrivateKey) MarshalJSON() ([]byte, error)
func (PrivateKey) MarshalString ¶ added in v0.18.0
func (k PrivateKey) MarshalString() (string, error)
func (PrivateKey) MarshalText ¶ added in v0.18.0
func (k PrivateKey) MarshalText() ([]byte, error)
func (PrivateKey) PublicKey ¶
func (k PrivateKey) PublicKey() PublicKey
func (PrivateKey) Sign ¶ added in v0.5.0
func (k PrivateKey) Sign(message []byte) []byte
func (PrivateKey) String ¶ added in v0.5.0
func (k PrivateKey) String() string
func (*PrivateKey) UnmarshalJSON ¶ added in v0.18.0
func (k *PrivateKey) UnmarshalJSON(s []byte) error
func (*PrivateKey) UnmarshalString ¶ added in v0.18.0
func (k *PrivateKey) UnmarshalString(s string) error
func (*PrivateKey) UnmarshalText ¶ added in v0.18.0
func (k *PrivateKey) UnmarshalText(s []byte) error
type PublicKey ¶
type PublicKey struct { Usage KeyUsage Algorithm KeyAlgorithm RawKey ed25519.PublicKey }
func NewEd25519PublicKeyFromRaw ¶ added in v0.18.0
func (PublicKey) MarshalJSON ¶ added in v0.18.0
func (PublicKey) MarshalString ¶ added in v0.18.0
func (PublicKey) MarshalText ¶ added in v0.18.0
func (*PublicKey) UnmarshalJSON ¶ added in v0.18.0
func (*PublicKey) UnmarshalString ¶ added in v0.18.0
func (*PublicKey) UnmarshalText ¶ added in v0.18.0
Click to show internal directories.
Click to hide internal directories.