That fuck shit the fascists are using
1/**
2 * Copyright (C) 2014 Open Whisper Systems
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17package org.tm.archive.crypto;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22import androidx.annotation.Nullable;
23
24import org.tm.archive.util.ParcelUtil;
25import org.signal.libsignal.protocol.IdentityKey;
26import org.signal.libsignal.protocol.InvalidKeyException;
27
28public class IdentityKeyParcelable implements Parcelable {
29
30 public static final Parcelable.Creator<IdentityKeyParcelable> CREATOR = new Parcelable.Creator<IdentityKeyParcelable>() {
31 public IdentityKeyParcelable createFromParcel(Parcel in) {
32 try {
33 return new IdentityKeyParcelable(in);
34 } catch (InvalidKeyException e) {
35 throw new AssertionError(e);
36 }
37 }
38
39 public IdentityKeyParcelable[] newArray(int size) {
40 return new IdentityKeyParcelable[size];
41 }
42 };
43
44 private final IdentityKey identityKey;
45
46 public IdentityKeyParcelable(@Nullable IdentityKey identityKey) {
47 this.identityKey = identityKey;
48 }
49
50 public IdentityKeyParcelable(Parcel in) throws InvalidKeyException {
51 byte[] serialized = ParcelUtil.readByteArray(in);
52
53 this.identityKey = serialized != null ? new IdentityKey(serialized, 0) : null;
54 }
55
56 public @Nullable IdentityKey get() {
57 return identityKey;
58 }
59
60 @Override
61 public int describeContents() {
62 return 0;
63 }
64
65 @Override
66 public void writeToParcel(Parcel dest, int flags) {
67 ParcelUtil.writeByteArray(dest, identityKey != null ? identityKey.serialize() : null);
68 }
69}