Documentation
¶
Index ¶
- type File
- func (f *File) GenKey(keys *Keys, suite abstract.Suite) (KeyPair, error)
- func (f *File) Key(key *KeyInfo, suites map[string]abstract.Suite) (KeyPair, error)
- func (f *File) Keys(keys *Keys, suites map[string]abstract.Suite, defaultSuite abstract.Suite) ([]KeyPair, error)
- func (f *File) Load(appName string, configData interface{}) error
- func (f *File) Save() error
- type KeyInfo
- type KeyPair
- type Keys
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
Cryptographic configuration file
func (*File) GenKey ¶
Generate a new public/private keypair with the given ciphersuite and Save it to the application's previously-loaded configuration.
func (*File) Keys ¶
func (f *File) Keys(keys *Keys, suites map[string]abstract.Suite, defaultSuite abstract.Suite) ([]KeyPair, error)
Retrieve a set of public/private keypairs configured for this application. The caller must provide a pointer to an instance of the Keys struct, which should be embedded in the configData object that was passed to Load. If the provided defaultSuite is non-nil and no keypairs are configured yet, automatically creates and saves a keypair with the specified defaultSuite.
If any of the configured public keys cannot be loaded for whatever reason, such as a key's ciphersuite becoming no-longer-supported for example, logs a warning but continues to load any other configured keys.
type KeyInfo ¶
type KeyInfo struct { Suite string // Name of this key's ciphersuite PubId string // Public key's base64-encoded hash-ID }
KeyInfo represents configuration data for a particular public key, consisting of the name of the ciphersuite the public key was generated from and the unpadded, base64-encoded Hash-Id of the public key itself using the appropriate ciphersuite's hash function. The corresponding private key is stored separately for security.
type KeyPair ¶
type KeyPair struct { Suite abstract.Suite // Ciphersuite this keypair is for Public abstract.Point // Public key Secret abstract.Scalar // Secret key }
KeyPair represents a public/private keypair together with the ciphersuite the key was generated from.
func NewKeyPair ¶
NewKeyPair directly creates a secret/public key pair