Skip to content

Commit

Permalink
Added script to Upload to bintray and renaming
Browse files Browse the repository at this point in the history
bintray

vault to package

renamed keystore_preferences to secure.sample
  • Loading branch information
vashisthg committed Jun 26, 2015
1 parent db55f1f commit fc96894
Show file tree
Hide file tree
Showing 46 changed files with 167 additions and 123 deletions.
5 changes: 5 additions & 0 deletions build.gradle
@@ -1,14 +1,18 @@
apply from: "./libraries.gradle"
apply from: './version.gradle'

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.novoda:bintray-release:0.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -34,3 +38,4 @@ allprojects {
}
}
}

96 changes: 93 additions & 3 deletions library/build.gradle
@@ -1,4 +1,15 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.novoda.bintray-release'

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.novoda:bintray-release:0.3.0'
}
}

android {
compileSdkVersion 22
Expand All @@ -7,8 +18,8 @@ android {
defaultConfig {
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
versionCode libraryVersionCode
versionName libraryVersionName
}
buildTypes {
release {
Expand All @@ -24,17 +35,96 @@ android {
}
}


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile libraries.appCompat
compile project(':vault')

testCompile testLibraries.mockito
testCompile testLibraries.jUnit

androidTestCompile testLibraries.mockito
androidTestCompile testLibraries.hamcrestLibrary
androidTestCompile testLibraries.hamcrestCore

}


def siteUrl = 'https://github.com/ophio/secure-preferences'
def gitUrl = 'https://github.com/ophio/secure-preferences.git'
group = "in.co.ophio"


install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'

// Add your description here
name 'This library aims to encrypt the data in shared preferences. The encryption key is stored in ' +
'Android Keystore System. https://developer.android.com/training/articles/keystore.html.'
url siteUrl

// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id System.getenv('BINTRAY_SECURE_PREF_USER_ID')
name System.getenv('BINTRAY_SECURE_PREF_USER_NAME')
email System.getenv('BINTRAY_SECURE_PREF_USER_EMAIL')
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl

}
}
}
}
}

artifacts {

}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
failOnError false
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}


publish {
userOrg = 'ophio'
groupId = 'in.co.ophio'
artifactId = 'secure-preferences'
publishVersion = libraryVersionName
desc = ''
website = 'https://github.com/ophio/secure-preferences'
}

apply from: rootProject.file('checkstyle_android_library.gradle')
Expand Up @@ -8,12 +8,15 @@
*/
public interface KeyGenerator {

/**
* @return String key to be used in encryption algorithms
* @throws GeneralSecurityException In case of Security Related exceptions
* @throws IOException If could unable to read/write key
*/
String loadOrGenerateKeys() throws GeneralSecurityException, IOException;

/**
* Flag indicating that the {@link com.example.android.vault.SecretKeyWrapper} public/private key is
* hardware-backed. A software keystore is more vulnerable to offline
* attacks if the device is compromised.
* @return boolean to know whether key is hardware backed or not
*/
boolean isHardwareBacked();

Expand Down
Expand Up @@ -4,8 +4,7 @@
import android.security.KeyChain;
import android.util.Base64;

import com.example.android.vault.SecretKeyWrapper;
import com.example.android.vault.Utils;


import java.io.File;
import java.io.IOException;
Expand All @@ -15,6 +14,9 @@
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;

import in.co.ophio.secure.vault.SecretKeyWrapper;
import in.co.ophio.secure.vault.Utils;

/**
* @author Gaurav Vashisth (vashisthg@gmail.com)
*/
Expand Down Expand Up @@ -54,6 +56,10 @@ public static KeyStoreKeyGenerator get(Application application, String fileName)
return new KeyStoreKeyGenerator(application, fileName);
}

/**
* If key is already present then returns it otherwise generates a random key and returns it
* @return key
*/
@Override
public String loadOrGenerateKeys()
throws GeneralSecurityException, IOException {
Expand All @@ -75,6 +81,12 @@ public String loadOrGenerateKeys()
.DEFAULT);
}

