Commit Graph

112 Commits

Author SHA1 Message Date
Andrew Ayer
be237fe27d Fix formatting in NEWS.md 2014-11-16 17:25:02 -08:00
Andrew Ayer
6520746bce Update 'git-crypt help' message
Documented new arguments to 'git-crypt migrate-key' and adjusted spacing.
2014-11-15 20:31:01 -08:00
Andrew Ayer
3bf7d8e512 migrate-key: take separate arguments for old key and new key
I don't want to encourage people to overwrite their old keys
until they've successfully unlocked their repository with the
migrated key.
2014-11-15 20:30:35 -08:00
Andrew Ayer
bd262f6126 Add documentation for multiple keys 2014-11-15 18:06:36 -08:00
Andrew Ayer
cf990dc9df Minor formatting updates to README 2014-11-15 18:06:23 -08:00
Andrew Ayer
e70d067b48 Rearrange a couple paragraphs in the README 2014-09-21 12:00:31 -07:00
Andrew Ayer
4796a1e288 Clarify some wording in README 2014-09-21 12:00:31 -07:00
Andrew Ayer
e4d1091e97 Rename add-gpg-key command, etc. to add-gpg-user, etc.
While writing the documention, I found that "GPG user" was less confusing
terminology than "GPG key," since you aren't really adding a "key"
to git-crypt, and git-crypt already uses "key" to refer to other concepts
(cf. the -k/--key-name options).
2014-09-21 12:00:31 -07:00
Andrew Ayer
04906c5355 Write a usage message for every command
You can run 'git-crypt help COMMAND' to see it.
2014-09-21 12:00:31 -07:00
Andrew Ayer
24fff1ce6f Document experimental Windows support 2014-09-21 12:00:31 -07:00
Andrew Ayer
acc3d2ecb3 Fix capitalization of git-crypt in INSTALL.md 2014-09-21 12:00:31 -07:00
Andrew Ayer
9e340b510d Document GPG mode in README 2014-09-21 12:00:31 -07:00
Andrew Ayer
0538d111fc Usage message: refer to gpg key argument as "user ID" not "key ID"
This is the terminology that the gpg man page uses.
2014-09-21 12:00:31 -07:00
Andrew Ayer
746bb5def3 Remove unlink_internal_key function
I think it's simpler this way.
2014-09-21 12:00:31 -07:00
Andrew Ayer
16c4a827c0 Error message if you try to lock repository that's not locked 2014-09-21 12:00:31 -07:00
Andrew Ayer
3799a23aa7 Add missing argument when throwing System_error 2014-09-21 12:00:31 -07:00
Andrew Ayer
e9e90fc873 For consistency, always use NULL internally to represent the default key 2014-09-21 12:00:31 -07:00
Andrew Ayer
88e8e3a265 Display error if both -k and -a options passed to git-crypt lock 2014-09-21 12:00:31 -07:00
Andrew Ayer
690dba2f14 Add multi-platform remove_file helper
And use it for deleting internal keys
2014-09-21 12:00:31 -07:00
Andrew Ayer
70879eaf57 Tweak git-crypt usage message
* Change the wording for 'git-crypt lock'.
 * Move 'git-crypt lock' to 'Common commands' section since it's
   common to both GPG and symmetric mode.
 * Reduce whitespace in the output so it fits in 80 characters.
2014-09-21 12:00:31 -07:00
Andrew Ayer
42aa7db245 Credit Michael Schout in THANKS file 2014-09-21 12:00:31 -07:00
Michael Schout
3726df181d add support for "git-crypt lock"
This does the reverse of what git-crypt unlock does:
    - unconfigures the git filters
    - forcibly checks out HEAD version

Usage:
    git crypt lock                  locks repo using the "default" key

    git crypt lock -k NAME          locks the repo, using unlocked key named NAME
    git crypt lock --key-name=NAME

    git crypt lock -a               locks the repo, removing ALL unlocked keys
    git crypt lock --all

Result is that you can now decrypt and then revert back to encrypted
form of files and vice versa.

Modified-by: Andrew Ayer <agwa@andrewayer.name>

  * Make argv argument to lock() const.
  * Minor whitespace/style fixes to conform to project conventions.

Signed-off-by: Andrew Ayer <agwa@andrewayer.name>
2014-09-21 12:00:31 -07:00
Andrew Ayer
316e194f84 README: document problems with Atlassian SourceTree 2014-09-21 12:00:31 -07:00
Andrew Ayer
8460d00bbf README: add notes about gitattributes 2014-09-21 12:00:31 -07:00
Andrew Ayer
4495af1274 README: update security and limitations sections 2014-09-21 12:00:31 -07:00
Andrew Ayer
9c190a5a89 Add CONTRIBUTING and THANKS files 2014-09-09 09:00:35 -07:00
Andrew Ayer
9f59cc23b9 Merge branch 'revamp' into 'master'
Conflicts:
	Makefile
