diff --git a/git-encrypt/Git-craft v0.1.0 Design Document.docx b/git-encrypt/Git-craft v0.1.0 Design Document.docx new file mode 100644 index 0000000000000000000000000000000000000000..8d71b35d6ec350a018c72382272d332b2865f40f Binary files /dev/null and b/git-encrypt/Git-craft v0.1.0 Design Document.docx differ diff --git a/git-encrypt/craft/.gitignore b/git-encrypt/craft/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..18208ad1e13fc4f8eab5d9bf9d98a34d9dc74604 --- /dev/null +++ b/git-encrypt/craft/.gitignore @@ -0,0 +1,9 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ + +#craft keys +key_files/* + +#filter config +.gitattributes \ No newline at end of file diff --git a/git-encrypt/craft/Cargo.toml b/git-encrypt/craft/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..1b17dddc3fc7bd8f3f5e6f31323fb5bcb4e4d6e6 --- /dev/null +++ b/git-encrypt/craft/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "git-craft" +version = "0.1.0" +edition = "2021" + + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[workspace] + +[dependencies] +anyhow = "1.0.69" +pgp = "0.10.2" +rand = "0.8.5" +smallvec = "1.10.0" +clap = { version = "4.3.0", features = ["derive"] } + diff --git a/git-encrypt/craft/README.md b/git-encrypt/craft/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8b544bdf62b64080252f3704acd657cb8f710707 --- /dev/null +++ b/git-encrypt/craft/README.md @@ -0,0 +1,45 @@ +# Git-craft v0.1.0 + +Git-craft is a extension for git, it can encrypt the content when submitting code in Git, and rewrite the content of the Blob object and code decryption when reading the Blob content, with filter. + +## Prepare +1. cd mega/craft +2. modify all the key file path, KEY_FILE_PATH, MSG_FILE_NAME and filter to match your project +3. cargo build --release + +## Usage + +1. git-craft generate-key + - git-craft will default generate a public key to /key_files/pub.asc and a secret key to /key_files/sec.asc +2. git-craft generate-key-full [primary_id] [key_name] + - git-craft will generate key with primary id and key name you entered to default file path +3. git-craft encrypt [public_key_path] + - git-craft will get the file content and encrypt it, it should be used without public key path now, because I set a default key path +4. git-craft decrypt [secret_key_path] + - git-craft will decrypt blob data read from git's standard input stream, it should be used without secret key path now, because I set a default key path +5. git-craft list-keys [Option] + - git-craft will list keys name, key's fingerprint and id, it should be used without key path now, because I set a default key path +6. git-craft delete-key [key_name] [Option] + - git-craft will show you what keys you have now, then remove keys by key name you entered, it should be used without key path now, because I set a default key path + + + +## About Filter + +1. edit .git/config "../craft/key_files/sec.asc" is a default key, you can use another key. +- [filter "crypt"] + smudge = ../craft/target/release/git-craft decrypt ../craft/key_files/sec.asc + clean = ../craft/target/release/git-craft encrypt ../craft/key_files/pub.asc +2. edit .gitattributes +- file_need_crypted filter=crypt -text +- *.txt filter=crypt -text (it will use filter crypt at all txt file in this git dir) +3. must be used arguments + 1. Two commands below are used when you dont need crypt. + - git -c filter.crypt.smudge=noop