Search in sources :

Example 1 with ImporterV3

use of com.keepassdroid.database.load.ImporterV3 in project KeePassDX by Kunzisoft.

the class Kdb3 method testKeyfile.

private void testKeyfile(String dbAsset, String keyAsset, String password) throws Exception {
    Context ctx = getContext();
    File sdcard = Environment.getExternalStorageDirectory();
    String keyPath = sdcard.getAbsolutePath() + "/key";
    TestUtil.extractKey(ctx, keyAsset, keyPath);
    AssetManager am = ctx.getAssets();
    InputStream is = am.open(dbAsset, AssetManager.ACCESS_STREAMING);
    ImporterV3 importer = new ImporterV3();
    importer.openDatabase(is, password, TestUtil.getKeyFileInputStream(ctx, keyPath));
    is.close();
}
Also used : Context(android.content.Context) AssetManager(android.content.res.AssetManager) InputStream(java.io.InputStream) ImporterV3(com.keepassdroid.database.load.ImporterV3) File(java.io.File)

Example 2 with ImporterV3

use of com.keepassdroid.database.load.ImporterV3 in project KeePassDX by Kunzisoft.

the class Kdb3Twofish method testReadTwofish.

public void testReadTwofish() throws Exception {
    Context ctx = getContext();
    AssetManager am = ctx.getAssets();
    InputStream is = am.open("twofish.kdb", AssetManager.ACCESS_STREAMING);
    ImporterV3 importer = new ImporterV3();
    PwDatabaseV3 db = importer.openDatabase(is, "12345", null);
    assertTrue(db.algorithm == PwEncryptionAlgorithm.Twofish);
    is.close();
}
Also used : Context(android.content.Context) PwDatabaseV3(com.keepassdroid.database.PwDatabaseV3) AssetManager(android.content.res.AssetManager) InputStream(java.io.InputStream) ImporterV3(com.keepassdroid.database.load.ImporterV3)

Aggregations

Context (android.content.Context)2 AssetManager (android.content.res.AssetManager)2 ImporterV3 (com.keepassdroid.database.load.ImporterV3)2 InputStream (java.io.InputStream)2 PwDatabaseV3 (com.keepassdroid.database.PwDatabaseV3)1 File (java.io.File)1