mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-25 08:16:07 +00:00
Add remnant local changes
This commit is contained in:
parent
a5c6c329ab
commit
c79c9f84dc
5 changed files with 30 additions and 27 deletions
|
@ -5,12 +5,7 @@ import android.content.Context;
|
|||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import agency.tango.materialintroscreen.MaterialIntroActivity;
|
||||
import agency.tango.materialintroscreen.MessageButtonBehaviour;
|
||||
|
@ -23,21 +18,21 @@ public class IntroActivity extends MaterialIntroActivity {
|
|||
super.onCreate(savedInstanceState);
|
||||
|
||||
addSlide(new SlideFragmentBuilder()
|
||||
.backgroundColor(R.color.colorPrimary)
|
||||
.buttonsColor(R.color.colorAccent)
|
||||
.image(R.drawable.intro_shield)
|
||||
.title("Welcome")
|
||||
.description("Aegis is a brand new open source(!) authenticator app which generates tokens for your accounts.")
|
||||
.build());
|
||||
.backgroundColor(R.color.colorPrimary)
|
||||
.buttonsColor(R.color.colorAccent)
|
||||
.image(R.drawable.intro_shield)
|
||||
.title("Welcome")
|
||||
.description("Aegis is a brand new open source(!) authenticator app which generates tokens for your accounts.")
|
||||
.build());
|
||||
|
||||
addSlide(new SlideFragmentBuilder()
|
||||
.backgroundColor(R.color.colorAccent)
|
||||
.buttonsColor(R.color.colorPrimary)
|
||||
.neededPermissions(new String[]{Manifest.permission.CAMERA})
|
||||
.image(R.drawable.intro_scanner)
|
||||
.title("Permissions")
|
||||
.description("Aegis needs permission to your camera in order to function properly. This is needed to scan QR codes.")
|
||||
.build(),
|
||||
.backgroundColor(R.color.colorAccent)
|
||||
.buttonsColor(R.color.colorPrimary)
|
||||
.neededPermissions(new String[]{Manifest.permission.CAMERA})
|
||||
.image(R.drawable.intro_scanner)
|
||||
.title("Permissions")
|
||||
.description("Aegis needs permission to your camera in order to function properly. This is needed to scan QR codes.")
|
||||
.build(),
|
||||
new MessageButtonBehaviour(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -52,5 +47,4 @@ public class IntroActivity extends MaterialIntroActivity {
|
|||
SharedPreferences prefs = this.getSharedPreferences("me.impy.aegis", Context.MODE_PRIVATE);
|
||||
prefs.edit().putBoolean("passedIntro", true).apply();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -369,7 +369,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
databaseFile = new DatabaseFile();
|
||||
|
||||
try {
|
||||
masterKey = new MasterKey(null);
|
||||
masterKey = MasterKey.generate();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// TODO: tell the user to stop using a weird platform
|
||||
throw new UndeclaredThrowableException(e);
|
||||
|
|
|
@ -25,6 +25,7 @@ public class CryptoUtils {
|
|||
public static final byte CRYPTO_KEY_SIZE = 32;
|
||||
public static final byte CRYPTO_NONCE_SIZE = 12;
|
||||
public static final byte CRYPTO_SALT_SIZE = 32;
|
||||
// TODO: decide on a 'secure-enough' iteration count
|
||||
public static final short CRYPTO_ITERATION_COUNT = 10000;
|
||||
public static final String CRYPTO_CIPHER_RAW = "AES/ECB/NoPadding";
|
||||
public static final String CRYPTO_CIPHER_AEAD = "AES/GCM/NoPadding";
|
||||
|
|
|
@ -16,13 +16,22 @@ import me.impy.aegis.crypto.slots.Slot;
|
|||
public class MasterKey {
|
||||
private SecretKey _key;
|
||||
|
||||
public MasterKey(SecretKey key) throws NoSuchAlgorithmException {
|
||||
public MasterKey(SecretKey key) {
|
||||
if (key == null) {
|
||||
key = CryptoUtils.generateKey();
|
||||
throw new NullPointerException();
|
||||
}
|
||||
_key = key;
|
||||
}
|
||||
|
||||
public static MasterKey generate() throws NoSuchAlgorithmException {
|
||||
return new MasterKey(CryptoUtils.generateKey());
|
||||
}
|
||||
|
||||
public void encryptSlot(Slot slot, Cipher cipher)
|
||||
throws BadPaddingException, IllegalBlockSizeException {
|
||||
slot.setKey(_key, cipher);
|
||||
}
|
||||
|
||||
public static MasterKey decryptSlot(Slot slot, Cipher cipher)
|
||||
throws BadPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException {
|
||||
return new MasterKey(slot.getKey(cipher));
|
||||
|
@ -41,8 +50,4 @@ public class MasterKey {
|
|||
Cipher cipher = CryptoUtils.createCipher(_key, Cipher.DECRYPT_MODE, params.Nonce);
|
||||
return CryptoUtils.decrypt(bytes, cipher, params);
|
||||
}
|
||||
|
||||
public void encryptSlot(Slot slot, Cipher cipher) throws BadPaddingException, IllegalBlockSizeException {
|
||||
slot.setKey(_key, cipher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package me.impy.aegis.crypto.slots;
|
||||
|
||||
public class FingerprintSlot extends RawSlot {
|
||||
|
||||
@Override
|
||||
public byte getType() {
|
||||
return TYPE_FINGERPRINT;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue