Пример #1
0
func loadReader(optLocation string, crypter dkeyczar.Crypter) dkeyczar.KeyReader {
	if optLocation == "" {
		panic("missing required location argument")
		//return nil
	}

	lr := dkeyczar.NewFileReader(optLocation)

	if crypter != nil {
		//fmt.Println("decrypting keys..")
		lr = dkeyczar.NewEncryptedReader(lr, crypter)
	}

	return lr
}
Пример #2
0
func loadLocationReader(km dkeyczar.KeyManager, location string, crypter dkeyczar.Crypter) error {
	if location == "" {
		panic("missing required location argument")
	}

	lr := dkeyczar.NewFileReader(location)

	if crypter != nil {
		//fmt.Println("decrypting keys..")
		lr = dkeyczar.NewEncryptedReader(lr, crypter)
	}

	err := km.Load(lr)
	if err != nil {
		return fmt.Errorf("failed to load key: %s", err)
	}
	return nil
}
Пример #3
0
func loadLocationReader(km dkeyczar.KeyManager, optLocation string, crypter dkeyczar.Crypter) bool {
	if optLocation == "" {
		fmt.Println("missing required --location argument")
		return false
	}

	lr := dkeyczar.NewFileReader(optLocation)

	if crypter != nil {
		fmt.Println("decrypting keys..")
		lr = dkeyczar.NewEncryptedReader(lr, crypter)
	}

	err := km.Load(lr)
	if err != nil {
		fmt.Println("failed to load key:", err)
		return false
	}
	return true
}