// Helper functions that will return the suite used during the process from a string name func GetSuite(suite string) abstract.Suite { s, ok := suites.All()[suite] if !ok { dbg.Lvl1("Suites available:", suites.All()) dbg.Fatal("Didn't find suite", suite) } return s }
func readConfig() error { // Load the configuration file configFile.Load("dissent", &configData) // Read or create our public/private keypairs pairs, err := configFile.Keys(&configData.Keys, suites.All(), defaultSuite) if err != nil { return err } keyPairs = pairs println("Loaded", len(pairs), "key-pairs") return nil }
import ( "github.com/dedis/crypto/config" "github.com/dedis/crypto/nist" "github.com/dedis/crypto/suites" ) type ConfigData struct { Keys config.Keys // Configured key-pairs for this timestap server } var keyPairs []config.KeyPair var configData ConfigData var configFile config.File var defaultSuite = nist.NewAES128SHA256P256() var cryptoSuites = suites.All() func readConfig() error { // Load the configuration file configFile.Load("stampd", &configData) // Read or create our public/private keypairs pairs, err := configFile.Keys(&configData.Keys, cryptoSuites, defaultSuite) if err != nil { return err } keyPairs = pairs return nil