forked from tozny/java-aes-crypto
-
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.
tozny#35 jdk example, the test passes, but i have no idea if this is …
…considered secure or not, use at your own risk.
- Loading branch information
1 parent
aed40cf
commit 0eca258
Showing
9 changed files
with
952 additions
and
124 deletions.
There are no files selected for viewing
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,7 +1,10 @@ | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.idea/* | ||
local.properties | ||
.idea | ||
.DS_Store | ||
/build | ||
build | ||
*.iml | ||
.gradle/ | ||
local.properties | ||
.externalNativeBuild | ||
|
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apply plugin: 'java' | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
} | ||
|
||
sourceCompatibility = "1.7" | ||
targetCompatibility = "1.7" | ||
|
||
dependencies { | ||
compile "commons-codec:commons-codec:1.10" | ||
testCompile "junit:junit:4.12" | ||
} |
898 changes: 898 additions & 0 deletions
898
aes-crypto-jre/src/main/java/com/tozny/crypto/android/AesCbcWithIntegrity.java
Large diffs are not rendered by default.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
aes-crypto-jre/src/test/java/com/tozny/crypto/android/AesCbcWithIntegrityTest.java
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.tozny.crypto.android; | ||
|
||
import com.tozny.crypto.android.AesCbcWithIntegrity; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
*/ | ||
public class AesCbcWithIntegrityTest { | ||
|
||
public AesCbcWithIntegrityTest() { | ||
} | ||
|
||
@Test | ||
public void testEncryptionDecryptionWorks() throws Exception { | ||
AesCbcWithIntegrity.SecretKeys keys = AesCbcWithIntegrity.generateKey(); | ||
|
||
//encrypt | ||
AesCbcWithIntegrity.CipherTextIvMac cipherTextIvMac = AesCbcWithIntegrity.encrypt("some test", keys); | ||
//store or send to server | ||
String ciphertextString = cipherTextIvMac.toString(); | ||
|
||
//decrypt | ||
String plainText = AesCbcWithIntegrity.decryptString(cipherTextIvMac, keys); | ||
|
||
assertEquals("some test", plainText); | ||
|
||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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 @@ | ||
include ':sample', ':aes-crypto' | ||
include ':sample', ':aes-crypto', ':aes-crypto-jre' |