Skip to content

Commit

Permalink
tozny#35 jdk example, the test passes, but i have no idea if this is …
Browse files Browse the repository at this point in the history
…considered secure or not, use at your own risk.
  • Loading branch information
spyhunter99 committed Jan 31, 2017
1 parent aed40cf commit 0eca258
Show file tree
Hide file tree
Showing 9 changed files with 952 additions and 124 deletions.
13 changes: 8 additions & 5 deletions .gitignore
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

13 changes: 13 additions & 0 deletions aes-crypto-jre/build.gradle
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"
}

Large diffs are not rendered by default.

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);

}

}
7 changes: 0 additions & 7 deletions aes-crypto-sample-app/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion aes-crypto/.gitignore

This file was deleted.

91 changes: 0 additions & 91 deletions aes-crypto/aes-crypto.iml

This file was deleted.

19 changes: 0 additions & 19 deletions java-aes-crypto.iml

This file was deleted.

2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':sample', ':aes-crypto'
include ':sample', ':aes-crypto', ':aes-crypto-jre'

0 comments on commit 0eca258

Please sign in to comment.