diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/DisplayableFingerprint.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/DisplayableFingerprint.java deleted file mode 100644 index 2cbbfef687..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/DisplayableFingerprint.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (C) 2016 Open Whisper Systems - * - * Licensed according to the LICENSE file in this repository. - */ -package org.session.libsignal.libsignal.fingerprint; - -import org.session.libsignal.libsignal.util.ByteUtil; - -public class DisplayableFingerprint { - - private final String localFingerprintNumbers; - private final String remoteFingerprintNumbers; - - DisplayableFingerprint(byte[] localFingerprint, byte[] remoteFingerprint) - { - this.localFingerprintNumbers = getDisplayStringFor(localFingerprint); - this.remoteFingerprintNumbers = getDisplayStringFor(remoteFingerprint); - } - - public String getDisplayText() { - if (localFingerprintNumbers.compareTo(remoteFingerprintNumbers) <= 0) { - return localFingerprintNumbers + remoteFingerprintNumbers; - } else { - return remoteFingerprintNumbers + localFingerprintNumbers; - } - } - - private String getDisplayStringFor(byte[] fingerprint) { - return getEncodedChunk(fingerprint, 0) + - getEncodedChunk(fingerprint, 5) + - getEncodedChunk(fingerprint, 10) + - getEncodedChunk(fingerprint, 15) + - getEncodedChunk(fingerprint, 20) + - getEncodedChunk(fingerprint, 25); - } - - private String getEncodedChunk(byte[] hash, int offset) { - long chunk = ByteUtil.byteArray5ToLong(hash, offset) % 100000; - return String.format("%05d", chunk); - } - -} diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/Fingerprint.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/Fingerprint.java deleted file mode 100644 index 08a63f7924..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/Fingerprint.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (C) 2016 Open Whisper Systems - * - * Licensed according to the LICENSE file in this repository. - */ -package org.session.libsignal.libsignal.fingerprint; - -import org.session.libsignal.libsignal.fingerprint.DisplayableFingerprint; -import org.session.libsignal.libsignal.fingerprint.ScannableFingerprint; - -public class Fingerprint { - - private final DisplayableFingerprint displayableFingerprint; - private final ScannableFingerprint scannableFingerprint; - - public Fingerprint(DisplayableFingerprint displayableFingerprint, - ScannableFingerprint scannableFingerprint) - { - this.displayableFingerprint = displayableFingerprint; - this.scannableFingerprint = scannableFingerprint; - } - - /** - * @return A text fingerprint that can be displayed and compared remotely. - */ - public DisplayableFingerprint getDisplayableFingerprint() { - return displayableFingerprint; - } - - /** - * @return A scannable fingerprint that can be scanned anc compared locally. - */ - public ScannableFingerprint getScannableFingerprint() { - return scannableFingerprint; - } -} diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintGenerator.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintGenerator.java deleted file mode 100644 index a9bda64c9d..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintGenerator.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (C) 2016 Open Whisper Systems - * - * Licensed according to the LICENSE file in this repository. - */ -package org.session.libsignal.libsignal.fingerprint; - -import org.session.libsignal.libsignal.IdentityKey; - -import java.util.List; - -public interface FingerprintGenerator { - public Fingerprint createFor(String localStableIdentifier, IdentityKey localIdentityKey, - String remoteStableIdentifier, IdentityKey remoteIdentityKey); - - public Fingerprint createFor(String localStableIdentifier, List localIdentityKey, - String remoteStableIdentifier, List remoteIdentityKey); -} diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintIdentifierMismatchException.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintIdentifierMismatchException.java deleted file mode 100644 index ee350b6b5d..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintIdentifierMismatchException.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (C) 2016 Open Whisper Systems - * - * Licensed according to the LICENSE file in this repository. - */ -package org.session.libsignal.libsignal.fingerprint; - -public class FingerprintIdentifierMismatchException extends Exception { - - private final String localIdentifier; - private final String remoteIdentifier; - private final String scannedLocalIdentifier; - private final String scannedRemoteIdentifier; - - public FingerprintIdentifierMismatchException(String localIdentifier, String remoteIdentifier, - String scannedLocalIdentifier, String scannedRemoteIdentifier) - { - this.localIdentifier = localIdentifier; - this.remoteIdentifier = remoteIdentifier; - this.scannedLocalIdentifier = scannedLocalIdentifier; - this.scannedRemoteIdentifier = scannedRemoteIdentifier; - } - - public String getScannedRemoteIdentifier() { - return scannedRemoteIdentifier; - } - - public String getScannedLocalIdentifier() { - return scannedLocalIdentifier; - } - - public String getRemoteIdentifier() { - return remoteIdentifier; - } - - public String getLocalIdentifier() { - return localIdentifier; - } -} diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintParsingException.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintParsingException.java deleted file mode 100644 index fcd2432ee3..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintParsingException.java +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (C) 2016 Open Whisper Systems - * - * Licensed according to the LICENSE file in this repository. - */ -package org.session.libsignal.libsignal.fingerprint; - -public class FingerprintParsingException extends Exception { - - public FingerprintParsingException(Exception nested) { - super(nested); - } - -} diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintProtos.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintProtos.java deleted file mode 100644 index f2bae64837..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintProtos.java +++ /dev/null @@ -1,1277 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: FingerprintProtocol.proto - -package org.session.libsignal.libsignal.fingerprint; - -public final class FingerprintProtos { - private FingerprintProtos() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - public interface LogicalFingerprintOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional bytes content = 1; - /** - * optional bytes content = 1; - * - *
-     *  optional bytes identifier = 2;
-     * 
- */ - boolean hasContent(); - /** - * optional bytes content = 1; - * - *
-     *  optional bytes identifier = 2;
-     * 
- */ - com.google.protobuf.ByteString getContent(); - } - /** - * Protobuf type {@code textsecure.LogicalFingerprint} - */ - public static final class LogicalFingerprint extends - com.google.protobuf.GeneratedMessage - implements LogicalFingerprintOrBuilder { - // Use LogicalFingerprint.newBuilder() to construct. - private LogicalFingerprint(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private LogicalFingerprint(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final LogicalFingerprint defaultInstance; - public static LogicalFingerprint getDefaultInstance() { - return defaultInstance; - } - - public LogicalFingerprint getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private LogicalFingerprint( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - content_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_LogicalFingerprint_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_LogicalFingerprint_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.class, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public LogicalFingerprint parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new LogicalFingerprint(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional bytes content = 1; - public static final int CONTENT_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString content_; - /** - * optional bytes content = 1; - * - *
-     *  optional bytes identifier = 2;
-     * 
- */ - public boolean hasContent() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional bytes content = 1; - * - *
-     *  optional bytes identifier = 2;
-     * 
- */ - public com.google.protobuf.ByteString getContent() { - return content_; - } - - private void initFields() { - content_ = com.google.protobuf.ByteString.EMPTY; - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, content_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, content_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code textsecure.LogicalFingerprint} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_LogicalFingerprint_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_LogicalFingerprint_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.class, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder.class); - } - - // Construct using org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - content_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_LogicalFingerprint_descriptor; - } - - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint getDefaultInstanceForType() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - } - - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint build() { - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint buildPartial() { - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint result = new org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.content_ = content_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint) { - return mergeFrom((org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint other) { - if (other == org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance()) return this; - if (other.hasContent()) { - setContent(other.getContent()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional bytes content = 1; - private com.google.protobuf.ByteString content_ = com.google.protobuf.ByteString.EMPTY; - /** - * optional bytes content = 1; - * - *
-       *  optional bytes identifier = 2;
-       * 
- */ - public boolean hasContent() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional bytes content = 1; - * - *
-       *  optional bytes identifier = 2;
-       * 
- */ - public com.google.protobuf.ByteString getContent() { - return content_; - } - /** - * optional bytes content = 1; - * - *
-       *  optional bytes identifier = 2;
-       * 
- */ - public Builder setContent(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - content_ = value; - onChanged(); - return this; - } - /** - * optional bytes content = 1; - * - *
-       *  optional bytes identifier = 2;
-       * 
- */ - public Builder clearContent() { - bitField0_ = (bitField0_ & ~0x00000001); - content_ = getDefaultInstance().getContent(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.LogicalFingerprint) - } - - static { - defaultInstance = new LogicalFingerprint(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.LogicalFingerprint) - } - - public interface CombinedFingerprintsOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional uint32 version = 1; - /** - * optional uint32 version = 1; - */ - boolean hasVersion(); - /** - * optional uint32 version = 1; - */ - int getVersion(); - - // optional .textsecure.LogicalFingerprint localFingerprint = 2; - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - boolean hasLocalFingerprint(); - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint getLocalFingerprint(); - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder getLocalFingerprintOrBuilder(); - - // optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - boolean hasRemoteFingerprint(); - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint getRemoteFingerprint(); - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder getRemoteFingerprintOrBuilder(); - } - /** - * Protobuf type {@code textsecure.CombinedFingerprints} - */ - public static final class CombinedFingerprints extends - com.google.protobuf.GeneratedMessage - implements CombinedFingerprintsOrBuilder { - // Use CombinedFingerprints.newBuilder() to construct. - private CombinedFingerprints(com.google.protobuf.GeneratedMessage.Builder builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private CombinedFingerprints(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final CombinedFingerprints defaultInstance; - public static CombinedFingerprints getDefaultInstance() { - return defaultInstance; - } - - public CombinedFingerprints getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private CombinedFingerprints( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 8: { - bitField0_ |= 0x00000001; - version_ = input.readUInt32(); - break; - } - case 18: { - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder subBuilder = null; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - subBuilder = localFingerprint_.toBuilder(); - } - localFingerprint_ = input.readMessage(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(localFingerprint_); - localFingerprint_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000002; - break; - } - case 26: { - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder subBuilder = null; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - subBuilder = remoteFingerprint_.toBuilder(); - } - remoteFingerprint_ = input.readMessage(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(remoteFingerprint_); - remoteFingerprint_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000004; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_CombinedFingerprints_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_CombinedFingerprints_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints.class, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints.Builder.class); - } - - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public CombinedFingerprints parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new CombinedFingerprints(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional uint32 version = 1; - public static final int VERSION_FIELD_NUMBER = 1; - private int version_; - /** - * optional uint32 version = 1; - */ - public boolean hasVersion() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint32 version = 1; - */ - public int getVersion() { - return version_; - } - - // optional .textsecure.LogicalFingerprint localFingerprint = 2; - public static final int LOCALFINGERPRINT_FIELD_NUMBER = 2; - private org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint localFingerprint_; - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public boolean hasLocalFingerprint() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint getLocalFingerprint() { - return localFingerprint_; - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder getLocalFingerprintOrBuilder() { - return localFingerprint_; - } - - // optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - public static final int REMOTEFINGERPRINT_FIELD_NUMBER = 3; - private org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint remoteFingerprint_; - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public boolean hasRemoteFingerprint() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint getRemoteFingerprint() { - return remoteFingerprint_; - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder getRemoteFingerprintOrBuilder() { - return remoteFingerprint_; - } - - private void initFields() { - version_ = 0; - localFingerprint_ = org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - remoteFingerprint_ = org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt32(1, version_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, localFingerprint_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeMessage(3, remoteFingerprint_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, version_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, localFingerprint_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, remoteFingerprint_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * Protobuf type {@code textsecure.CombinedFingerprints} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder - implements org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprintsOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_CombinedFingerprints_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_CombinedFingerprints_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints.class, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints.Builder.class); - } - - // Construct using org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessage.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getLocalFingerprintFieldBuilder(); - getRemoteFingerprintFieldBuilder(); - } - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - version_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - if (localFingerprintBuilder_ == null) { - localFingerprint_ = org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - } else { - localFingerprintBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - if (remoteFingerprintBuilder_ == null) { - remoteFingerprint_ = org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - } else { - remoteFingerprintBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.internal_static_textsecure_CombinedFingerprints_descriptor; - } - - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints getDefaultInstanceForType() { - return org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints.getDefaultInstance(); - } - - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints build() { - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints buildPartial() { - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints result = new org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.version_ = version_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - if (localFingerprintBuilder_ == null) { - result.localFingerprint_ = localFingerprint_; - } else { - result.localFingerprint_ = localFingerprintBuilder_.build(); - } - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - if (remoteFingerprintBuilder_ == null) { - result.remoteFingerprint_ = remoteFingerprint_; - } else { - result.remoteFingerprint_ = remoteFingerprintBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints) { - return mergeFrom((org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints other) { - if (other == org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints.getDefaultInstance()) return this; - if (other.hasVersion()) { - setVersion(other.getVersion()); - } - if (other.hasLocalFingerprint()) { - mergeLocalFingerprint(other.getLocalFingerprint()); - } - if (other.hasRemoteFingerprint()) { - mergeRemoteFingerprint(other.getRemoteFingerprint()); - } - this.mergeUnknownFields(other.getUnknownFields()); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional uint32 version = 1; - private int version_ ; - /** - * optional uint32 version = 1; - */ - public boolean hasVersion() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * optional uint32 version = 1; - */ - public int getVersion() { - return version_; - } - /** - * optional uint32 version = 1; - */ - public Builder setVersion(int value) { - bitField0_ |= 0x00000001; - version_ = value; - onChanged(); - return this; - } - /** - * optional uint32 version = 1; - */ - public Builder clearVersion() { - bitField0_ = (bitField0_ & ~0x00000001); - version_ = 0; - onChanged(); - return this; - } - - // optional .textsecure.LogicalFingerprint localFingerprint = 2; - private org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint localFingerprint_ = org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder> localFingerprintBuilder_; - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public boolean hasLocalFingerprint() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint getLocalFingerprint() { - if (localFingerprintBuilder_ == null) { - return localFingerprint_; - } else { - return localFingerprintBuilder_.getMessage(); - } - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public Builder setLocalFingerprint(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint value) { - if (localFingerprintBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - localFingerprint_ = value; - onChanged(); - } else { - localFingerprintBuilder_.setMessage(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public Builder setLocalFingerprint( - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder builderForValue) { - if (localFingerprintBuilder_ == null) { - localFingerprint_ = builderForValue.build(); - onChanged(); - } else { - localFingerprintBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public Builder mergeLocalFingerprint(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint value) { - if (localFingerprintBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002) && - localFingerprint_ != org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance()) { - localFingerprint_ = - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.newBuilder(localFingerprint_).mergeFrom(value).buildPartial(); - } else { - localFingerprint_ = value; - } - onChanged(); - } else { - localFingerprintBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000002; - return this; - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public Builder clearLocalFingerprint() { - if (localFingerprintBuilder_ == null) { - localFingerprint_ = org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - onChanged(); - } else { - localFingerprintBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder getLocalFingerprintBuilder() { - bitField0_ |= 0x00000002; - onChanged(); - return getLocalFingerprintFieldBuilder().getBuilder(); - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder getLocalFingerprintOrBuilder() { - if (localFingerprintBuilder_ != null) { - return localFingerprintBuilder_.getMessageOrBuilder(); - } else { - return localFingerprint_; - } - } - /** - * optional .textsecure.LogicalFingerprint localFingerprint = 2; - */ - private com.google.protobuf.SingleFieldBuilder< - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder> - getLocalFingerprintFieldBuilder() { - if (localFingerprintBuilder_ == null) { - localFingerprintBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder>( - localFingerprint_, - getParentForChildren(), - isClean()); - localFingerprint_ = null; - } - return localFingerprintBuilder_; - } - - // optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - private org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint remoteFingerprint_ = org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - private com.google.protobuf.SingleFieldBuilder< - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder> remoteFingerprintBuilder_; - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public boolean hasRemoteFingerprint() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint getRemoteFingerprint() { - if (remoteFingerprintBuilder_ == null) { - return remoteFingerprint_; - } else { - return remoteFingerprintBuilder_.getMessage(); - } - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public Builder setRemoteFingerprint(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint value) { - if (remoteFingerprintBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - remoteFingerprint_ = value; - onChanged(); - } else { - remoteFingerprintBuilder_.setMessage(value); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public Builder setRemoteFingerprint( - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder builderForValue) { - if (remoteFingerprintBuilder_ == null) { - remoteFingerprint_ = builderForValue.build(); - onChanged(); - } else { - remoteFingerprintBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public Builder mergeRemoteFingerprint(org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint value) { - if (remoteFingerprintBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004) && - remoteFingerprint_ != org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance()) { - remoteFingerprint_ = - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.newBuilder(remoteFingerprint_).mergeFrom(value).buildPartial(); - } else { - remoteFingerprint_ = value; - } - onChanged(); - } else { - remoteFingerprintBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000004; - return this; - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public Builder clearRemoteFingerprint() { - if (remoteFingerprintBuilder_ == null) { - remoteFingerprint_ = org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.getDefaultInstance(); - onChanged(); - } else { - remoteFingerprintBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder getRemoteFingerprintBuilder() { - bitField0_ |= 0x00000004; - onChanged(); - return getRemoteFingerprintFieldBuilder().getBuilder(); - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - public org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder getRemoteFingerprintOrBuilder() { - if (remoteFingerprintBuilder_ != null) { - return remoteFingerprintBuilder_.getMessageOrBuilder(); - } else { - return remoteFingerprint_; - } - } - /** - * optional .textsecure.LogicalFingerprint remoteFingerprint = 3; - */ - private com.google.protobuf.SingleFieldBuilder< - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder> - getRemoteFingerprintFieldBuilder() { - if (remoteFingerprintBuilder_ == null) { - remoteFingerprintBuilder_ = new com.google.protobuf.SingleFieldBuilder< - org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint.Builder, org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprintOrBuilder>( - remoteFingerprint_, - getParentForChildren(), - isClean()); - remoteFingerprint_ = null; - } - return remoteFingerprintBuilder_; - } - - // @@protoc_insertion_point(builder_scope:textsecure.CombinedFingerprints) - } - - static { - defaultInstance = new CombinedFingerprints(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.CombinedFingerprints) - } - - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_LogicalFingerprint_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_LogicalFingerprint_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_CombinedFingerprints_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_CombinedFingerprints_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\031FingerprintProtocol.proto\022\ntextsecure\"" + - "%\n\022LogicalFingerprint\022\017\n\007content\030\001 \001(\014\"\234" + - "\001\n\024CombinedFingerprints\022\017\n\007version\030\001 \001(\r" + - "\0228\n\020localFingerprint\030\002 \001(\0132\036.textsecure." + - "LogicalFingerprint\0229\n\021remoteFingerprint\030" + - "\003 \001(\0132\036.textsecure.LogicalFingerprintB@\n" + - "+org.session.libsignal.libsignal.fingerp" + - "rintB\021FingerprintProtos" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - internal_static_textsecure_LogicalFingerprint_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_textsecure_LogicalFingerprint_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_LogicalFingerprint_descriptor, - new java.lang.String[] { "Content", }); - internal_static_textsecure_CombinedFingerprints_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_textsecure_CombinedFingerprints_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_CombinedFingerprints_descriptor, - new java.lang.String[] { "Version", "LocalFingerprint", "RemoteFingerprint", }); - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintVersionMismatchException.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintVersionMismatchException.java deleted file mode 100644 index efb2fcea03..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/FingerprintVersionMismatchException.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (C) 2016 Open Whisper Systems - * - * Licensed according to the LICENSE file in this repository. - */ -package org.session.libsignal.libsignal.fingerprint; - -public class FingerprintVersionMismatchException extends Exception { - - private final int theirVersion; - private final int ourVersion; - - public FingerprintVersionMismatchException(int theirVersion, int ourVersion) { - super(); - this.theirVersion = theirVersion; - this.ourVersion = ourVersion; - } - - public int getTheirVersion() { - return theirVersion; - } - - public int getOurVersion() { - return ourVersion; - } -} diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/NumericFingerprintGenerator.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/NumericFingerprintGenerator.java deleted file mode 100644 index ee7c219861..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/NumericFingerprintGenerator.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright (C) 2016 Open Whisper Systems - * - * Licensed according to the LICENSE file in this repository. - */ -package org.session.libsignal.libsignal.fingerprint; - -import org.session.libsignal.libsignal.IdentityKey; -import org.session.libsignal.libsignal.util.ByteUtil; -import org.session.libsignal.libsignal.util.IdentityKeyComparator; - -import java.io.ByteArrayOutputStream; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -public class NumericFingerprintGenerator implements FingerprintGenerator { - - private static final int FINGERPRINT_VERSION = 0; - - private final int iterations; - - /** - * Construct a fingerprint generator for 60 digit numerics. - * - * @param iterations The number of internal iterations to perform in the process of - * generating a fingerprint. This needs to be constant, and synchronized - * across all clients. - * - * The higher the iteration count, the higher the security level: - * - * - 1024 ~ 109.7 bits - * - 1400 > 110 bits - * - 5200 > 112 bits - */ - public NumericFingerprintGenerator(int iterations) { - this.iterations = iterations; - } - - /** - * Generate a scannable and displayble fingerprint. - * - * @param localStableIdentifier The client's "stable" identifier. - * @param localIdentityKey The client's identity key. - * @param remoteStableIdentifier The remote party's "stable" identifier. - * @param remoteIdentityKey The remote party's identity key. - * @return A unique fingerprint for this conversation. - */ - @Override - public Fingerprint createFor(String localStableIdentifier, final IdentityKey localIdentityKey, - String remoteStableIdentifier, final IdentityKey remoteIdentityKey) - { - return createFor(localStableIdentifier, - new LinkedList() {{ - add(localIdentityKey); - }}, - remoteStableIdentifier, - new LinkedList() {{ - add(remoteIdentityKey); - }}); - } - - /** - * Generate a scannable and displayble fingerprint for logical identities that have multiple - * physical keys. - * - * Do not trust the output of this unless you've been through the device consistency process - * for the provided localIdentityKeys. - * - * @param localStableIdentifier The client's "stable" identifier. - * @param localIdentityKeys The client's collection of physical identity keys. - * @param remoteStableIdentifier The remote party's "stable" identifier. - * @param remoteIdentityKeys The remote party's collection of physical identity key. - * @return A unique fingerprint for this conversation. - */ - public Fingerprint createFor(String localStableIdentifier, List localIdentityKeys, - String remoteStableIdentifier, List remoteIdentityKeys) - { - byte[] localFingerprint = getFingerprint(iterations, localStableIdentifier, localIdentityKeys); - byte[] remoteFingerprint = getFingerprint(iterations, remoteStableIdentifier, remoteIdentityKeys); - - DisplayableFingerprint displayableFingerprint = new DisplayableFingerprint(localFingerprint, - remoteFingerprint); - - ScannableFingerprint scannableFingerprint = new ScannableFingerprint(localFingerprint, - remoteFingerprint); - - return new Fingerprint(displayableFingerprint, scannableFingerprint); - } - - private byte[] getFingerprint(int iterations, String stableIdentifier, List unsortedIdentityKeys) { - try { - MessageDigest digest = MessageDigest.getInstance("SHA-512"); - byte[] publicKey = getLogicalKeyBytes(unsortedIdentityKeys); - byte[] hash = ByteUtil.combine(ByteUtil.shortToByteArray(FINGERPRINT_VERSION), - publicKey, stableIdentifier.getBytes()); - - for (int i=0;i identityKeys) { - ArrayList sortedIdentityKeys = new ArrayList(identityKeys); - Collections.sort(sortedIdentityKeys, new IdentityKeyComparator()); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - for (IdentityKey identityKey : sortedIdentityKeys) { - byte[] publicKeyBytes = identityKey.getPublicKey().serialize(); - baos.write(publicKeyBytes, 0, publicKeyBytes.length); - } - - return baos.toByteArray(); - } - - -} diff --git a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/ScannableFingerprint.java b/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/ScannableFingerprint.java deleted file mode 100644 index 33b25b71ac..0000000000 --- a/libsignal/src/main/java/org/session/libsignal/libsignal/fingerprint/ScannableFingerprint.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (C) 2016 Open Whisper Systems - * - * Licensed according to the LICENSE file in this repository. - */ -package org.session.libsignal.libsignal.fingerprint; - -import com.google.protobuf.ByteString; -import com.google.protobuf.InvalidProtocolBufferException; - -import org.session.libsignal.libsignal.fingerprint.FingerprintParsingException; -import org.session.libsignal.libsignal.fingerprint.FingerprintProtos.CombinedFingerprints; -import org.session.libsignal.libsignal.fingerprint.FingerprintProtos.LogicalFingerprint; -import org.session.libsignal.libsignal.fingerprint.FingerprintVersionMismatchException; -import org.session.libsignal.libsignal.util.ByteUtil; - -import java.security.MessageDigest; - -public class ScannableFingerprint { - - private static final int VERSION = 1; - - private final CombinedFingerprints fingerprints; - - ScannableFingerprint(byte[] localFingerprintData, byte[] remoteFingerprintData) - { - LogicalFingerprint localFingerprint = LogicalFingerprint.newBuilder() - .setContent(ByteString.copyFrom(ByteUtil.trim(localFingerprintData, 32))) - .build(); - - LogicalFingerprint remoteFingerprint = LogicalFingerprint.newBuilder() - .setContent(ByteString.copyFrom(ByteUtil.trim(remoteFingerprintData, 32))) - .build(); - - this.fingerprints = CombinedFingerprints.newBuilder() - .setVersion(VERSION) - .setLocalFingerprint(localFingerprint) - .setRemoteFingerprint(remoteFingerprint) - .build(); - } - - /** - * @return A byte string to be displayed in a QR code. - */ - public byte[] getSerialized() { - return fingerprints.toByteArray(); - } - - /** - * Compare a scanned QR code with what we expect. - * - * @param scannedFingerprintData The scanned data - * @return True if matching, otehrwise false. - * @throws FingerprintVersionMismatchException if the scanned fingerprint is the wrong version. - */ - public boolean compareTo(byte[] scannedFingerprintData) - throws FingerprintVersionMismatchException, - FingerprintParsingException - { - try { - CombinedFingerprints scanned = CombinedFingerprints.parseFrom(scannedFingerprintData); - - if (!scanned.hasRemoteFingerprint() || !scanned.hasLocalFingerprint() || - !scanned.hasVersion() || scanned.getVersion() != VERSION) - { - throw new FingerprintVersionMismatchException(scanned.getVersion(), VERSION); - } - - return MessageDigest.isEqual(fingerprints.getLocalFingerprint().getContent().toByteArray(), scanned.getRemoteFingerprint().getContent().toByteArray()) && - MessageDigest.isEqual(fingerprints.getRemoteFingerprint().getContent().toByteArray(), scanned.getLocalFingerprint().getContent().toByteArray()); - } catch (InvalidProtocolBufferException e) { - throw new FingerprintParsingException(e); - } - } -}