Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,14 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# AndroidStudio files
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
32 changes: 32 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.google.keytransparencyandroid"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile project(':keytransparency')
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
25 changes: 25 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/antonio.marcedone/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.google.exampleapp;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.google.keytransparencyandroid", appContext.getPackageName());
}
}
22 changes: 22 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.exampleapp">

<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.google.keytransparency.exampleapp.KeyTransparencyExample">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.google.keytransparency.exampleapp;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;

import com.google.exampleapp.R;
import com.google.keytransparency.KTClient;
import com.google.keytransparency.KeyTransparencyException;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class KeyTransparencyExample extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_key_transparency_example);
TextView tv = (TextView) findViewById(R.id.textView);

tv.setText("");
tv.setMovementMethod(new ScrollingMovementMethod());

try{
tv.append("\n\n --- GetEntry test using library --- \n");

KTClient client = new KTClient("35.184.134.53:8080", 1, getApplicationContext(), R.raw.server, R.raw.vrf_pubkey, R.raw.p256_pubkey, R.raw.trillian_log);
try {
client.getEntry("user","app",1000);
} catch (KeyTransparencyException e) {
tv.append("Expected exception was raised: " + e);
}

} catch (IOException e) {
e.printStackTrace();
tv.append("\nError reading one of the public keys: "+e.getMessage());
throw new RuntimeException("Error reading one of the public keys: "+e.getMessage(),e );
}
}

}
20 changes: 20 additions & 0 deletions app/src/main/res/layout/activity_key_transparency_example.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="horizontal"
android:gravity="center">


<TextView
android:id="@+id/textView"
android:scrollbars = "vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text=""
/>


</LinearLayout>
Binary file added app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions app/src/main/res/raw/p256_pubkey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEKv9XdfRJkfSF16zbMfr1hCKQsFcF
rZtX5urHF9ZDuOaR5xrCwd4Ji6dGxV2xNT87mi8kVAGQ/4q68QGt8rZ9Fw==
-----END PUBLIC KEY-----
18 changes: 18 additions & 0 deletions app/src/main/res/raw/server.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-----BEGIN CERTIFICATE-----
MIIC2jCCAcKgAwIBAgIJAIOUhwo/E+Q7MA0GCSqGSIb3DQEBCwUAMA0xCzAJBgNV
BAYTAlVTMB4XDTE3MDgwNzE2MTYzN1oXDTE4MDgwNzE2MTYzN1owDTELMAkGA1UE
BhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx6YvtMENV0Feq
7zEcg2f/X4UO+vvNLYrsvxgjYjPfKzd2NwWbjBFc7vrLwspMIhGSskmszNgnmIGu
FdtwgqNsuHay8+N1voh9BeaWnWXFXuUrsCitdcqFyPcxX7+YV8MxsH8iRLzOPsZ1
R2o/8/fZv/nUJ5ApGYWlDLoxFdBPtzBd6NpvJ5VWWBSJPaE3R/0VrkStkS4Str6h
hZfjw+6bxqHY9ao8Yz2M7GFaC6MPn/JLmY20rLp/TmreW1YOC0Y6BeD1wl9BfLnH
pCMaryQG32BJrRMlmoZF1qUcZ/Rfq869dcfVcF/pwKRteC+0x13gdyEtH6h7+Wit
/6ohVH2VAgMBAAGjPTA7MAwGA1UdEwQFMAMBAf8wKwYDVR0RBCQwIoIJa3Qtc2Vy
dmVygglsb2NhbGhvc3SHBAAAAACHBCO4hjUwDQYJKoZIhvcNAQELBQADggEBAAWR
BIc1h/ckCzs4y7/qqohxTqJNa04Me6eCgG79C0QyvkaLo6jnwjjVirp4paIwETXe
JpicVQTnkFzrrVLMopHD0GDL7yyjV6VR/nKyMgBT6bjil3WAOyDXW0Y0d4j50tsK
RFzoodochBYcVQDygoM5XUHcEJ/FBbf8glf7Z7OX9nPwQq0h+T53VkH842kYV0h/
95jqrVAfDL5jVJnjFsBi+KWmDgzBWFAZ4VTzMDgSU98em99ZDoW5b7118zo/vQOU
dAtGA9rvEFE/lp0H/jPB87qZAhq/6aRT/rjT3zdPWNoJL7mf/cTDvTqo7dKWEecR
ljYWLRfx4jYU7HJT6n4=
-----END CERTIFICATE-----
3 changes: 3 additions & 0 deletions app/src/main/res/raw/trillian_log.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEfzsONlxOpdPmNMtxsAahUGLgrwX+OSJDjTkLTgl3JaztUQnTpVh10DjYoaDhiJNiZqmKOPkxveVoPJ5Jr/Ex0Q==
-----END PUBLIC KEY-----
4 changes: 4 additions & 0 deletions app/src/main/res/raw/vrf_pubkey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAENZuDzGYmrJuoG7EkD0O2OEasXxoO
JA4HLQexWcF8MDgmlh27xS/Zwv20DNha8iBT26h2xNDo7exwVzL6+IBB2Q==
-----END PUBLIC KEY-----
6 changes: 6 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<resources></resources>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">KeyTransparencyAndroid</string>
</resources>
Loading