mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 08:12:28 -08:00
Begin re-organization to support kdbx databases.
This commit is contained in:
1 parent
4b105f75ca
commit
a685af3bae
55 files changed
+482
-395
No files matched your search
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
KeePass for J2ME
|
||||
|
||||
Copyright 2007 Naomaru Itoi <[email protected]>
|
||||
|
||||
This file was derived from
|
||||
|
||||
Java clone of KeePass - A KeePass file viewer for Java
|
||||
Copyright 2006 Bill Zwicky <[email protected]>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package com.keepassdroid.database;
|
||||
|
||||
import com.keepassdroid.utils.Types;
|
||||
|
||||
public class PwDbHeaderV3 {
|
||||
|
||||
// DB sig from KeePass 1.03
|
||||
public static final int PWM_DBSIG_1 = 0x9AA2D903;
|
||||
// DB sig from KeePass 1.03
|
||||
public static final int PWM_DBSIG_2 = 0xB54BFB65;
|
||||
// DB sig from KeePass 1.03
|
||||
public static final int PWM_DBVER_DW = 0x00030002;
|
||||
|
||||
public static final int PWM_FLAG_SHA2 = 1;
|
||||
public static final int PWM_FLAG_RIJNDAEL = 2;
|
||||
public static final int PWM_FLAG_ARCFOUR = 4;
|
||||
public static final int PWM_FLAG_TWOFISH = 8;
|
||||
|
||||
public static final int ALGO_AES = 0;
|
||||
public static final int ALGO_TWOFISH = 1;
|
||||
|
||||
/**
|
||||
* Parse given buf, as read from file.
|
||||
* @param buf
|
||||
*/
|
||||
public PwDbHeaderV3( byte buf[], int offset ) {
|
||||
signature1 = Types.readInt( buf, offset + 0 );
|
||||
signature2 = Types.readInt( buf, offset + 4 );
|
||||
flags = Types.readInt( buf, offset + 8 );
|
||||
version = Types.readInt( buf, offset + 12 );
|
||||
|
||||
System.arraycopy( buf, offset + 16, masterSeed, 0, 16 );
|
||||
System.arraycopy( buf, offset + 32, encryptionIV, 0, 16 );
|
||||
|
||||
numGroups = Types.readInt( buf, offset + 48 );
|
||||
numEntries = Types.readInt( buf, offset + 52 );
|
||||
|
||||
System.arraycopy( buf, offset + 56, contentsHash, 0, 32 );
|
||||
|
||||
System.arraycopy( buf, offset + 88, masterSeed2, 0, 32 );
|
||||
numKeyEncRounds = Types.readInt( buf, offset + 120 );
|
||||
}
|
||||
|
||||
public PwDbHeaderV3() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Size of byte buffer needed to hold this struct. */
|
||||
public static final int BUF_SIZE = 124;
|
||||
|
||||
|
||||
|
||||
public int signature1; // = PWM_DBSIG_1
|
||||
public int signature2; // = PWM_DBSIG_2
|
||||
public int flags;
|
||||
public int version;
|
||||
|
||||
/** Seed that gets hashed with the userkey to form the final key */
|
||||
public byte masterSeed[] = new byte[16];
|
||||
/** IV used for content encryption */
|
||||
public byte encryptionIV[] = new byte[16];
|
||||
|
||||
/** Number of groups in the database */
|
||||
public int numGroups;
|
||||
/** Number of entries in the database */
|
||||
public int numEntries;
|
||||
|
||||
/** SHA-256 hash of the database, used for integrity check */
|
||||
public byte contentsHash[] = new byte[32];
|
||||
|
||||
/** Used for the dwKeyEncRounds AES transformations */
|
||||
public byte masterSeed2[] = new byte[32];
|
||||
public int numKeyEncRounds;
|
||||
}
|
||||
Reference in new issue
Block a user