diff --git a/README.md b/README.md index e78b284..80b324d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ CI](https://circleci.com/gh/rockaport/alice.svg?style=shield)](https://circleci. [](https://codecov.io/gh/rockaport/alice) # alice -Alice is a Java AES encryption library for working with byte arrays, files, and streams. Various key lengths, block modes, padding schemes, key deriviation functions, and Message Authentication Codes (MAC) are available. See the [javadoc](https://rockaport.github.io/alice) for more information. +Alice is a Java AES/DES encryption library for working with byte arrays, files, and streams. Various key lengths, block modes, padding schemes, key deriviation functions, and Message Authentication Codes (MAC) are available. See the [javadoc](https://rockaport.github.io/alice) for more information. Alice provides an easy wrapper around the javax.crypto cipher suite for symmetric key encryption. if a MAC algorithm is selected, additional [Authenticated Encryption](https://en.wikipedia.org/wiki/Authenticated_encryption) is performed using an [encrypt-then-mac](https://en.wikipedia.org/wiki/Authenticated_encryption#Encrypt-then-MAC_.28EtM.29) scheme. diff --git a/alice/build.gradle b/alice/build.gradle index aaed01c..2681427 100644 --- a/alice/build.gradle +++ b/alice/build.gradle @@ -8,8 +8,6 @@ sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 dependencies { - compile 'com.squareup.okio:okio:1.11.0' - compile "org.codehaus.groovy:groovy-all:2.4.1" testCompile 'org.spockframework:spock-core:1.1-groovy-2.4-rc-3' @@ -33,7 +31,7 @@ task codeCoverageReport(type: JacocoReport) { reports { xml.enabled true - xml.destination "${buildDir}/reports/jacoco/report.xml" + xml.destination file("${buildDir}/reports/jacoco/report.xml") html.enabled true csv.enabled false } diff --git a/alice/src/main/java/com/rockaport/alice/Alice.java b/alice/src/main/java/com/rockaport/alice/Alice.java index 16f3fbe..935ec18 100644 --- a/alice/src/main/java/com/rockaport/alice/Alice.java +++ b/alice/src/main/java/com/rockaport/alice/Alice.java @@ -1,7 +1,5 @@ package com.rockaport.alice; -import okio.Buffer; - import javax.crypto.*; import javax.crypto.spec.GCMParameterSpec; import javax.crypto.spec.IvParameterSpec; @@ -159,9 +157,10 @@ private Mac getMac(AliceContext.MacAlgorithm macAlgorithm, char[] password) thro * @param password the password * @return an encrypted byte array * @throws GeneralSecurityException if initialization or encryption fails + * @throws IOException if there's a problem constructing the result */ @SuppressWarnings("WeakerAccess") - public synchronized byte[] encrypt(byte[] input, char[] password) throws GeneralSecurityException { + public synchronized byte[] encrypt(byte[] input, char[] password) throws GeneralSecurityException, IOException { if (input == null || input.length == 0) { throw new IllegalArgumentException("Input is either null or empty"); } @@ -182,7 +181,7 @@ public synchronized byte[] encrypt(byte[] input, char[] password) throws General byte[] encryptedBytes = cipher.doFinal(input); // construct the output (IV || CIPHER) - Buffer output = new Buffer(); + ByteArrayOutputStream output = new ByteArrayOutputStream(); output.write(cipher.getIV()); output.write(encryptedBytes); @@ -192,7 +191,7 @@ public synchronized byte[] encrypt(byte[] input, char[] password) throws General output.write(getMac(context.getMacAlgorithm(), password).doFinal(encryptedBytes)); } - return output.readByteArray(); + return output.toByteArray(); } /** diff --git a/docs/allclasses-frame.html b/docs/allclasses-frame.html index 7540caf..303612b 100644 --- a/docs/allclasses-frame.html +++ b/docs/allclasses-frame.html @@ -2,9 +2,9 @@
- +public byte[] encrypt(byte[] input, char[] password) - throws java.security.GeneralSecurityException+ throws java.security.GeneralSecurityException, + java.io.IOException
java.security.GeneralSecurityException
- if initialization or
encryption fails
java.io.IOException
- if there's a problem constructing the result
+