func generateECDSAKey(t *testing.T) *ecdsa.PrivateKey { privateKey, err := keys.GenerateECDSA() if err != nil { t.Errorf("failed to generate a key") } return privateKey }
func (srv *KeyService) GeneratePrivateKey(r *http.Request, args *GeneratePrivateKeyArgs, reply *GeneratePrivateKeyReply) error { key, err := keys.GenerateECDSA() if err != nil { reply.Success = false return err } err = env.DB.PutKey(args.Alias, key, false) if err != nil { reply.Success = false return err } reply.PublicKey = keys.ECDSAPublicKeyToString(key.PublicKey) reply.Success = true return nil }
func newKeyAuth() (ka *KeyAuth, e error) { pk, e := keys.GenerateECDSA() ka = &KeyAuth{key: pk} return }