2014-09-06 19:32:55 -07:00
Andrew Ayer
725f442ce4 Remove a TODO comment
I've decided not to do it
2014-09-06 17:25:31 -07:00
Andrew Ayer
adaea41d4e add-gpg-key: add -n/--no-commit option to inhibit committing 2014-09-06 17:25:05 -07:00
Andrew Ayer
e37566f180 status: properly detect files encrypted with alternative key names 2014-09-06 15:43:00 -07:00
Andrew Ayer
10622f6dcc Raise an error if legacy key file has trailing data 2014-09-06 14:59:16 -07:00
Andrew Ayer
f50feec2dd Display helpful information when smudge detects an unencrypted file 2014-09-06 14:59:12 -07:00
Andrew Ayer
8b159b543f Avoid possible undefined behavior with empty std::vector
In particular, &bytes[0] is undefined if bytes is empty.
2014-08-18 14:12:34 -07:00
Andrew Ayer
b07f49b9b3 smudge: if file is not encrypted, just copy through clear text
Since Git consults the checked-out .gitattributes instead of the
.gitattributes in effect at the time the file was committed, Git
may invoke the smudge filter on old versions of a file that were
committed without encryption.
2014-08-06 19:04:17 -07:00
Andrew Ayer
07231c1630 Set 'required' option on Git filter to true
This signals to Git that the filter must complete successfully for the
content to be usable.
2014-08-02 21:34:17 -07:00
Andrew Ayer
da25322dbc Remove stubs for profile support
Multiple key support provides the functionality I was planning to provide
with profiles.
2014-08-02 21:23:52 -07:00
Andrew Ayer
47e810d592 Write and use create_protected_file() helper
Instead of using umask to ensure sensitive files are created with
restrictive permissions, git-crypt now does:

	create_protected_file(filename);
	std::ofstream out(filename);
	// ...

create_protected_file can have different Unix and Windows implementations.
create_protected_file should be easier to implement on Windows than a
umask equivalent, and this pattern keeps the amount of platform-specific
code to a minimum and avoids #ifdefs.
2014-08-02 21:18:28 -07:00
Andrew Ayer
01f152b746 Check HMAC in smudge and diff commands
Git-crypt's position has always been that authentication is best left
to Git, since 1) Git provides immutable history based on SHA-1 hashes
as well as GPG-signed commits and tags, and 2) git-crypt can't be used
safely anyways unless the overall integrity of your repository is assured.

But, since git-crypt already has easy access to a (truncated) HMAC of the
file when decrypting, there's really no reason why git-crypt shouldn't
just verify it and provide an additional layer of protection.
2014-08-02 21:17:17 -07:00
Andrew Ayer
9e791d97ee Factor out some common code into a helper function 2014-07-23 19:55:50 -07:00
Andrew Ayer
477983f4bc Ensure memsets of sensitive memory aren't optimized away 2014-07-23 19:32:30 -07:00
Andrew Ayer
23ff272f7d Simplify CTR code 2014-07-23 19:23:39 -07:00
Andrew Ayer
8de40f40b3 Wipe AES key from memory after using it 2014-07-23 19:23:39 -07:00
Andrew Ayer
22bae167b0 Make Aes_impl and Hmac_impl private member classes 2014-07-23 19:23:39 -07:00
Andrew Ayer
0210fd7541 Use auto_ptr instead of explicit memory management 2014-07-23 19:23:39 -07:00
Jon Sailor
66a2266968 Pull out openssl code into separate crypto-openssl.cpp file
This will allow the use of different crypto libraries in the future.

Modified-by: Andrew Ayer <agwa@andrewayer.name>

  * Don't include openssl/err.h from git-crypt.cpp
  * Fix whitespace and other style to conform to project conventions
  * Remove unnecessary operators from Aes_ctr_encryptor
  * Rename crypto_init to init_crypto, for consistency with init_std_streams()
2014-07-23 19:22:48 -07:00
Andrew Ayer
f6e3b63a93 Makefile: avoid use of non-standard $^ 2014-07-07 21:49:12 -07:00
Andrew Ayer
d417f97f8e Make argv arrays const 2014-07-05 14:22:55 -07:00
Andrew Ayer
3d0e7570ed Update usage message 2014-07-05 11:46:58 -07:00
Andrew Ayer
3fe85bc928 Rename add-collab, etc. to add-gpg-key, etc.
Since GPG support might be used by a single user and not necessarily
among collaborators.
2014-07-05 11:46:51 -07:00
Andrew Ayer
2ba7f0e374 unlock: decrypt all possible keys when using GPG
It's no longer necessary to specify the -k option to unlock when
using GPG.  unlock will automatically decrypt all keys which the user
can access.
2014-07-02 22:12:18 -07:00