-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
444 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,84 @@ | ||
# easencrypt | ||
# EasEncrypt | ||
|
||
The simple encryption library for Java. | ||
|
||
## Introduction | ||
|
||
The Java encryption and cipher APIs can be a bit challenging, especially for people who are | ||
inexperienced in encryption. This library is meant to be an abstraction/simplification so that | ||
everyone can easily integrate RSA/DSA and/or AES/DES into their projects. | ||
|
||
## Example | ||
|
||
First, initialize the encryptors with just 3 lines of code: | ||
|
||
``` | ||
// Initialize the RSA cipher. This can be swapped out for a custom implementation. | ||
AsymmetricEncrypter rsaEncrypter = new RsaEncrypter(); | ||
// Generate a keypair. Since this is the default Java keypair, it's compatible with external code. | ||
KeyPair keyPair = rsaEncrypter.generateKeyPair(); | ||
// Initialze an encrypter with a cipher (which can be swapped out for other implementations). | ||
LongTextEncrypter encrypter = new LongTextEncrypterImpl(new DesCipher(), rsaEncrypter); | ||
``` | ||
|
||
...and you're off to the races! Now just encrypt and decrypt whenever you like: | ||
|
||
### Encrypt | ||
|
||
``` | ||
String encrypted = encrypter.encrypt("Hello world!", keyPair.getPublic()); | ||
String decrypted = encrypter.decrypt(encrypted, keyPair.getPrivate()); // "Hello world!" | ||
``` | ||
|
||
## Installation | ||
|
||
Since EasEncrypt is only hosted on Github, you need to install [JitPack](https://jitpack.io) into | ||
your gradle project: | ||
|
||
```grails | ||
repositories { | ||
... | ||
maven { url "https://jitpack.io" } | ||
} | ||
``` | ||
|
||
Then, you can add EasEncrypt to your dependencies: | ||
|
||
```grails | ||
dependencies { | ||
compile 'com.github.robinkanters:easencrypt:0.1' | ||
} | ||
``` | ||
|
||
Your final `build.gradle` file will look something like this: | ||
|
||
```grails | ||
group 'com.yourname' | ||
version '1.0-SNAPSHOT' | ||
apply plugin: 'java' | ||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
repositories { | ||
mavenCentral() | ||
maven { url "https://jitpack.io" } | ||
} | ||
dependencies { | ||
// your other dependencies here | ||
compile 'com.github.robinkanters:easencrypt:0.1' | ||
// your other dependencies here | ||
} | ||
``` | ||
|
||
## License | ||
|
||
EasEncrypt is distributed under the GNU General Public License v2.0. Please see [the official | ||
documentation](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) or the LICENSE file in | ||
this repository for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters