aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-05-09 14:06:23 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-05-27 13:53:01 +0200
commitce1c3d1a1ee7f8d9b482419801aee494928741d2 (patch)
tree42be4216384c5ba167f4f8eb1b9d93d5731539da /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java
parente7fa124108e72b0eaaa1319467d666d876278467 (diff)
downloadopen-keychain-ce1c3d1a1ee7f8d9b482419801aee494928741d2.tar.gz
open-keychain-ce1c3d1a1ee7f8d9b482419801aee494928741d2.tar.bz2
open-keychain-ce1c3d1a1ee7f8d9b482419801aee494928741d2.zip
rename SaveKeyringParcel to OldSaveKeyringParcel
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java123
1 files changed, 0 insertions, 123 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java
deleted file mode 100644
index 60fdf895d..000000000
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2014 Ash Hughes <ashes-iontach@hotmail.com>
- *
- * 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, either version 3 of the License, or
- * (at your option) any later version.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-package org.sufficientlysecure.keychain.service;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import org.sufficientlysecure.keychain.Constants;
-import org.sufficientlysecure.keychain.pgp.PgpConversionHelper;
-import org.sufficientlysecure.keychain.pgp.UncachedSecretKey;
-import org.sufficientlysecure.keychain.util.IterableIterator;
-import org.sufficientlysecure.keychain.util.Log;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Calendar;
-
-public class SaveKeyringParcel implements Parcelable {
-
- public ArrayList<String> userIds;
- public ArrayList<String> originalIDs;
- public ArrayList<String> deletedIDs;
- public boolean[] newIDs;
- public boolean primaryIDChanged;
- public boolean[] moddedKeys;
- public ArrayList<UncachedSecretKey> deletedKeys;
- public ArrayList<Calendar> keysExpiryDates;
- public ArrayList<Integer> keysUsages;
- public String newPassphrase;
- public String oldPassphrase;
- public boolean[] newKeys;
- public ArrayList<UncachedSecretKey> keys;
- public String originalPrimaryID;
-
- public SaveKeyringParcel() {}
-
- private SaveKeyringParcel(Parcel source) {
- userIds = (ArrayList<String>) source.readSerializable();
- originalIDs = (ArrayList<String>) source.readSerializable();
- deletedIDs = (ArrayList<String>) source.readSerializable();
- newIDs = source.createBooleanArray();
- primaryIDChanged = source.readByte() != 0;
- moddedKeys = source.createBooleanArray();
- byte[] tmp = source.createByteArray();
- if (tmp == null) {
- deletedKeys = null;
- } else {
- deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(tmp);
- }
- keysExpiryDates = (ArrayList<Calendar>) source.readSerializable();
- keysUsages = source.readArrayList(Integer.class.getClassLoader());
- newPassphrase = source.readString();
- oldPassphrase = source.readString();
- newKeys = source.createBooleanArray();
- keys = PgpConversionHelper.BytesToPGPSecretKeyList(source.createByteArray());
- originalPrimaryID = source.readString();
- }
-
- @Override
- public void writeToParcel(Parcel destination, int flags) {
- destination.writeSerializable(userIds); //might not be the best method to store.
- destination.writeSerializable(originalIDs);
- destination.writeSerializable(deletedIDs);
- destination.writeBooleanArray(newIDs);
- destination.writeByte((byte) (primaryIDChanged ? 1 : 0));
- destination.writeBooleanArray(moddedKeys);
- destination.writeByteArray(encodeArrayList(deletedKeys));
- destination.writeSerializable(keysExpiryDates);
- destination.writeList(keysUsages);
- destination.writeString(newPassphrase);
- destination.writeString(oldPassphrase);
- destination.writeBooleanArray(newKeys);
- destination.writeByteArray(encodeArrayList(keys));
- destination.writeString(originalPrimaryID);
- }
-
- public static final Creator<SaveKeyringParcel> CREATOR = new Creator<SaveKeyringParcel>() {
- public SaveKeyringParcel createFromParcel(final Parcel source) {
- return new SaveKeyringParcel(source);
- }
-
- public SaveKeyringParcel[] newArray(final int size) {
- return new SaveKeyringParcel[size];
- }
- };
-
- private static byte[] encodeArrayList(ArrayList<UncachedSecretKey> list) {
- if(list.isEmpty()) {
- return null;
- }
-
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- for(UncachedSecretKey key : new IterableIterator<UncachedSecretKey>(list.iterator())) {
- try {
- key.encodeSecretKey(os);
- } catch (IOException e) {
- Log.e(Constants.TAG, "Error while converting ArrayList<UncachedSecretKey> to byte[]!", e);
- }
- }
- return os.toByteArray();
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-}