Documentation ¶
Overview ¶
Package basic is a basic implementation of a saltpack key/keyring configuration.
Index ¶
- type Keyring
- func (k *Keyring) GenerateBoxKey() (*SecretKey, error)
- func (k *Keyring) GenerateSigningKey() (*SigningSecretKey, error)
- func (k *Keyring) GetAllBoxSecretKeys() []saltpack.BoxSecretKey
- func (k *Keyring) ImportBoxEphemeralKey(kid []byte) saltpack.BoxPublicKey
- func (k *Keyring) ImportBoxKey(pub, sec *[32]byte)
- func (k *Keyring) ImportSigningKey(pub *[ed25519.PublicKeySize]byte, sec *[ed25519.PrivateKeySize]byte)
- func (k *Keyring) LookupBoxPublicKey(kid []byte) saltpack.BoxPublicKey
- func (k *Keyring) LookupBoxSecretKey(kids [][]byte) (int, saltpack.BoxSecretKey)
- func (k *Keyring) LookupSigningPublicKey(kid []byte) saltpack.SigningPublicKey
- type PrecomputedSharedKey
- type PublicKey
- type SecretKey
- func (k SecretKey) Box(receiver saltpack.BoxPublicKey, nonce *saltpack.Nonce, msg []byte) []byte
- func (k SecretKey) GetPublicKey() saltpack.BoxPublicKey
- func (k SecretKey) Precompute(sender saltpack.BoxPublicKey) saltpack.BoxPrecomputedSharedKey
- func (k SecretKey) Unbox(sender saltpack.BoxPublicKey, nonce *saltpack.Nonce, msg []byte) ([]byte, error)
- type SigningPublicKey
- type SigningSecretKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keyring ¶
type Keyring struct {
// contains filtered or unexported fields
}
Keyring holds signing and box secret/public keypairs.
func (*Keyring) GenerateBoxKey ¶
GenerateBoxKey generates a new Box secret key and imports it into the keyring.
func (*Keyring) GenerateSigningKey ¶
func (k *Keyring) GenerateSigningKey() (*SigningSecretKey, error)
GenerateSigningKey generates a signing key and import it into the keyring.
func (*Keyring) GetAllBoxSecretKeys ¶
func (k *Keyring) GetAllBoxSecretKeys() []saltpack.BoxSecretKey
GetAllBoxSecretKeys returns all secret Box keys in the keyring.
func (*Keyring) ImportBoxEphemeralKey ¶
func (k *Keyring) ImportBoxEphemeralKey(kid []byte) saltpack.BoxPublicKey
ImportBoxEphemeralKey takes a key ID and returns a public key useful for encryption/decryption.
func (*Keyring) ImportBoxKey ¶
ImportBoxKey imports an existing Box key into this keyring, from a raw byte arrays, first the public, and then the secret key halves.
func (*Keyring) ImportSigningKey ¶
func (k *Keyring) ImportSigningKey(pub *[ed25519.PublicKeySize]byte, sec *[ed25519.PrivateKeySize]byte)
ImportSigningKey imports the raw signing key into the keyring.
func (*Keyring) LookupBoxPublicKey ¶
func (k *Keyring) LookupBoxPublicKey(kid []byte) saltpack.BoxPublicKey
LookupBoxPublicKey returns the public key that corresponds to the given key ID (or "kid")
func (*Keyring) LookupBoxSecretKey ¶
func (k *Keyring) LookupBoxSecretKey(kids [][]byte) (int, saltpack.BoxSecretKey)
LookupBoxSecretKey tries to find one of the secret keys in its keyring given the possible key IDs. It returns the index and the key, if found, and -1 and nil otherwise.
func (*Keyring) LookupSigningPublicKey ¶
func (k *Keyring) LookupSigningPublicKey(kid []byte) saltpack.SigningPublicKey
LookupSigningPublicKey turns the given key ID ("kid") into a corresponding signing public key.
type PrecomputedSharedKey ¶
PrecomputedSharedKey is a basic implementation of a saltpack precomputed shared key, computed from a BasicPublicKey and a BasicPrivateKey
type PublicKey ¶
PublicKey is a basic implementation of a saltpack public key
func (PublicKey) CreateEphemeralKey ¶
func (k PublicKey) CreateEphemeralKey() (saltpack.BoxSecretKey, error)
CreateEphemeralKey takes a PublicKey and returns a new ephemeral secret key of the same type.
func (PublicKey) HideIdentity ¶
HideIdentity says not to hide the identity of this key.
func (PublicKey) ToKID ¶
ToKID takes a Publickey and returns a "key ID" or a KID, which is just the key itself in this implementation. It can be used to identify the key.
func (PublicKey) ToRawBoxKeyPointer ¶
ToRawBoxKeyPointer returns a RawBoxKey from a given public key. A RawBoxKey is just a bunch of bytes that can be used in the lower-level Box libraries.
type SecretKey ¶
type SecretKey struct {
// contains filtered or unexported fields
}
SecretKey is a basic implementation of a saltpack private key
func NewSecretKey ¶
NewSecretKey makes a new SecretKey from the raw 32-byte arrays the represent Box public and secret keys.
func (SecretKey) GetPublicKey ¶
func (k SecretKey) GetPublicKey() saltpack.BoxPublicKey
GetPublicKey returns the public key that corresponds to this secret key.
func (SecretKey) Precompute ¶
func (k SecretKey) Precompute(sender saltpack.BoxPublicKey) saltpack.BoxPrecomputedSharedKey
Precompute computes a shared key with the passed public key.
type SigningPublicKey ¶
SigningPublicKey is a basic public key used for verifying signatures. It's just a wrapper around an array of bytes.
func (SigningPublicKey) ToKID ¶
func (k SigningPublicKey) ToKID() []byte
ToKID returns the key id for this signing key. It just returns the key itself.
type SigningSecretKey ¶
type SigningSecretKey struct {
// contains filtered or unexported fields
}
SigningSecretKey is a basic secret key used for creating signatures and also for verifying signatures. It's a wrapper around an array of bytes and also the corresponding public key.
func NewSigningSecretKey ¶
func NewSigningSecretKey(pub *[ed25519.PublicKeySize]byte, sec *[ed25519.PrivateKeySize]byte) SigningSecretKey
NewSigningSecretKey creates a new baisic signing key fromm the input raw byte arrays.
func (SigningSecretKey) GetPublicKey ¶
func (k SigningSecretKey) GetPublicKey() saltpack.SigningPublicKey
GetPublicKey gets the public key that corresponds to this secret signing key