func OpenKeyStoreForReading(params KeyStoreParameters) (keystore.ServerKeyStore, error) {
	if filesystemV2.IsKeyDirectory(params.KeyDir()) {
		return openKeyStoreV2(params)
	}
	return openKeyStoreV1(params)
}
OpenKeyStoreForReading opens a keystore suitable for reading keys.
package keys
import (
	"errors"
	"flag"
	"github.com/cossacklabs/acra/keystore"
	keystoreV1 "github.com/cossacklabs/acra/keystore"
	filesystemV1 "github.com/cossacklabs/acra/keystore/filesystem"
	keystoreV2 "github.com/cossacklabs/acra/keystore/v2/keystore"
	"github.com/cossacklabs/acra/keystore/v2/keystore/api"
	filesystemV2 "github.com/cossacklabs/acra/keystore/v2/keystore/filesystem"
	log "github.com/sirupsen/logrus"
)
var (
	ErrNotImplementedV1 = errors.New("not implemented for keystore v1")
)
type KeyStoreParameters interface {
	KeyDir() string
	KeyDirPublic() string
}
type CommonKeyStoreParameters struct {
	keyDir       string
	keyDirPublic string
}
func (p *CommonKeyStoreParameters) KeyDir() string {
	return p.keyDir
}
func (p *CommonKeyStoreParameters) KeyDirPublic() string {
	if p.keyDirPublic == "" {
		return p.keyDir
	}
	return p.keyDirPublic
}
func (p *CommonKeyStoreParameters) Register(flags *flag.FlagSet) {
	p.RegisterPrefixed(flags, DefaultKeyDirectory, "", "")
}
func (p *CommonKeyStoreParameters) RegisterPrefixed(flags *flag.FlagSet, defaultKeysDir, flagPrefix, descriptionSuffix string) {
	if descriptionSuffix != "" {
		descriptionSuffix = " " + descriptionSuffix
	}
	flags.StringVar(&p.keyDir, flagPrefix+"keys_dir", defaultKeysDir, "path to key directory"+descriptionSuffix)
	flags.StringVar(&p.keyDirPublic, flagPrefix+"keys_dir_public", "", "path to key directory for public keys"+descriptionSuffix)
}