fetcher git: Clean up encryption setup
This commit is contained in:
parent
024c93d822
commit
4757b86ddb
|
@ -241,27 +241,25 @@ namespace SparkleLib.Git {
|
||||||
|
|
||||||
public override void EnableFetchedRepoCrypto (string password)
|
public override void EnableFetchedRepoCrypto (string password)
|
||||||
{
|
{
|
||||||
// Define the crypto filter in the config
|
// Set up the encryption filter
|
||||||
string repo_config_file_path = new string [] { TargetFolder, ".git", "config" }.Combine ();
|
SparkleGit git_config_smudge = new SparkleGit (TargetFolder,
|
||||||
string config = File.ReadAllText (repo_config_file_path);
|
"config filter.encryption.smudge \"openssl enc -d -aes-256-cbc -base64 -S " + this.crypto_salt +
|
||||||
|
" -pass file:.git/info/encryption_password\"");
|
||||||
|
|
||||||
string n = Environment.NewLine;
|
SparkleGit git_config_clean = new SparkleGit (TargetFolder,
|
||||||
|
"config filter.encryption.clean \"openssl enc -e -aes-256-cbc -base64 -S " + this.crypto_salt +
|
||||||
|
" -pass file:.git/info/encryption_password\"");
|
||||||
|
|
||||||
string salt = this.crypto_salt;
|
git_config_smudge.StartAndWaitForExit ();
|
||||||
|
git_config_clean.StartAndWaitForExit ();
|
||||||
|
|
||||||
config += "[filter \"crypto\"]" + n +
|
// Pass all files through the encryption filter
|
||||||
"\tsmudge = openssl enc -d -aes-256-cbc -base64 -S " + salt + " -pass file:.git/password" + n +
|
|
||||||
"\tclean = openssl enc -e -aes-256-cbc -base64 -S " + salt + " -pass file:.git/password" + n;
|
|
||||||
|
|
||||||
File.WriteAllText (repo_config_file_path, config);
|
|
||||||
|
|
||||||
// Pass all files through the crypto filter
|
|
||||||
string git_attributes_file_path = new string [] { TargetFolder, ".git", "info", "attributes" }.Combine ();
|
string git_attributes_file_path = new string [] { TargetFolder, ".git", "info", "attributes" }.Combine ();
|
||||||
File.AppendAllText (git_attributes_file_path, "\n* filter=crypto");
|
File.WriteAllText (git_attributes_file_path, "\n* filter=encryption");
|
||||||
|
|
||||||
// Store the password
|
// Store the password
|
||||||
string password_file_path = new string [] { TargetFolder, ".git", "password" }.Combine ();
|
string password_file_path = new string [] { TargetFolder, ".git", "info", "encryption_password" }.Combine ();
|
||||||
File.WriteAllText (password_file_path, password.Trim ());
|
File.WriteAllText (password_file_path, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue