func newGenerateToEnvironmentInstance(conf Config, name string, ks *keyStore.KeyStore) (*Access, error) { if err := checkForIsCa(name, ks); err != nil { return nil, err } pem, cert, err := ks.GeneratePem(name) if err != nil { return nil, errors.New("Could not generate pem for '%v'.", name).CausedBy(err) } return &Access{ t: GenerateToEnvironment, permission: conf.Permission, name: name, pem: pem, cert: cert, }, nil }
func newGenerateToFileInstance(conf Config, name string, ks *keyStore.KeyStore) (*Access, error) { if err := checkForIsCa(name, ks); err != nil { return nil, err } pem, cert, err := ks.GeneratePem(name) if err != nil { return nil, errors.New("Could not generate pem for '%v'.", name).CausedBy(err) } file, err := generateFileForPem(conf, pem) if err != nil { return nil, errors.New("Could not generate pem file for '%v'.", name).CausedBy(err) } return &Access{ t: GenerateToFile, permission: conf.Permission, name: name, pem: pem, cert: cert, temporaryFilename: &file, }, nil }