diff options
Diffstat (limited to 'src/main/java/org/whispersystems/libaxolotl/protocol')
7 files changed, 0 insertions, 4216 deletions
diff --git a/src/main/java/org/whispersystems/libaxolotl/protocol/CiphertextMessage.java b/src/main/java/org/whispersystems/libaxolotl/protocol/CiphertextMessage.java deleted file mode 100644 index cf4be756..00000000 --- a/src/main/java/org/whispersystems/libaxolotl/protocol/CiphertextMessage.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (C) 2014 Open Whisper Systems - * - * 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.whispersystems.libaxolotl.protocol; - -public interface CiphertextMessage { - - public static final int UNSUPPORTED_VERSION = 1; - public static final int CURRENT_VERSION = 3; - - public static final int WHISPER_TYPE = 2; - public static final int PREKEY_TYPE = 3; - public static final int SENDERKEY_TYPE = 4; - public static final int SENDERKEY_DISTRIBUTION_TYPE = 5; - - // This should be the worst case (worse than V2). So not always accurate, but good enough for padding. - public static final int ENCRYPTED_MESSAGE_OVERHEAD = 53; - - public byte[] serialize(); - public int getType(); - -}
\ No newline at end of file diff --git a/src/main/java/org/whispersystems/libaxolotl/protocol/KeyExchangeMessage.java b/src/main/java/org/whispersystems/libaxolotl/protocol/KeyExchangeMessage.java deleted file mode 100644 index bec9208c..00000000 --- a/src/main/java/org/whispersystems/libaxolotl/protocol/KeyExchangeMessage.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.whispersystems.libaxolotl.protocol; - - -import com.google.protobuf.ByteString; - -import org.whispersystems.libaxolotl.IdentityKey; -import org.whispersystems.libaxolotl.InvalidKeyException; -import org.whispersystems.libaxolotl.InvalidMessageException; -import org.whispersystems.libaxolotl.InvalidVersionException; -import org.whispersystems.libaxolotl.LegacyMessageException; -import org.whispersystems.libaxolotl.ecc.Curve; -import org.whispersystems.libaxolotl.ecc.ECPublicKey; -import org.whispersystems.libaxolotl.util.ByteUtil; - -import java.io.IOException; - -import static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.Builder; - -public class KeyExchangeMessage { - - public static final int INITIATE_FLAG = 0x01; - public static final int RESPONSE_FLAG = 0X02; - public static final int SIMULTAENOUS_INITIATE_FLAG = 0x04; - - private final int version; - private final int supportedVersion; - private final int sequence; - private final int flags; - - private final ECPublicKey baseKey; - private final byte[] baseKeySignature; - private final ECPublicKey ratchetKey; - private final IdentityKey identityKey; - private final byte[] serialized; - - public KeyExchangeMessage(int messageVersion, int sequence, int flags, - ECPublicKey baseKey, byte[] baseKeySignature, - ECPublicKey ratchetKey, - IdentityKey identityKey) - { - this.supportedVersion = CiphertextMessage.CURRENT_VERSION; - this.version = messageVersion; - this.sequence = sequence; - this.flags = flags; - this.baseKey = baseKey; - this.baseKeySignature = baseKeySignature; - this.ratchetKey = ratchetKey; - this.identityKey = identityKey; - - byte[] version = {ByteUtil.intsToByteHighAndLow(this.version, this.supportedVersion)}; - Builder builder = WhisperProtos.KeyExchangeMessage - .newBuilder() - .setId((sequence << 5) | flags) - .setBaseKey(ByteString.copyFrom(baseKey.serialize())) - .setRatchetKey(ByteString.copyFrom(ratchetKey.serialize())) - .setIdentityKey(ByteString.copyFrom(identityKey.serialize())); - - if (messageVersion >= 3) { - builder.setBaseKeySignature(ByteString.copyFrom(baseKeySignature)); - } - - this.serialized = ByteUtil.combine(version, builder.build().toByteArray()); - } - - public KeyExchangeMessage(byte[] serialized) - throws InvalidMessageException, InvalidVersionException, LegacyMessageException - { - try { - byte[][] parts = ByteUtil.split(serialized, 1, serialized.length - 1); - this.version = ByteUtil.highBitsToInt(parts[0][0]); - this.supportedVersion = ByteUtil.lowBitsToInt(parts[0][0]); - - if (this.version <= CiphertextMessage.UNSUPPORTED_VERSION) { - throw new LegacyMessageException("Unsupported legacy version: " + this.version); - } - - if (this.version > CiphertextMessage.CURRENT_VERSION) { - throw new InvalidVersionException("Unknown version: " + this.version); - } - - WhisperProtos.KeyExchangeMessage message = WhisperProtos.KeyExchangeMessage.parseFrom(parts[1]); - - if (!message.hasId() || !message.hasBaseKey() || - !message.hasRatchetKey() || !message.hasIdentityKey() || - (this.version >=3 && !message.hasBaseKeySignature())) - { - throw new InvalidMessageException("Some required fields missing!"); - } - - this.sequence = message.getId() >> 5; - this.flags = message.getId() & 0x1f; - this.serialized = serialized; - this.baseKey = Curve.decodePoint(message.getBaseKey().toByteArray(), 0); - this.baseKeySignature = message.getBaseKeySignature().toByteArray(); - this.ratchetKey = Curve.decodePoint(message.getRatchetKey().toByteArray(), 0); - this.identityKey = new IdentityKey(message.getIdentityKey().toByteArray(), 0); - } catch (InvalidKeyException | IOException e) { - throw new InvalidMessageException(e); - } - } - - public int getVersion() { - return version; - } - - public ECPublicKey getBaseKey() { - return baseKey; - } - - public byte[] getBaseKeySignature() { - return baseKeySignature; - } - - public ECPublicKey getRatchetKey() { - return ratchetKey; - } - - public IdentityKey getIdentityKey() { - return identityKey; - } - - public boolean hasIdentityKey() { - return true; - } - - public int getMaxVersion() { - return supportedVersion; - } - - public boolean isResponse() { - return ((flags & RESPONSE_FLAG) != 0); - } - - public boolean isInitiate() { - return (flags & INITIATE_FLAG) != 0; - } - - public boolean isResponseForSimultaneousInitiate() { - return (flags & SIMULTAENOUS_INITIATE_FLAG) != 0; - } - - public int getFlags() { - return flags; - } - - public int getSequence() { - return sequence; - } - - public byte[] serialize() { - return serialized; - } -} diff --git a/src/main/java/org/whispersystems/libaxolotl/protocol/PreKeyWhisperMessage.java b/src/main/java/org/whispersystems/libaxolotl/protocol/PreKeyWhisperMessage.java deleted file mode 100644 index fff6d02a..00000000 --- a/src/main/java/org/whispersystems/libaxolotl/protocol/PreKeyWhisperMessage.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Copyright (C) 2014 Open Whisper Systems - * - * 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.whispersystems.libaxolotl.protocol; - -import com.google.protobuf.ByteString; -import com.google.protobuf.InvalidProtocolBufferException; - -import org.whispersystems.libaxolotl.IdentityKey; -import org.whispersystems.libaxolotl.InvalidKeyException; -import org.whispersystems.libaxolotl.InvalidMessageException; -import org.whispersystems.libaxolotl.InvalidVersionException; -import org.whispersystems.libaxolotl.LegacyMessageException; -import org.whispersystems.libaxolotl.ecc.Curve; -import org.whispersystems.libaxolotl.ecc.ECPublicKey; -import org.whispersystems.libaxolotl.util.ByteUtil; -import org.whispersystems.libaxolotl.util.guava.Optional; - - -public class PreKeyWhisperMessage implements CiphertextMessage { - - private final int version; - private final int registrationId; - private final Optional<Integer> preKeyId; - private final int signedPreKeyId; - private final ECPublicKey baseKey; - private final IdentityKey identityKey; - private final WhisperMessage message; - private final byte[] serialized; - - public PreKeyWhisperMessage(byte[] serialized) - throws InvalidMessageException, InvalidVersionException - { - try { - this.version = ByteUtil.highBitsToInt(serialized[0]); - - if (this.version > CiphertextMessage.CURRENT_VERSION) { - throw new InvalidVersionException("Unknown version: " + this.version); - } - - WhisperProtos.PreKeyWhisperMessage preKeyWhisperMessage - = WhisperProtos.PreKeyWhisperMessage.parseFrom(ByteString.copyFrom(serialized, 1, - serialized.length-1)); - - if ((version == 2 && !preKeyWhisperMessage.hasPreKeyId()) || - (version == 3 && !preKeyWhisperMessage.hasSignedPreKeyId()) || - !preKeyWhisperMessage.hasBaseKey() || - !preKeyWhisperMessage.hasIdentityKey() || - !preKeyWhisperMessage.hasMessage()) - { - throw new InvalidMessageException("Incomplete message."); - } - - this.serialized = serialized; - this.registrationId = preKeyWhisperMessage.getRegistrationId(); - this.preKeyId = preKeyWhisperMessage.hasPreKeyId() ? Optional.of(preKeyWhisperMessage.getPreKeyId()) : Optional.<Integer>absent(); - this.signedPreKeyId = preKeyWhisperMessage.hasSignedPreKeyId() ? preKeyWhisperMessage.getSignedPreKeyId() : -1; - this.baseKey = Curve.decodePoint(preKeyWhisperMessage.getBaseKey().toByteArray(), 0); - this.identityKey = new IdentityKey(Curve.decodePoint(preKeyWhisperMessage.getIdentityKey().toByteArray(), 0)); - this.message = new WhisperMessage(preKeyWhisperMessage.getMessage().toByteArray()); - } catch (InvalidProtocolBufferException | InvalidKeyException | LegacyMessageException e) { - throw new InvalidMessageException(e); - } - } - - public PreKeyWhisperMessage(int messageVersion, int registrationId, Optional<Integer> preKeyId, - int signedPreKeyId, ECPublicKey baseKey, IdentityKey identityKey, - WhisperMessage message) - { - this.version = messageVersion; - this.registrationId = registrationId; - this.preKeyId = preKeyId; - this.signedPreKeyId = signedPreKeyId; - this.baseKey = baseKey; - this.identityKey = identityKey; - this.message = message; - - WhisperProtos.PreKeyWhisperMessage.Builder builder = - WhisperProtos.PreKeyWhisperMessage.newBuilder() - .setSignedPreKeyId(signedPreKeyId) - .setBaseKey(ByteString.copyFrom(baseKey.serialize())) - .setIdentityKey(ByteString.copyFrom(identityKey.serialize())) - .setMessage(ByteString.copyFrom(message.serialize())) - .setRegistrationId(registrationId); - - if (preKeyId.isPresent()) { - builder.setPreKeyId(preKeyId.get()); - } - - byte[] versionBytes = {ByteUtil.intsToByteHighAndLow(this.version, CURRENT_VERSION)}; - byte[] messageBytes = builder.build().toByteArray(); - - this.serialized = ByteUtil.combine(versionBytes, messageBytes); - } - - public int getMessageVersion() { - return version; - } - - public IdentityKey getIdentityKey() { - return identityKey; - } - - public int getRegistrationId() { - return registrationId; - } - - public Optional<Integer> getPreKeyId() { - return preKeyId; - } - - public int getSignedPreKeyId() { - return signedPreKeyId; - } - - public ECPublicKey getBaseKey() { - return baseKey; - } - - public WhisperMessage getWhisperMessage() { - return message; - } - - @Override - public byte[] serialize() { - return serialized; - } - - @Override - public int getType() { - return CiphertextMessage.PREKEY_TYPE; - } - -} diff --git a/src/main/java/org/whispersystems/libaxolotl/protocol/SenderKeyDistributionMessage.java b/src/main/java/org/whispersystems/libaxolotl/protocol/SenderKeyDistributionMessage.java deleted file mode 100644 index 424dd87c..00000000 --- a/src/main/java/org/whispersystems/libaxolotl/protocol/SenderKeyDistributionMessage.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.whispersystems.libaxolotl.protocol; - -import com.google.protobuf.ByteString; - -import org.whispersystems.libaxolotl.ecc.ECPublicKey; -import org.whispersystems.libaxolotl.util.ByteUtil; - -public class SenderKeyDistributionMessage implements CiphertextMessage { - - private final int id; - private final int iteration; - private final byte[] chainKey; - private final ECPublicKey signatureKey; - private final byte[] serialized; - - public SenderKeyDistributionMessage(int id, int iteration, byte[] chainKey, ECPublicKey signatureKey) { - byte[] version = {ByteUtil.intsToByteHighAndLow(CURRENT_VERSION, CURRENT_VERSION)}; - - this.id = id; - this.iteration = iteration; - this.chainKey = chainKey; - this.signatureKey = signatureKey; - this.serialized = WhisperProtos.SenderKeyDistributionMessage.newBuilder() - .setId(id) - .setIteration(iteration) - .setChainKey(ByteString.copyFrom(chainKey)) - .setSigningKey(ByteString.copyFrom(signatureKey.serialize())) - .build().toByteArray(); - } - - @Override - public byte[] serialize() { - return serialized; - } - - @Override - public int getType() { - return SENDERKEY_DISTRIBUTION_TYPE; - } - - public int getIteration() { - return iteration; - } - - public byte[] getChainKey() { - return chainKey; - } - - public ECPublicKey getSignatureKey() { - return signatureKey; - } - - public int getId() { - return id; - } -} diff --git a/src/main/java/org/whispersystems/libaxolotl/protocol/SenderKeyMessage.java b/src/main/java/org/whispersystems/libaxolotl/protocol/SenderKeyMessage.java deleted file mode 100644 index b3a17456..00000000 --- a/src/main/java/org/whispersystems/libaxolotl/protocol/SenderKeyMessage.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.whispersystems.libaxolotl.protocol; - -import com.google.protobuf.ByteString; -import com.google.protobuf.InvalidProtocolBufferException; - -import org.whispersystems.libaxolotl.InvalidKeyException; -import org.whispersystems.libaxolotl.InvalidMessageException; -import org.whispersystems.libaxolotl.LegacyMessageException; -import org.whispersystems.libaxolotl.ecc.Curve; -import org.whispersystems.libaxolotl.ecc.ECPrivateKey; -import org.whispersystems.libaxolotl.ecc.ECPublicKey; -import org.whispersystems.libaxolotl.util.ByteUtil; - -import java.text.ParseException; - -public class SenderKeyMessage implements CiphertextMessage { - - private static final int SIGNATURE_LENGTH = 64; - - private final int messageVersion; - private final int keyId; - private final int iteration; - private final byte[] ciphertext; - private final byte[] serialized; - - public SenderKeyMessage(byte[] serialized) throws InvalidMessageException, LegacyMessageException { - try { - byte[][] messageParts = ByteUtil.split(serialized, 1, serialized.length - 1 - SIGNATURE_LENGTH, SIGNATURE_LENGTH); - byte version = messageParts[0][0]; - byte[] message = messageParts[1]; - byte[] signature = messageParts[2]; - - if (ByteUtil.highBitsToInt(version) < 3) { - throw new LegacyMessageException("Legacy message: " + ByteUtil.highBitsToInt(version)); - } - - if (ByteUtil.highBitsToInt(version) > CURRENT_VERSION) { - throw new InvalidMessageException("Unknown version: " + ByteUtil.highBitsToInt(version)); - } - - WhisperProtos.SenderKeyMessage senderKeyMessage = WhisperProtos.SenderKeyMessage.parseFrom(message); - - if (!senderKeyMessage.hasId() || - !senderKeyMessage.hasIteration() || - !senderKeyMessage.hasCiphertext()) - { - throw new InvalidMessageException("Incomplete message."); - } - - this.serialized = serialized; - this.messageVersion = ByteUtil.highBitsToInt(version); - this.keyId = senderKeyMessage.getId(); - this.iteration = senderKeyMessage.getIteration(); - this.ciphertext = senderKeyMessage.getCiphertext().toByteArray(); - } catch (InvalidProtocolBufferException | ParseException e) { - throw new InvalidMessageException(e); - } - } - - public SenderKeyMessage(int keyId, int iteration, byte[] ciphertext, ECPrivateKey signatureKey) { - byte[] version = {ByteUtil.intsToByteHighAndLow(CURRENT_VERSION, CURRENT_VERSION)}; - byte[] message = WhisperProtos.SenderKeyMessage.newBuilder() - .setId(keyId) - .setIteration(iteration) - .setCiphertext(ByteString.copyFrom(ciphertext)) - .build().toByteArray(); - - byte[] signature = getSignature(signatureKey, ByteUtil.combine(version, message)); - - this.serialized = ByteUtil.combine(version, message, signature); - this.messageVersion = CURRENT_VERSION; - this.keyId = keyId; - this.iteration = iteration; - this.ciphertext = ciphertext; - } - - public int getKeyId() { - return keyId; - } - - public int getIteration() { - return iteration; - } - - public byte[] getCipherText() { - return ciphertext; - } - - public void verifySignature(ECPublicKey signatureKey) - throws InvalidMessageException - { - try { - byte[][] parts = ByteUtil.split(serialized, serialized.length - SIGNATURE_LENGTH, SIGNATURE_LENGTH); - - if (!Curve.verifySignature(signatureKey, parts[0], parts[1])) { - throw new InvalidMessageException("Invalid signature!"); - } - - } catch (InvalidKeyException e) { - throw new InvalidMessageException(e); - } - } - - private byte[] getSignature(ECPrivateKey signatureKey, byte[] serialized) { - try { - return Curve.calculateSignature(signatureKey, serialized); - } catch (InvalidKeyException e) { - throw new AssertionError(e); - } - } - - @Override - public byte[] serialize() { - return serialized; - } - - @Override - public int getType() { - return CiphertextMessage.SENDERKEY_TYPE; - } -} diff --git a/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperMessage.java b/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperMessage.java deleted file mode 100644 index 980bec1f..00000000 --- a/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperMessage.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Copyright (C) 2014 Open Whisper Systems - * - * 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.whispersystems.libaxolotl.protocol; - -import com.google.protobuf.ByteString; -import com.google.protobuf.InvalidProtocolBufferException; - -import org.whispersystems.libaxolotl.IdentityKey; -import org.whispersystems.libaxolotl.InvalidKeyException; -import org.whispersystems.libaxolotl.InvalidMessageException; -import org.whispersystems.libaxolotl.LegacyMessageException; -import org.whispersystems.libaxolotl.ecc.Curve; -import org.whispersystems.libaxolotl.ecc.ECPublicKey; -import org.whispersystems.libaxolotl.util.ByteUtil; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.text.ParseException; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; - -public class WhisperMessage implements CiphertextMessage { - - private static final int MAC_LENGTH = 8; - - private final int messageVersion; - private final ECPublicKey senderRatchetKey; - private final int counter; - private final int previousCounter; - private final byte[] ciphertext; - private final byte[] serialized; - - public WhisperMessage(byte[] serialized) throws InvalidMessageException, LegacyMessageException { - try { - byte[][] messageParts = ByteUtil.split(serialized, 1, serialized.length - 1 - MAC_LENGTH, MAC_LENGTH); - byte version = messageParts[0][0]; - byte[] message = messageParts[1]; - byte[] mac = messageParts[2]; - - if (ByteUtil.highBitsToInt(version) <= CiphertextMessage.UNSUPPORTED_VERSION) { - throw new LegacyMessageException("Legacy message: " + ByteUtil.highBitsToInt(version)); - } - - if (ByteUtil.highBitsToInt(version) > CURRENT_VERSION) { - throw new InvalidMessageException("Unknown version: " + ByteUtil.highBitsToInt(version)); - } - - WhisperProtos.WhisperMessage whisperMessage = WhisperProtos.WhisperMessage.parseFrom(message); - - if (!whisperMessage.hasCiphertext() || - !whisperMessage.hasCounter() || - !whisperMessage.hasRatchetKey()) - { - throw new InvalidMessageException("Incomplete message."); - } - - this.serialized = serialized; - this.senderRatchetKey = Curve.decodePoint(whisperMessage.getRatchetKey().toByteArray(), 0); - this.messageVersion = ByteUtil.highBitsToInt(version); - this.counter = whisperMessage.getCounter(); - this.previousCounter = whisperMessage.getPreviousCounter(); - this.ciphertext = whisperMessage.getCiphertext().toByteArray(); - } catch (InvalidProtocolBufferException | InvalidKeyException | ParseException e) { - throw new InvalidMessageException(e); - } - } - - public WhisperMessage(int messageVersion, SecretKeySpec macKey, ECPublicKey senderRatchetKey, - int counter, int previousCounter, byte[] ciphertext, - IdentityKey senderIdentityKey, - IdentityKey receiverIdentityKey) - { - byte[] version = {ByteUtil.intsToByteHighAndLow(messageVersion, CURRENT_VERSION)}; - byte[] message = WhisperProtos.WhisperMessage.newBuilder() - .setRatchetKey(ByteString.copyFrom(senderRatchetKey.serialize())) - .setCounter(counter) - .setPreviousCounter(previousCounter) - .setCiphertext(ByteString.copyFrom(ciphertext)) - .build().toByteArray(); - - byte[] mac = getMac(messageVersion, senderIdentityKey, receiverIdentityKey, macKey, - ByteUtil.combine(version, message)); - - this.serialized = ByteUtil.combine(version, message, mac); - this.senderRatchetKey = senderRatchetKey; - this.counter = counter; - this.previousCounter = previousCounter; - this.ciphertext = ciphertext; - this.messageVersion = messageVersion; - } - - public ECPublicKey getSenderRatchetKey() { - return senderRatchetKey; - } - - public int getMessageVersion() { - return messageVersion; - } - - public int getCounter() { - return counter; - } - - public byte[] getBody() { - return ciphertext; - } - - public void verifyMac(int messageVersion, IdentityKey senderIdentityKey, - IdentityKey receiverIdentityKey, SecretKeySpec macKey) - throws InvalidMessageException - { - byte[][] parts = ByteUtil.split(serialized, serialized.length - MAC_LENGTH, MAC_LENGTH); - byte[] ourMac = getMac(messageVersion, senderIdentityKey, receiverIdentityKey, macKey, parts[0]); - byte[] theirMac = parts[1]; - - if (!MessageDigest.isEqual(ourMac, theirMac)) { - throw new InvalidMessageException("Bad Mac!"); - } - } - - private byte[] getMac(int messageVersion, - IdentityKey senderIdentityKey, - IdentityKey receiverIdentityKey, - SecretKeySpec macKey, byte[] serialized) - { - try { - Mac mac = Mac.getInstance("HmacSHA256"); - mac.init(macKey); - - if (messageVersion >= 3) { - mac.update(senderIdentityKey.getPublicKey().serialize()); - mac.update(receiverIdentityKey.getPublicKey().serialize()); - } - - byte[] fullMac = mac.doFinal(serialized); - return ByteUtil.trim(fullMac, MAC_LENGTH); - } catch (NoSuchAlgorithmException | java.security.InvalidKeyException e) { - throw new AssertionError(e); - } - } - - @Override - public byte[] serialize() { - return serialized; - } - - @Override - public int getType() { - return CiphertextMessage.WHISPER_TYPE; - } - - public static boolean isLegacy(byte[] message) { - return message != null && message.length >= 1 && - ByteUtil.highBitsToInt(message[0]) <= CiphertextMessage.UNSUPPORTED_VERSION; - } - -} diff --git a/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperProtos.java b/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperProtos.java deleted file mode 100644 index 12ab0272..00000000 --- a/src/main/java/org/whispersystems/libaxolotl/protocol/WhisperProtos.java +++ /dev/null @@ -1,3532 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: WhisperTextProtocol.proto - -package org.whispersystems.libaxolotl.protocol; - -public final class WhisperProtos { - private WhisperProtos() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - } - public interface WhisperMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional bytes ratchetKey = 1; - /** - * <code>optional bytes ratchetKey = 1;</code> - */ - boolean hasRatchetKey(); - /** - * <code>optional bytes ratchetKey = 1;</code> - */ - com.google.protobuf.ByteString getRatchetKey(); - - // optional uint32 counter = 2; - /** - * <code>optional uint32 counter = 2;</code> - */ - boolean hasCounter(); - /** - * <code>optional uint32 counter = 2;</code> - */ - int getCounter(); - - // optional uint32 previousCounter = 3; - /** - * <code>optional uint32 previousCounter = 3;</code> - */ - boolean hasPreviousCounter(); - /** - * <code>optional uint32 previousCounter = 3;</code> - */ - int getPreviousCounter(); - - // optional bytes ciphertext = 4; - /** - * <code>optional bytes ciphertext = 4;</code> - */ - boolean hasCiphertext(); - /** - * <code>optional bytes ciphertext = 4;</code> - */ - com.google.protobuf.ByteString getCiphertext(); - } - /** - * Protobuf type {@code textsecure.WhisperMessage} - */ - public static final class WhisperMessage extends - com.google.protobuf.GeneratedMessage - implements WhisperMessageOrBuilder { - // Use WhisperMessage.newBuilder() to construct. - private WhisperMessage(com.google.protobuf.GeneratedMessage.Builder<?> builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private WhisperMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final WhisperMessage defaultInstance; - public static WhisperMessage getDefaultInstance() { - return defaultInstance; - } - - public WhisperMessage getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private WhisperMessage( - 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; - ratchetKey_ = input.readBytes(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - counter_ = input.readUInt32(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - previousCounter_ = input.readUInt32(); - break; - } - case 34: { - bitField0_ |= 0x00000008; - ciphertext_ = 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.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.Builder.class); - } - - public static com.google.protobuf.Parser<WhisperMessage> PARSER = - new com.google.protobuf.AbstractParser<WhisperMessage>() { - public WhisperMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new WhisperMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser<WhisperMessage> getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional bytes ratchetKey = 1; - public static final int RATCHETKEY_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString ratchetKey_; - /** - * <code>optional bytes ratchetKey = 1;</code> - */ - public boolean hasRatchetKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional bytes ratchetKey = 1;</code> - */ - public com.google.protobuf.ByteString getRatchetKey() { - return ratchetKey_; - } - - // optional uint32 counter = 2; - public static final int COUNTER_FIELD_NUMBER = 2; - private int counter_; - /** - * <code>optional uint32 counter = 2;</code> - */ - public boolean hasCounter() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional uint32 counter = 2;</code> - */ - public int getCounter() { - return counter_; - } - - // optional uint32 previousCounter = 3; - public static final int PREVIOUSCOUNTER_FIELD_NUMBER = 3; - private int previousCounter_; - /** - * <code>optional uint32 previousCounter = 3;</code> - */ - public boolean hasPreviousCounter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional uint32 previousCounter = 3;</code> - */ - public int getPreviousCounter() { - return previousCounter_; - } - - // optional bytes ciphertext = 4; - public static final int CIPHERTEXT_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString ciphertext_; - /** - * <code>optional bytes ciphertext = 4;</code> - */ - public boolean hasCiphertext() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional bytes ciphertext = 4;</code> - */ - public com.google.protobuf.ByteString getCiphertext() { - return ciphertext_; - } - - private void initFields() { - ratchetKey_ = com.google.protobuf.ByteString.EMPTY; - counter_ = 0; - previousCounter_ = 0; - ciphertext_ = 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, ratchetKey_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeUInt32(2, counter_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeUInt32(3, previousCounter_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, ciphertext_); - } - 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, ratchetKey_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(2, counter_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(3, previousCounter_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, ciphertext_); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage 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.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage 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.WhisperMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder<Builder> - implements org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.Builder.class); - } - - // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.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(); - ratchetKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - counter_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - previousCounter_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - ciphertext_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_WhisperMessage_descriptor; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.getDefaultInstance(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage build() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage buildPartial() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.ratchetKey_ = ratchetKey_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.counter_ = counter_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.previousCounter_ = previousCounter_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.ciphertext_ = ciphertext_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage) { - return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage other) { - if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage.getDefaultInstance()) return this; - if (other.hasRatchetKey()) { - setRatchetKey(other.getRatchetKey()); - } - if (other.hasCounter()) { - setCounter(other.getCounter()); - } - if (other.hasPreviousCounter()) { - setPreviousCounter(other.getPreviousCounter()); - } - if (other.hasCiphertext()) { - setCiphertext(other.getCiphertext()); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.whispersystems.libaxolotl.protocol.WhisperProtos.WhisperMessage) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional bytes ratchetKey = 1; - private com.google.protobuf.ByteString ratchetKey_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes ratchetKey = 1;</code> - */ - public boolean hasRatchetKey() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional bytes ratchetKey = 1;</code> - */ - public com.google.protobuf.ByteString getRatchetKey() { - return ratchetKey_; - } - /** - * <code>optional bytes ratchetKey = 1;</code> - */ - public Builder setRatchetKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - ratchetKey_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes ratchetKey = 1;</code> - */ - public Builder clearRatchetKey() { - bitField0_ = (bitField0_ & ~0x00000001); - ratchetKey_ = getDefaultInstance().getRatchetKey(); - onChanged(); - return this; - } - - // optional uint32 counter = 2; - private int counter_ ; - /** - * <code>optional uint32 counter = 2;</code> - */ - public boolean hasCounter() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional uint32 counter = 2;</code> - */ - public int getCounter() { - return counter_; - } - /** - * <code>optional uint32 counter = 2;</code> - */ - public Builder setCounter(int value) { - bitField0_ |= 0x00000002; - counter_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 counter = 2;</code> - */ - public Builder clearCounter() { - bitField0_ = (bitField0_ & ~0x00000002); - counter_ = 0; - onChanged(); - return this; - } - - // optional uint32 previousCounter = 3; - private int previousCounter_ ; - /** - * <code>optional uint32 previousCounter = 3;</code> - */ - public boolean hasPreviousCounter() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional uint32 previousCounter = 3;</code> - */ - public int getPreviousCounter() { - return previousCounter_; - } - /** - * <code>optional uint32 previousCounter = 3;</code> - */ - public Builder setPreviousCounter(int value) { - bitField0_ |= 0x00000004; - previousCounter_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 previousCounter = 3;</code> - */ - public Builder clearPreviousCounter() { - bitField0_ = (bitField0_ & ~0x00000004); - previousCounter_ = 0; - onChanged(); - return this; - } - - // optional bytes ciphertext = 4; - private com.google.protobuf.ByteString ciphertext_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes ciphertext = 4;</code> - */ - public boolean hasCiphertext() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional bytes ciphertext = 4;</code> - */ - public com.google.protobuf.ByteString getCiphertext() { - return ciphertext_; - } - /** - * <code>optional bytes ciphertext = 4;</code> - */ - public Builder setCiphertext(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - ciphertext_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes ciphertext = 4;</code> - */ - public Builder clearCiphertext() { - bitField0_ = (bitField0_ & ~0x00000008); - ciphertext_ = getDefaultInstance().getCiphertext(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.WhisperMessage) - } - - static { - defaultInstance = new WhisperMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.WhisperMessage) - } - - public interface PreKeyWhisperMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional uint32 registrationId = 5; - /** - * <code>optional uint32 registrationId = 5;</code> - */ - boolean hasRegistrationId(); - /** - * <code>optional uint32 registrationId = 5;</code> - */ - int getRegistrationId(); - - // optional uint32 preKeyId = 1; - /** - * <code>optional uint32 preKeyId = 1;</code> - */ - boolean hasPreKeyId(); - /** - * <code>optional uint32 preKeyId = 1;</code> - */ - int getPreKeyId(); - - // optional uint32 signedPreKeyId = 6; - /** - * <code>optional uint32 signedPreKeyId = 6;</code> - */ - boolean hasSignedPreKeyId(); - /** - * <code>optional uint32 signedPreKeyId = 6;</code> - */ - int getSignedPreKeyId(); - - // optional bytes baseKey = 2; - /** - * <code>optional bytes baseKey = 2;</code> - */ - boolean hasBaseKey(); - /** - * <code>optional bytes baseKey = 2;</code> - */ - com.google.protobuf.ByteString getBaseKey(); - - // optional bytes identityKey = 3; - /** - * <code>optional bytes identityKey = 3;</code> - */ - boolean hasIdentityKey(); - /** - * <code>optional bytes identityKey = 3;</code> - */ - com.google.protobuf.ByteString getIdentityKey(); - - // optional bytes message = 4; - /** - * <code>optional bytes message = 4;</code> - * - * <pre> - * WhisperMessage - * </pre> - */ - boolean hasMessage(); - /** - * <code>optional bytes message = 4;</code> - * - * <pre> - * WhisperMessage - * </pre> - */ - com.google.protobuf.ByteString getMessage(); - } - /** - * Protobuf type {@code textsecure.PreKeyWhisperMessage} - */ - public static final class PreKeyWhisperMessage extends - com.google.protobuf.GeneratedMessage - implements PreKeyWhisperMessageOrBuilder { - // Use PreKeyWhisperMessage.newBuilder() to construct. - private PreKeyWhisperMessage(com.google.protobuf.GeneratedMessage.Builder<?> builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private PreKeyWhisperMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final PreKeyWhisperMessage defaultInstance; - public static PreKeyWhisperMessage getDefaultInstance() { - return defaultInstance; - } - - public PreKeyWhisperMessage getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private PreKeyWhisperMessage( - 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_ |= 0x00000002; - preKeyId_ = input.readUInt32(); - break; - } - case 18: { - bitField0_ |= 0x00000008; - baseKey_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000010; - identityKey_ = input.readBytes(); - break; - } - case 34: { - bitField0_ |= 0x00000020; - message_ = input.readBytes(); - break; - } - case 40: { - bitField0_ |= 0x00000001; - registrationId_ = input.readUInt32(); - break; - } - case 48: { - bitField0_ |= 0x00000004; - signedPreKeyId_ = input.readUInt32(); - 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.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.Builder.class); - } - - public static com.google.protobuf.Parser<PreKeyWhisperMessage> PARSER = - new com.google.protobuf.AbstractParser<PreKeyWhisperMessage>() { - public PreKeyWhisperMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new PreKeyWhisperMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser<PreKeyWhisperMessage> getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional uint32 registrationId = 5; - public static final int REGISTRATIONID_FIELD_NUMBER = 5; - private int registrationId_; - /** - * <code>optional uint32 registrationId = 5;</code> - */ - public boolean hasRegistrationId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional uint32 registrationId = 5;</code> - */ - public int getRegistrationId() { - return registrationId_; - } - - // optional uint32 preKeyId = 1; - public static final int PREKEYID_FIELD_NUMBER = 1; - private int preKeyId_; - /** - * <code>optional uint32 preKeyId = 1;</code> - */ - public boolean hasPreKeyId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional uint32 preKeyId = 1;</code> - */ - public int getPreKeyId() { - return preKeyId_; - } - - // optional uint32 signedPreKeyId = 6; - public static final int SIGNEDPREKEYID_FIELD_NUMBER = 6; - private int signedPreKeyId_; - /** - * <code>optional uint32 signedPreKeyId = 6;</code> - */ - public boolean hasSignedPreKeyId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional uint32 signedPreKeyId = 6;</code> - */ - public int getSignedPreKeyId() { - return signedPreKeyId_; - } - - // optional bytes baseKey = 2; - public static final int BASEKEY_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString baseKey_; - /** - * <code>optional bytes baseKey = 2;</code> - */ - public boolean hasBaseKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional bytes baseKey = 2;</code> - */ - public com.google.protobuf.ByteString getBaseKey() { - return baseKey_; - } - - // optional bytes identityKey = 3; - public static final int IDENTITYKEY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString identityKey_; - /** - * <code>optional bytes identityKey = 3;</code> - */ - public boolean hasIdentityKey() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <code>optional bytes identityKey = 3;</code> - */ - public com.google.protobuf.ByteString getIdentityKey() { - return identityKey_; - } - - // optional bytes message = 4; - public static final int MESSAGE_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString message_; - /** - * <code>optional bytes message = 4;</code> - * - * <pre> - * WhisperMessage - * </pre> - */ - public boolean hasMessage() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <code>optional bytes message = 4;</code> - * - * <pre> - * WhisperMessage - * </pre> - */ - public com.google.protobuf.ByteString getMessage() { - return message_; - } - - private void initFields() { - registrationId_ = 0; - preKeyId_ = 0; - signedPreKeyId_ = 0; - baseKey_ = com.google.protobuf.ByteString.EMPTY; - identityKey_ = com.google.protobuf.ByteString.EMPTY; - message_ = 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_ & 0x00000002) == 0x00000002)) { - output.writeUInt32(1, preKeyId_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(2, baseKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(3, identityKey_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBytes(4, message_); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeUInt32(5, registrationId_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeUInt32(6, signedPreKeyId_); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(1, preKeyId_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, baseKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, identityKey_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, message_); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(5, registrationId_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(6, signedPreKeyId_); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage 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.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage 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.PreKeyWhisperMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder<Builder> - implements org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.Builder.class); - } - - // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.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(); - registrationId_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - preKeyId_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - signedPreKeyId_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - baseKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - identityKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000010); - message_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000020); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_PreKeyWhisperMessage_descriptor; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.getDefaultInstance(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage build() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage buildPartial() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.registrationId_ = registrationId_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.preKeyId_ = preKeyId_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.signedPreKeyId_ = signedPreKeyId_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.baseKey_ = baseKey_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.identityKey_ = identityKey_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.message_ = message_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage) { - return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage other) { - if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage.getDefaultInstance()) return this; - if (other.hasRegistrationId()) { - setRegistrationId(other.getRegistrationId()); - } - if (other.hasPreKeyId()) { - setPreKeyId(other.getPreKeyId()); - } - if (other.hasSignedPreKeyId()) { - setSignedPreKeyId(other.getSignedPreKeyId()); - } - if (other.hasBaseKey()) { - setBaseKey(other.getBaseKey()); - } - if (other.hasIdentityKey()) { - setIdentityKey(other.getIdentityKey()); - } - if (other.hasMessage()) { - setMessage(other.getMessage()); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.whispersystems.libaxolotl.protocol.WhisperProtos.PreKeyWhisperMessage) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional uint32 registrationId = 5; - private int registrationId_ ; - /** - * <code>optional uint32 registrationId = 5;</code> - */ - public boolean hasRegistrationId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional uint32 registrationId = 5;</code> - */ - public int getRegistrationId() { - return registrationId_; - } - /** - * <code>optional uint32 registrationId = 5;</code> - */ - public Builder setRegistrationId(int value) { - bitField0_ |= 0x00000001; - registrationId_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 registrationId = 5;</code> - */ - public Builder clearRegistrationId() { - bitField0_ = (bitField0_ & ~0x00000001); - registrationId_ = 0; - onChanged(); - return this; - } - - // optional uint32 preKeyId = 1; - private int preKeyId_ ; - /** - * <code>optional uint32 preKeyId = 1;</code> - */ - public boolean hasPreKeyId() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional uint32 preKeyId = 1;</code> - */ - public int getPreKeyId() { - return preKeyId_; - } - /** - * <code>optional uint32 preKeyId = 1;</code> - */ - public Builder setPreKeyId(int value) { - bitField0_ |= 0x00000002; - preKeyId_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 preKeyId = 1;</code> - */ - public Builder clearPreKeyId() { - bitField0_ = (bitField0_ & ~0x00000002); - preKeyId_ = 0; - onChanged(); - return this; - } - - // optional uint32 signedPreKeyId = 6; - private int signedPreKeyId_ ; - /** - * <code>optional uint32 signedPreKeyId = 6;</code> - */ - public boolean hasSignedPreKeyId() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional uint32 signedPreKeyId = 6;</code> - */ - public int getSignedPreKeyId() { - return signedPreKeyId_; - } - /** - * <code>optional uint32 signedPreKeyId = 6;</code> - */ - public Builder setSignedPreKeyId(int value) { - bitField0_ |= 0x00000004; - signedPreKeyId_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 signedPreKeyId = 6;</code> - */ - public Builder clearSignedPreKeyId() { - bitField0_ = (bitField0_ & ~0x00000004); - signedPreKeyId_ = 0; - onChanged(); - return this; - } - - // optional bytes baseKey = 2; - private com.google.protobuf.ByteString baseKey_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes baseKey = 2;</code> - */ - public boolean hasBaseKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional bytes baseKey = 2;</code> - */ - public com.google.protobuf.ByteString getBaseKey() { - return baseKey_; - } - /** - * <code>optional bytes baseKey = 2;</code> - */ - public Builder setBaseKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - baseKey_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes baseKey = 2;</code> - */ - public Builder clearBaseKey() { - bitField0_ = (bitField0_ & ~0x00000008); - baseKey_ = getDefaultInstance().getBaseKey(); - onChanged(); - return this; - } - - // optional bytes identityKey = 3; - private com.google.protobuf.ByteString identityKey_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes identityKey = 3;</code> - */ - public boolean hasIdentityKey() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <code>optional bytes identityKey = 3;</code> - */ - public com.google.protobuf.ByteString getIdentityKey() { - return identityKey_; - } - /** - * <code>optional bytes identityKey = 3;</code> - */ - public Builder setIdentityKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - identityKey_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes identityKey = 3;</code> - */ - public Builder clearIdentityKey() { - bitField0_ = (bitField0_ & ~0x00000010); - identityKey_ = getDefaultInstance().getIdentityKey(); - onChanged(); - return this; - } - - // optional bytes message = 4; - private com.google.protobuf.ByteString message_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes message = 4;</code> - * - * <pre> - * WhisperMessage - * </pre> - */ - public boolean hasMessage() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <code>optional bytes message = 4;</code> - * - * <pre> - * WhisperMessage - * </pre> - */ - public com.google.protobuf.ByteString getMessage() { - return message_; - } - /** - * <code>optional bytes message = 4;</code> - * - * <pre> - * WhisperMessage - * </pre> - */ - public Builder setMessage(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - message_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes message = 4;</code> - * - * <pre> - * WhisperMessage - * </pre> - */ - public Builder clearMessage() { - bitField0_ = (bitField0_ & ~0x00000020); - message_ = getDefaultInstance().getMessage(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.PreKeyWhisperMessage) - } - - static { - defaultInstance = new PreKeyWhisperMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.PreKeyWhisperMessage) - } - - public interface KeyExchangeMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional uint32 id = 1; - /** - * <code>optional uint32 id = 1;</code> - */ - boolean hasId(); - /** - * <code>optional uint32 id = 1;</code> - */ - int getId(); - - // optional bytes baseKey = 2; - /** - * <code>optional bytes baseKey = 2;</code> - */ - boolean hasBaseKey(); - /** - * <code>optional bytes baseKey = 2;</code> - */ - com.google.protobuf.ByteString getBaseKey(); - - // optional bytes ratchetKey = 3; - /** - * <code>optional bytes ratchetKey = 3;</code> - */ - boolean hasRatchetKey(); - /** - * <code>optional bytes ratchetKey = 3;</code> - */ - com.google.protobuf.ByteString getRatchetKey(); - - // optional bytes identityKey = 4; - /** - * <code>optional bytes identityKey = 4;</code> - */ - boolean hasIdentityKey(); - /** - * <code>optional bytes identityKey = 4;</code> - */ - com.google.protobuf.ByteString getIdentityKey(); - - // optional bytes baseKeySignature = 5; - /** - * <code>optional bytes baseKeySignature = 5;</code> - */ - boolean hasBaseKeySignature(); - /** - * <code>optional bytes baseKeySignature = 5;</code> - */ - com.google.protobuf.ByteString getBaseKeySignature(); - } - /** - * Protobuf type {@code textsecure.KeyExchangeMessage} - */ - public static final class KeyExchangeMessage extends - com.google.protobuf.GeneratedMessage - implements KeyExchangeMessageOrBuilder { - // Use KeyExchangeMessage.newBuilder() to construct. - private KeyExchangeMessage(com.google.protobuf.GeneratedMessage.Builder<?> builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private KeyExchangeMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final KeyExchangeMessage defaultInstance; - public static KeyExchangeMessage getDefaultInstance() { - return defaultInstance; - } - - public KeyExchangeMessage getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private KeyExchangeMessage( - 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; - id_ = input.readUInt32(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - baseKey_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - ratchetKey_ = input.readBytes(); - break; - } - case 34: { - bitField0_ |= 0x00000008; - identityKey_ = input.readBytes(); - break; - } - case 42: { - bitField0_ |= 0x00000010; - baseKeySignature_ = 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.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.Builder.class); - } - - public static com.google.protobuf.Parser<KeyExchangeMessage> PARSER = - new com.google.protobuf.AbstractParser<KeyExchangeMessage>() { - public KeyExchangeMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new KeyExchangeMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser<KeyExchangeMessage> getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional uint32 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private int id_; - /** - * <code>optional uint32 id = 1;</code> - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional uint32 id = 1;</code> - */ - public int getId() { - return id_; - } - - // optional bytes baseKey = 2; - public static final int BASEKEY_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString baseKey_; - /** - * <code>optional bytes baseKey = 2;</code> - */ - public boolean hasBaseKey() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional bytes baseKey = 2;</code> - */ - public com.google.protobuf.ByteString getBaseKey() { - return baseKey_; - } - - // optional bytes ratchetKey = 3; - public static final int RATCHETKEY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString ratchetKey_; - /** - * <code>optional bytes ratchetKey = 3;</code> - */ - public boolean hasRatchetKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional bytes ratchetKey = 3;</code> - */ - public com.google.protobuf.ByteString getRatchetKey() { - return ratchetKey_; - } - - // optional bytes identityKey = 4; - public static final int IDENTITYKEY_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString identityKey_; - /** - * <code>optional bytes identityKey = 4;</code> - */ - public boolean hasIdentityKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional bytes identityKey = 4;</code> - */ - public com.google.protobuf.ByteString getIdentityKey() { - return identityKey_; - } - - // optional bytes baseKeySignature = 5; - public static final int BASEKEYSIGNATURE_FIELD_NUMBER = 5; - private com.google.protobuf.ByteString baseKeySignature_; - /** - * <code>optional bytes baseKeySignature = 5;</code> - */ - public boolean hasBaseKeySignature() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <code>optional bytes baseKeySignature = 5;</code> - */ - public com.google.protobuf.ByteString getBaseKeySignature() { - return baseKeySignature_; - } - - private void initFields() { - id_ = 0; - baseKey_ = com.google.protobuf.ByteString.EMPTY; - ratchetKey_ = com.google.protobuf.ByteString.EMPTY; - identityKey_ = com.google.protobuf.ByteString.EMPTY; - baseKeySignature_ = 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.writeUInt32(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, baseKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, ratchetKey_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, identityKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(5, baseKeySignature_); - } - 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, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, baseKey_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, ratchetKey_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, identityKey_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(5, baseKeySignature_); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage 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.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage 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.KeyExchangeMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder<Builder> - implements org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.Builder.class); - } - - // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.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(); - id_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - baseKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - ratchetKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - identityKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - baseKeySignature_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_KeyExchangeMessage_descriptor; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.getDefaultInstance(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage build() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage buildPartial() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.baseKey_ = baseKey_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.ratchetKey_ = ratchetKey_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.identityKey_ = identityKey_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.baseKeySignature_ = baseKeySignature_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage) { - return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage other) { - if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasBaseKey()) { - setBaseKey(other.getBaseKey()); - } - if (other.hasRatchetKey()) { - setRatchetKey(other.getRatchetKey()); - } - if (other.hasIdentityKey()) { - setIdentityKey(other.getIdentityKey()); - } - if (other.hasBaseKeySignature()) { - setBaseKeySignature(other.getBaseKeySignature()); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.whispersystems.libaxolotl.protocol.WhisperProtos.KeyExchangeMessage) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional uint32 id = 1; - private int id_ ; - /** - * <code>optional uint32 id = 1;</code> - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional uint32 id = 1;</code> - */ - public int getId() { - return id_; - } - /** - * <code>optional uint32 id = 1;</code> - */ - public Builder setId(int value) { - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 id = 1;</code> - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = 0; - onChanged(); - return this; - } - - // optional bytes baseKey = 2; - private com.google.protobuf.ByteString baseKey_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes baseKey = 2;</code> - */ - public boolean hasBaseKey() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional bytes baseKey = 2;</code> - */ - public com.google.protobuf.ByteString getBaseKey() { - return baseKey_; - } - /** - * <code>optional bytes baseKey = 2;</code> - */ - public Builder setBaseKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - baseKey_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes baseKey = 2;</code> - */ - public Builder clearBaseKey() { - bitField0_ = (bitField0_ & ~0x00000002); - baseKey_ = getDefaultInstance().getBaseKey(); - onChanged(); - return this; - } - - // optional bytes ratchetKey = 3; - private com.google.protobuf.ByteString ratchetKey_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes ratchetKey = 3;</code> - */ - public boolean hasRatchetKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional bytes ratchetKey = 3;</code> - */ - public com.google.protobuf.ByteString getRatchetKey() { - return ratchetKey_; - } - /** - * <code>optional bytes ratchetKey = 3;</code> - */ - public Builder setRatchetKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - ratchetKey_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes ratchetKey = 3;</code> - */ - public Builder clearRatchetKey() { - bitField0_ = (bitField0_ & ~0x00000004); - ratchetKey_ = getDefaultInstance().getRatchetKey(); - onChanged(); - return this; - } - - // optional bytes identityKey = 4; - private com.google.protobuf.ByteString identityKey_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes identityKey = 4;</code> - */ - public boolean hasIdentityKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional bytes identityKey = 4;</code> - */ - public com.google.protobuf.ByteString getIdentityKey() { - return identityKey_; - } - /** - * <code>optional bytes identityKey = 4;</code> - */ - public Builder setIdentityKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - identityKey_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes identityKey = 4;</code> - */ - public Builder clearIdentityKey() { - bitField0_ = (bitField0_ & ~0x00000008); - identityKey_ = getDefaultInstance().getIdentityKey(); - onChanged(); - return this; - } - - // optional bytes baseKeySignature = 5; - private com.google.protobuf.ByteString baseKeySignature_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes baseKeySignature = 5;</code> - */ - public boolean hasBaseKeySignature() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <code>optional bytes baseKeySignature = 5;</code> - */ - public com.google.protobuf.ByteString getBaseKeySignature() { - return baseKeySignature_; - } - /** - * <code>optional bytes baseKeySignature = 5;</code> - */ - public Builder setBaseKeySignature(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - baseKeySignature_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes baseKeySignature = 5;</code> - */ - public Builder clearBaseKeySignature() { - bitField0_ = (bitField0_ & ~0x00000010); - baseKeySignature_ = getDefaultInstance().getBaseKeySignature(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.KeyExchangeMessage) - } - - static { - defaultInstance = new KeyExchangeMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.KeyExchangeMessage) - } - - public interface SenderKeyMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional uint32 id = 1; - /** - * <code>optional uint32 id = 1;</code> - */ - boolean hasId(); - /** - * <code>optional uint32 id = 1;</code> - */ - int getId(); - - // optional uint32 iteration = 2; - /** - * <code>optional uint32 iteration = 2;</code> - */ - boolean hasIteration(); - /** - * <code>optional uint32 iteration = 2;</code> - */ - int getIteration(); - - // optional bytes ciphertext = 3; - /** - * <code>optional bytes ciphertext = 3;</code> - */ - boolean hasCiphertext(); - /** - * <code>optional bytes ciphertext = 3;</code> - */ - com.google.protobuf.ByteString getCiphertext(); - } - /** - * Protobuf type {@code textsecure.SenderKeyMessage} - */ - public static final class SenderKeyMessage extends - com.google.protobuf.GeneratedMessage - implements SenderKeyMessageOrBuilder { - // Use SenderKeyMessage.newBuilder() to construct. - private SenderKeyMessage(com.google.protobuf.GeneratedMessage.Builder<?> builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private SenderKeyMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final SenderKeyMessage defaultInstance; - public static SenderKeyMessage getDefaultInstance() { - return defaultInstance; - } - - public SenderKeyMessage getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private SenderKeyMessage( - 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; - id_ = input.readUInt32(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - iteration_ = input.readUInt32(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - ciphertext_ = 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.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage.Builder.class); - } - - public static com.google.protobuf.Parser<SenderKeyMessage> PARSER = - new com.google.protobuf.AbstractParser<SenderKeyMessage>() { - public SenderKeyMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new SenderKeyMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser<SenderKeyMessage> getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional uint32 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private int id_; - /** - * <code>optional uint32 id = 1;</code> - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional uint32 id = 1;</code> - */ - public int getId() { - return id_; - } - - // optional uint32 iteration = 2; - public static final int ITERATION_FIELD_NUMBER = 2; - private int iteration_; - /** - * <code>optional uint32 iteration = 2;</code> - */ - public boolean hasIteration() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional uint32 iteration = 2;</code> - */ - public int getIteration() { - return iteration_; - } - - // optional bytes ciphertext = 3; - public static final int CIPHERTEXT_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString ciphertext_; - /** - * <code>optional bytes ciphertext = 3;</code> - */ - public boolean hasCiphertext() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional bytes ciphertext = 3;</code> - */ - public com.google.protobuf.ByteString getCiphertext() { - return ciphertext_; - } - - private void initFields() { - id_ = 0; - iteration_ = 0; - ciphertext_ = 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.writeUInt32(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeUInt32(2, iteration_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, ciphertext_); - } - 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, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(2, iteration_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, ciphertext_); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage 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.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage 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.SenderKeyMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder<Builder> - implements org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage.Builder.class); - } - - // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage.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(); - id_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - iteration_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - ciphertext_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyMessage_descriptor; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage.getDefaultInstance(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage build() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage buildPartial() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.iteration_ = iteration_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.ciphertext_ = ciphertext_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage) { - return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage other) { - if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasIteration()) { - setIteration(other.getIteration()); - } - if (other.hasCiphertext()) { - setCiphertext(other.getCiphertext()); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyMessage) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional uint32 id = 1; - private int id_ ; - /** - * <code>optional uint32 id = 1;</code> - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional uint32 id = 1;</code> - */ - public int getId() { - return id_; - } - /** - * <code>optional uint32 id = 1;</code> - */ - public Builder setId(int value) { - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 id = 1;</code> - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = 0; - onChanged(); - return this; - } - - // optional uint32 iteration = 2; - private int iteration_ ; - /** - * <code>optional uint32 iteration = 2;</code> - */ - public boolean hasIteration() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional uint32 iteration = 2;</code> - */ - public int getIteration() { - return iteration_; - } - /** - * <code>optional uint32 iteration = 2;</code> - */ - public Builder setIteration(int value) { - bitField0_ |= 0x00000002; - iteration_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 iteration = 2;</code> - */ - public Builder clearIteration() { - bitField0_ = (bitField0_ & ~0x00000002); - iteration_ = 0; - onChanged(); - return this; - } - - // optional bytes ciphertext = 3; - private com.google.protobuf.ByteString ciphertext_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes ciphertext = 3;</code> - */ - public boolean hasCiphertext() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional bytes ciphertext = 3;</code> - */ - public com.google.protobuf.ByteString getCiphertext() { - return ciphertext_; - } - /** - * <code>optional bytes ciphertext = 3;</code> - */ - public Builder setCiphertext(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - ciphertext_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes ciphertext = 3;</code> - */ - public Builder clearCiphertext() { - bitField0_ = (bitField0_ & ~0x00000004); - ciphertext_ = getDefaultInstance().getCiphertext(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.SenderKeyMessage) - } - - static { - defaultInstance = new SenderKeyMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.SenderKeyMessage) - } - - public interface SenderKeyDistributionMessageOrBuilder - extends com.google.protobuf.MessageOrBuilder { - - // optional uint32 id = 1; - /** - * <code>optional uint32 id = 1;</code> - */ - boolean hasId(); - /** - * <code>optional uint32 id = 1;</code> - */ - int getId(); - - // optional uint32 iteration = 2; - /** - * <code>optional uint32 iteration = 2;</code> - */ - boolean hasIteration(); - /** - * <code>optional uint32 iteration = 2;</code> - */ - int getIteration(); - - // optional bytes chainKey = 3; - /** - * <code>optional bytes chainKey = 3;</code> - */ - boolean hasChainKey(); - /** - * <code>optional bytes chainKey = 3;</code> - */ - com.google.protobuf.ByteString getChainKey(); - - // optional bytes signingKey = 4; - /** - * <code>optional bytes signingKey = 4;</code> - */ - boolean hasSigningKey(); - /** - * <code>optional bytes signingKey = 4;</code> - */ - com.google.protobuf.ByteString getSigningKey(); - } - /** - * Protobuf type {@code textsecure.SenderKeyDistributionMessage} - */ - public static final class SenderKeyDistributionMessage extends - com.google.protobuf.GeneratedMessage - implements SenderKeyDistributionMessageOrBuilder { - // Use SenderKeyDistributionMessage.newBuilder() to construct. - private SenderKeyDistributionMessage(com.google.protobuf.GeneratedMessage.Builder<?> builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private SenderKeyDistributionMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final SenderKeyDistributionMessage defaultInstance; - public static SenderKeyDistributionMessage getDefaultInstance() { - return defaultInstance; - } - - public SenderKeyDistributionMessage getDefaultInstanceForType() { - return defaultInstance; - } - - private final com.google.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private SenderKeyDistributionMessage( - 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; - id_ = input.readUInt32(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - iteration_ = input.readUInt32(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - chainKey_ = input.readBytes(); - break; - } - case 34: { - bitField0_ |= 0x00000008; - signingKey_ = 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.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyDistributionMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyDistributionMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage.Builder.class); - } - - public static com.google.protobuf.Parser<SenderKeyDistributionMessage> PARSER = - new com.google.protobuf.AbstractParser<SenderKeyDistributionMessage>() { - public SenderKeyDistributionMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new SenderKeyDistributionMessage(input, extensionRegistry); - } - }; - - @java.lang.Override - public com.google.protobuf.Parser<SenderKeyDistributionMessage> getParserForType() { - return PARSER; - } - - private int bitField0_; - // optional uint32 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private int id_; - /** - * <code>optional uint32 id = 1;</code> - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional uint32 id = 1;</code> - */ - public int getId() { - return id_; - } - - // optional uint32 iteration = 2; - public static final int ITERATION_FIELD_NUMBER = 2; - private int iteration_; - /** - * <code>optional uint32 iteration = 2;</code> - */ - public boolean hasIteration() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional uint32 iteration = 2;</code> - */ - public int getIteration() { - return iteration_; - } - - // optional bytes chainKey = 3; - public static final int CHAINKEY_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString chainKey_; - /** - * <code>optional bytes chainKey = 3;</code> - */ - public boolean hasChainKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional bytes chainKey = 3;</code> - */ - public com.google.protobuf.ByteString getChainKey() { - return chainKey_; - } - - // optional bytes signingKey = 4; - public static final int SIGNINGKEY_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString signingKey_; - /** - * <code>optional bytes signingKey = 4;</code> - */ - public boolean hasSigningKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional bytes signingKey = 4;</code> - */ - public com.google.protobuf.ByteString getSigningKey() { - return signingKey_; - } - - private void initFields() { - id_ = 0; - iteration_ = 0; - chainKey_ = com.google.protobuf.ByteString.EMPTY; - signingKey_ = 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.writeUInt32(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeUInt32(2, iteration_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, chainKey_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, signingKey_); - } - 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, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(2, iteration_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, chainKey_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, signingKey_); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return PARSER.parseDelimitedFrom(input, extensionRegistry); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return PARSER.parseFrom(input); - } - public static org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage 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.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage 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.SenderKeyDistributionMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder<Builder> - implements org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyDistributionMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyDistributionMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage.class, org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage.Builder.class); - } - - // Construct using org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage.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(); - id_ = 0; - bitField0_ = (bitField0_ & ~0x00000001); - iteration_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - chainKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - signingKey_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.internal_static_textsecure_SenderKeyDistributionMessage_descriptor; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage getDefaultInstanceForType() { - return org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage.getDefaultInstance(); - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage build() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage buildPartial() { - org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage result = new org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.iteration_ = iteration_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.chainKey_ = chainKey_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.signingKey_ = signingKey_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage) { - return mergeFrom((org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage other) { - if (other == org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasIteration()) { - setIteration(other.getIteration()); - } - if (other.hasChainKey()) { - setChainKey(other.getChainKey()); - } - if (other.hasSigningKey()) { - setSigningKey(other.getSigningKey()); - } - 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.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.whispersystems.libaxolotl.protocol.WhisperProtos.SenderKeyDistributionMessage) e.getUnfinishedMessage(); - throw e; - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - // optional uint32 id = 1; - private int id_ ; - /** - * <code>optional uint32 id = 1;</code> - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <code>optional uint32 id = 1;</code> - */ - public int getId() { - return id_; - } - /** - * <code>optional uint32 id = 1;</code> - */ - public Builder setId(int value) { - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 id = 1;</code> - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = 0; - onChanged(); - return this; - } - - // optional uint32 iteration = 2; - private int iteration_ ; - /** - * <code>optional uint32 iteration = 2;</code> - */ - public boolean hasIteration() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional uint32 iteration = 2;</code> - */ - public int getIteration() { - return iteration_; - } - /** - * <code>optional uint32 iteration = 2;</code> - */ - public Builder setIteration(int value) { - bitField0_ |= 0x00000002; - iteration_ = value; - onChanged(); - return this; - } - /** - * <code>optional uint32 iteration = 2;</code> - */ - public Builder clearIteration() { - bitField0_ = (bitField0_ & ~0x00000002); - iteration_ = 0; - onChanged(); - return this; - } - - // optional bytes chainKey = 3; - private com.google.protobuf.ByteString chainKey_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes chainKey = 3;</code> - */ - public boolean hasChainKey() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional bytes chainKey = 3;</code> - */ - public com.google.protobuf.ByteString getChainKey() { - return chainKey_; - } - /** - * <code>optional bytes chainKey = 3;</code> - */ - public Builder setChainKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - chainKey_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes chainKey = 3;</code> - */ - public Builder clearChainKey() { - bitField0_ = (bitField0_ & ~0x00000004); - chainKey_ = getDefaultInstance().getChainKey(); - onChanged(); - return this; - } - - // optional bytes signingKey = 4; - private com.google.protobuf.ByteString signingKey_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes signingKey = 4;</code> - */ - public boolean hasSigningKey() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional bytes signingKey = 4;</code> - */ - public com.google.protobuf.ByteString getSigningKey() { - return signingKey_; - } - /** - * <code>optional bytes signingKey = 4;</code> - */ - public Builder setSigningKey(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - signingKey_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes signingKey = 4;</code> - */ - public Builder clearSigningKey() { - bitField0_ = (bitField0_ & ~0x00000008); - signingKey_ = getDefaultInstance().getSigningKey(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:textsecure.SenderKeyDistributionMessage) - } - - static { - defaultInstance = new SenderKeyDistributionMessage(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:textsecure.SenderKeyDistributionMessage) - } - - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_WhisperMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_WhisperMessage_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_PreKeyWhisperMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_KeyExchangeMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_SenderKeyMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_SenderKeyMessage_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_textsecure_SenderKeyDistributionMessage_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_textsecure_SenderKeyDistributionMessage_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\031WhisperTextProtocol.proto\022\ntextsecure\"" + - "b\n\016WhisperMessage\022\022\n\nratchetKey\030\001 \001(\014\022\017\n" + - "\007counter\030\002 \001(\r\022\027\n\017previousCounter\030\003 \001(\r\022" + - "\022\n\nciphertext\030\004 \001(\014\"\217\001\n\024PreKeyWhisperMes" + - "sage\022\026\n\016registrationId\030\005 \001(\r\022\020\n\010preKeyId" + - "\030\001 \001(\r\022\026\n\016signedPreKeyId\030\006 \001(\r\022\017\n\007baseKe" + - "y\030\002 \001(\014\022\023\n\013identityKey\030\003 \001(\014\022\017\n\007message\030" + - "\004 \001(\014\"t\n\022KeyExchangeMessage\022\n\n\002id\030\001 \001(\r\022" + - "\017\n\007baseKey\030\002 \001(\014\022\022\n\nratchetKey\030\003 \001(\014\022\023\n\013" + - "identityKey\030\004 \001(\014\022\030\n\020baseKeySignature\030\005 ", - "\001(\014\"E\n\020SenderKeyMessage\022\n\n\002id\030\001 \001(\r\022\021\n\ti" + - "teration\030\002 \001(\r\022\022\n\nciphertext\030\003 \001(\014\"c\n\034Se" + - "nderKeyDistributionMessage\022\n\n\002id\030\001 \001(\r\022\021" + - "\n\titeration\030\002 \001(\r\022\020\n\010chainKey\030\003 \001(\014\022\022\n\ns" + - "igningKey\030\004 \001(\014B7\n&org.whispersystems.li" + - "baxolotl.protocolB\rWhisperProtos" - }; - 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_WhisperMessage_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_textsecure_WhisperMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_WhisperMessage_descriptor, - new java.lang.String[] { "RatchetKey", "Counter", "PreviousCounter", "Ciphertext", }); - internal_static_textsecure_PreKeyWhisperMessage_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_textsecure_PreKeyWhisperMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_PreKeyWhisperMessage_descriptor, - new java.lang.String[] { "RegistrationId", "PreKeyId", "SignedPreKeyId", "BaseKey", "IdentityKey", "Message", }); - internal_static_textsecure_KeyExchangeMessage_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_textsecure_KeyExchangeMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_KeyExchangeMessage_descriptor, - new java.lang.String[] { "Id", "BaseKey", "RatchetKey", "IdentityKey", "BaseKeySignature", }); - internal_static_textsecure_SenderKeyMessage_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_textsecure_SenderKeyMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_SenderKeyMessage_descriptor, - new java.lang.String[] { "Id", "Iteration", "Ciphertext", }); - internal_static_textsecure_SenderKeyDistributionMessage_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_textsecure_SenderKeyDistributionMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_textsecure_SenderKeyDistributionMessage_descriptor, - new java.lang.String[] { "Id", "Iteration", "ChainKey", "SigningKey", }); - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - } - - // @@protoc_insertion_point(outer_class_scope) -} |