/**
* Indicates whether the {@link SecretKeyWrapper} public/private key is
* hardware-backed. A software keystore is more vulnerable to offline
* attacks if the device is compromised.
* @return boolean to know wheter key is hardware backed or not
*/
@Override
public boolean isHardwareBacked() {
return isHardwareBacked;
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.android.vault;
package in.co.ophio.secure.vault;

import android.content.Context;
import android.security.KeyPairGeneratorSpec;
Expand Down
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package com.example.android.vault;
package in.co.ophio.secure.vault;

import android.os.ParcelFileDescriptor;

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion app/build.gradle → sample/build.gradle
@@ -1,12 +1,13 @@
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'


android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "in.co.ophio.keystore_preferences"
applicationId "in.co.ophio.secure.sample"
minSdkVersion 18
targetSdkVersion 22
versionCode 1
Expand Down
File renamed without changes.
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="in.co.ophio.keystore_preferences">
package="in.co.ophio.secure.sample">

<application
android:name=".KeystoreApplication"
Expand Down
@@ -1,10 +1,10 @@
package in.co.ophio.keystore_preferences;
package in.co.ophio.secure.sample;

import android.app.Application;

import in.co.ophio.keystore_preferences.module.AppComponent;
import in.co.ophio.keystore_preferences.module.AppModule;
import in.co.ophio.keystore_preferences.module.DaggerAppComponent;
import in.co.ophio.secure.sample.module.AppComponent;
import in.co.ophio.secure.sample.module.AppModule;
import in.co.ophio.secure.sample.module.DaggerAppComponent;

/**
* @author ragdroid (garima.my.way@gmail.com)
Expand Down
@@ -1,4 +1,4 @@
package in.co.ophio.keystore_preferences.entity;
package in.co.ophio.secure.sample.entity;

/**
* @author ragdroid (garima.my.way@gmail.com)
Expand Down
@@ -1,12 +1,12 @@
package in.co.ophio.keystore_preferences.module;
package in.co.ophio.secure.sample.module;

import javax.inject.Singleton;

import dagger.Component;
import in.co.ophio.keystore_preferences.util.KeystoreAccountUtils;
import in.co.ophio.keystore_preferences.view.LoggedInFragment;
import in.co.ophio.keystore_preferences.view.MainActivity;
import in.co.ophio.keystore_preferences.view.MainFragment;
import in.co.ophio.secure.sample.util.KeystoreAccountUtils;
import in.co.ophio.secure.sample.view.LoggedInFragment;
import in.co.ophio.secure.sample.view.MainActivity;
import in.co.ophio.secure.sample.view.MainFragment;

/**
* @author ragdroid (garima.my.way@gmail.com)
Expand Down
@@ -1,4 +1,4 @@
package in.co.ophio.keystore_preferences.module;
package in.co.ophio.secure.sample.module;

import android.app.Application;
import android.content.Context;
Expand All @@ -7,8 +7,8 @@

import dagger.Module;
import dagger.Provides;
import in.co.ophio.keystore_preferences.util.AccountUtils;
import in.co.ophio.keystore_preferences.util.KeystoreAccountUtils;
import in.co.ophio.secure.sample.util.AccountUtils;
import in.co.ophio.secure.sample.util.KeystoreAccountUtils;
import in.co.ophio.secure.core.KeyGenerator;
import in.co.ophio.secure.core.KeyStoreKeyGenerator;

Expand Down
@@ -1,6 +1,6 @@
package in.co.ophio.keystore_preferences.util;
package in.co.ophio.secure.sample.util;

import in.co.ophio.keystore_preferences.entity.UserCredential;
import in.co.ophio.secure.sample.entity.UserCredential;

/**
* @author ragdroid (garima.my.way@gmail.com)
Expand Down
@@ -1,4 +1,4 @@
package in.co.ophio.keystore_preferences.util;
package in.co.ophio.secure.sample.util;

import android.content.Context;
import android.content.SharedPreferences;
Expand All @@ -11,8 +11,8 @@

import javax.inject.Inject;

import in.co.ophio.keystore_preferences.KeystoreApplication;
import in.co.ophio.keystore_preferences.entity.UserCredential;
import in.co.ophio.secure.sample.KeystoreApplication;
import in.co.ophio.secure.sample.entity.UserCredential;
import in.co.ophio.secure.core.KeyGenerator;
import in.co.ophio.secure.core.ObscuredPreferencesBuilder;

Expand Down
@@ -1,4 +1,4 @@
package in.co.ophio.keystore_preferences.view;
package in.co.ophio.secure.sample.view;

import android.app.Activity;
import android.app.Fragment;
Expand All @@ -12,9 +12,9 @@

import butterknife.ButterKnife;
import butterknife.OnClick;
import in.co.ophio.keystore_preferences.KeystoreApplication;
import in.co.ophio.keystore_preferences.R;
import in.co.ophio.keystore_preferences.util.AccountUtils;
import in.co.ophio.secure.sample.KeystoreApplication;
import in.co.ophio.secure.sample.R;
import in.co.ophio.secure.sample.util.AccountUtils;

/**
* @author ragdroid (garima.my.way@gmail.com)
Expand Down
@@ -1,4 +1,4 @@
package in.co.ophio.keystore_preferences.view;
package in.co.ophio.secure.sample.view;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
Expand All @@ -7,9 +7,9 @@

import javax.inject.Inject;

import in.co.ophio.keystore_preferences.KeystoreApplication;
import in.co.ophio.keystore_preferences.R;
import in.co.ophio.keystore_preferences.util.AccountUtils;
import in.co.ophio.secure.sample.KeystoreApplication;
import in.co.ophio.secure.sample.R;
import in.co.ophio.secure.sample.util.AccountUtils;

/**
* @author ragdroid (garima.my.way@gmail.com)
Expand Down

0 comments on commit fc96894

Please sign in to comment.