Documentation ¶
Index ¶
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 ( EmptyPrivateKey = PrivateKey("") EmptyPublicKey = PublicKey("") )
View Source
const ( EC = "EC" // Elliptic Curve InvalidKeyType = "" // Invalid KeyType OctetSeq = "oct" // Octet sequence (used to represent symmetric keys) RSA = "RSA" // RSA )
Supported values for KeyType
Variables ¶
This section is empty.
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 PrivateKey ¶
type PrivateKey string
func GenerateEd25519PrivateKey ¶ added in v0.5.0
func GenerateEd25519PrivateKey() (PrivateKey, error)
func NewEphemeralSharedKey ¶ added in v0.7.0
func NewEphemeralSharedKey(pub PublicKey) (*PrivateKey, []byte, error)
NewEphemeralSharedKey creates a new ec25519 key pair, calculates a shared secret given a public key, and returns the created public key and secret
func NewPrivateKey ¶
func NewPrivateKey(seed []byte) PrivateKey
func (PrivateKey) Bytes ¶ added in v0.5.0
func (i PrivateKey) Bytes() []byte
func (PrivateKey) IsEmpty ¶ added in v0.5.0
func (i PrivateKey) IsEmpty() bool
func (PrivateKey) PublicKey ¶
func (i PrivateKey) PublicKey() PublicKey
func (PrivateKey) Sign ¶ added in v0.5.0
func (i PrivateKey) Sign(message []byte) []byte
func (PrivateKey) String ¶ added in v0.5.0
func (i PrivateKey) String() string
Click to show internal directories.
Click to hide internal directories.