mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2025-07-01 04:46:25 +00:00
First commit: Just a collection of library sources from Github. Compiles, but doesn't work.
This commit is contained in:
73
src/org/telegram/mtproto/tl/pq/ClientDhInner.java
Normal file
73
src/org/telegram/mtproto/tl/pq/ClientDhInner.java
Normal file
@ -0,0 +1,73 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 7:32
|
||||
*/
|
||||
public class ClientDhInner extends TLObject {
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected long retryId;
|
||||
protected byte[] gb;
|
||||
|
||||
public static final int CLASS_ID = 0x6643b654;
|
||||
|
||||
public ClientDhInner(byte[] nonce, byte[] serverNonce, long retryId, byte[] gb) {
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.retryId = retryId;
|
||||
this.gb = gb;
|
||||
}
|
||||
|
||||
public ClientDhInner() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public long getRetryId() {
|
||||
return retryId;
|
||||
}
|
||||
|
||||
public byte[] getGb() {
|
||||
return gb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeLong(retryId, stream);
|
||||
writeTLBytes(gb, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
retryId = readLong(stream);
|
||||
gb = readTLBytes(stream);
|
||||
}
|
||||
}
|
28
src/org/telegram/mtproto/tl/pq/DhGenFailure.java
Normal file
28
src/org/telegram/mtproto/tl/pq/DhGenFailure.java
Normal file
@ -0,0 +1,28 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 7:20
|
||||
*/
|
||||
public class DhGenFailure extends DhGenResult {
|
||||
public static final int CLASS_ID = 0xa69dae02;
|
||||
|
||||
public DhGenFailure(byte[] nonce, byte[] serverNonce, byte[] newNonceHash) {
|
||||
super(nonce, serverNonce, newNonceHash);
|
||||
}
|
||||
|
||||
public DhGenFailure() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "dh_gen_fail#a69dae02";
|
||||
}
|
||||
}
|
36
src/org/telegram/mtproto/tl/pq/DhGenOk.java
Normal file
36
src/org/telegram/mtproto/tl/pq/DhGenOk.java
Normal file
@ -0,0 +1,36 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 7:20
|
||||
*/
|
||||
public class DhGenOk extends DhGenResult {
|
||||
public static final int CLASS_ID = 0x3bcbf734;
|
||||
|
||||
public DhGenOk(byte[] nonce, byte[] serverNonce, byte[] newNonceHash) {
|
||||
super(nonce, serverNonce, newNonceHash);
|
||||
}
|
||||
|
||||
public DhGenOk() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "dh_gen_ok#3bcbf734";
|
||||
}
|
||||
}
|
60
src/org/telegram/mtproto/tl/pq/DhGenResult.java
Normal file
60
src/org/telegram/mtproto/tl/pq/DhGenResult.java
Normal file
@ -0,0 +1,60 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.readBytes;
|
||||
import static org.telegram.tl.StreamingUtils.writeByteArray;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 7:19
|
||||
*/
|
||||
public abstract class DhGenResult extends TLObject {
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected byte[] newNonceHash;
|
||||
|
||||
protected DhGenResult(byte[] nonce, byte[] serverNonce, byte[] newNonceHash) {
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.newNonceHash = newNonceHash;
|
||||
}
|
||||
|
||||
|
||||
public DhGenResult() {
|
||||
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public byte[] getNewNonceHash() {
|
||||
return newNonceHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeByteArray(newNonceHash, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
newNonceHash = readBytes(16, stream);
|
||||
}
|
||||
}
|
28
src/org/telegram/mtproto/tl/pq/DhGenRetry.java
Normal file
28
src/org/telegram/mtproto/tl/pq/DhGenRetry.java
Normal file
@ -0,0 +1,28 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 7:20
|
||||
*/
|
||||
public class DhGenRetry extends DhGenResult {
|
||||
public static final int CLASS_ID = 0x46dc1fb9;
|
||||
|
||||
public DhGenRetry(byte[] nonce, byte[] serverNonce, byte[] newNonceHash) {
|
||||
super(nonce, serverNonce, newNonceHash);
|
||||
}
|
||||
|
||||
public DhGenRetry() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "dh_gen_retry#46dc1fb9";
|
||||
}
|
||||
}
|
89
src/org/telegram/mtproto/tl/pq/PQInner.java
Normal file
89
src/org/telegram/mtproto/tl/pq/PQInner.java
Normal file
@ -0,0 +1,89 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 6:20
|
||||
*/
|
||||
public class PQInner extends TLObject {
|
||||
public static final int CLASS_ID = 0x83c95aec;
|
||||
|
||||
protected byte[] pq;
|
||||
protected byte[] p;
|
||||
protected byte[] q;
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected byte[] newNonce;
|
||||
|
||||
public PQInner(byte[] pq, byte[] p, byte[] q, byte[] nonce, byte[] serverNonce, byte[] newNonce) {
|
||||
this.pq = pq;
|
||||
this.p = p;
|
||||
this.q = q;
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.newNonce = newNonce;
|
||||
}
|
||||
|
||||
public PQInner() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
public byte[] getPq() {
|
||||
return pq;
|
||||
}
|
||||
|
||||
public byte[] getP() {
|
||||
return p;
|
||||
}
|
||||
|
||||
public byte[] getQ() {
|
||||
return q;
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public byte[] getNewNonce() {
|
||||
return newNonce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeTLBytes(pq, stream);
|
||||
writeTLBytes(p, stream);
|
||||
writeTLBytes(q, stream);
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeByteArray(newNonce, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
pq = readTLBytes(stream);
|
||||
p = readTLBytes(stream);
|
||||
q = readTLBytes(stream);
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
newNonce = readBytes(32, stream);
|
||||
}
|
||||
}
|
111
src/org/telegram/mtproto/tl/pq/ReqDhParams.java
Normal file
111
src/org/telegram/mtproto/tl/pq/ReqDhParams.java
Normal file
@ -0,0 +1,111 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.DeserializeException;
|
||||
import org.telegram.tl.TLContext;
|
||||
import org.telegram.tl.TLMethod;
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 6:26
|
||||
*/
|
||||
public class ReqDhParams extends TLMethod<ServerDhParams> {
|
||||
|
||||
public static final int CLASS_ID = 0xd712e4be;
|
||||
|
||||
@Override
|
||||
public ServerDhParams deserializeResponse(InputStream stream, TLContext context) throws IOException {
|
||||
TLObject response = context.deserializeMessage(stream);
|
||||
|
||||
if (response == null) {
|
||||
throw new DeserializeException("Unable to deserialize response");
|
||||
}
|
||||
if (!(response instanceof ServerDhParams)) {
|
||||
throw new DeserializeException("Response has incorrect type");
|
||||
}
|
||||
|
||||
return (ServerDhParams) response;
|
||||
}
|
||||
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected byte[] p;
|
||||
protected byte[] q;
|
||||
protected long fingerPrint;
|
||||
protected byte[] encryptedData;
|
||||
|
||||
public ReqDhParams(byte[] nonce, byte[] serverNonce, byte[] p, byte[] q, long fingerPrint, byte[] encryptedData) {
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.p = p;
|
||||
this.q = q;
|
||||
this.fingerPrint = fingerPrint;
|
||||
this.encryptedData = encryptedData;
|
||||
}
|
||||
|
||||
public ReqDhParams() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public byte[] getP() {
|
||||
return p;
|
||||
}
|
||||
|
||||
public byte[] getQ() {
|
||||
return q;
|
||||
}
|
||||
|
||||
public long getFingerPrint() {
|
||||
return fingerPrint;
|
||||
}
|
||||
|
||||
public byte[] getEncryptedData() {
|
||||
return encryptedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeTLBytes(p, stream);
|
||||
writeTLBytes(q, stream);
|
||||
writeLong(fingerPrint, stream);
|
||||
writeTLBytes(encryptedData, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
p = readTLBytes(stream);
|
||||
q = readTLBytes(stream);
|
||||
fingerPrint = readLong(stream);
|
||||
encryptedData = readTLBytes(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "req_DH_params#d712e4be";
|
||||
}
|
||||
}
|
80
src/org/telegram/mtproto/tl/pq/ReqPQ.java
Normal file
80
src/org/telegram/mtproto/tl/pq/ReqPQ.java
Normal file
@ -0,0 +1,80 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
import org.telegram.tl.DeserializeException;
|
||||
import org.telegram.tl.TLContext;
|
||||
import org.telegram.tl.TLMethod;
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 4:17
|
||||
*/
|
||||
public class ReqPQ extends TLMethod<ResPQ> {
|
||||
|
||||
public static final int CLASS_ID = 0x60469778;
|
||||
|
||||
protected byte[] nonce;
|
||||
|
||||
public ReqPQ(byte[] nonce) {
|
||||
if (nonce == null || nonce.length != 16) {
|
||||
throw new IllegalArgumentException("nonce might be not null and 16 bytes length");
|
||||
}
|
||||
this.nonce = nonce;
|
||||
}
|
||||
|
||||
public ReqPQ() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResPQ deserializeResponse(InputStream stream, TLContext context) throws IOException {
|
||||
TLObject response = context.deserializeMessage(stream);
|
||||
if (response == null) {
|
||||
throw new DeserializeException("Unable to deserialize response");
|
||||
}
|
||||
if (!(response instanceof ResPQ)) {
|
||||
throw new DeserializeException("Response has incorrect type");
|
||||
}
|
||||
|
||||
return (ResPQ) response;
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public void setNonce(byte[] nonce) {
|
||||
if (nonce == null || nonce.length != 16) {
|
||||
throw new IllegalArgumentException("nonce might be not null and 16 bytes length");
|
||||
}
|
||||
this.nonce = nonce;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "req_pq#60469778";
|
||||
}
|
||||
}
|
85
src/org/telegram/mtproto/tl/pq/ReqSetDhClientParams.java
Normal file
85
src/org/telegram/mtproto/tl/pq/ReqSetDhClientParams.java
Normal file
@ -0,0 +1,85 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.DeserializeException;
|
||||
import org.telegram.tl.TLContext;
|
||||
import org.telegram.tl.TLMethod;
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 7:31
|
||||
*/
|
||||
public class ReqSetDhClientParams extends TLMethod<DhGenResult> {
|
||||
|
||||
public static final int CLASS_ID = 0xf5045f1f;
|
||||
|
||||
@Override
|
||||
public DhGenResult deserializeResponse(InputStream stream, TLContext context) throws IOException {
|
||||
TLObject response = context.deserializeMessage(stream);
|
||||
if (response == null) {
|
||||
throw new DeserializeException("Unable to deserialize response");
|
||||
}
|
||||
if (!(response instanceof DhGenResult)) {
|
||||
throw new DeserializeException("Response has incorrect type");
|
||||
}
|
||||
return (DhGenResult) response;
|
||||
}
|
||||
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected byte[] encrypted;
|
||||
|
||||
public ReqSetDhClientParams(byte[] nonce, byte[] serverNonce, byte[] encrypted) {
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.encrypted = encrypted;
|
||||
}
|
||||
|
||||
public ReqSetDhClientParams() {
|
||||
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public byte[] getEncrypted() {
|
||||
return encrypted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeTLBytes(encrypted, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
encrypted = readTLBytes(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "set_client_DH_params#f5045f1f";
|
||||
}
|
||||
}
|
95
src/org/telegram/mtproto/tl/pq/ResPQ.java
Normal file
95
src/org/telegram/mtproto/tl/pq/ResPQ.java
Normal file
@ -0,0 +1,95 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
import org.telegram.tl.TLLongVector;
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 5:31
|
||||
*/
|
||||
public class ResPQ extends TLObject {
|
||||
|
||||
public static final int CLASS_ID = 0x05162463;
|
||||
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected byte[] pq;
|
||||
protected TLLongVector fingerprints;
|
||||
|
||||
public ResPQ(byte[] nonce, byte[] serverNonce, byte[] pq, TLLongVector fingerprints) {
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.pq = pq;
|
||||
this.fingerprints = fingerprints;
|
||||
}
|
||||
|
||||
public ResPQ() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public void setNonce(byte[] nonce) {
|
||||
this.nonce = nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public void setServerNonce(byte[] serverNonce) {
|
||||
this.serverNonce = serverNonce;
|
||||
}
|
||||
|
||||
public byte[] getPq() {
|
||||
return pq;
|
||||
}
|
||||
|
||||
public void setPq(byte[] pq) {
|
||||
this.pq = pq;
|
||||
}
|
||||
|
||||
public TLLongVector getFingerprints() {
|
||||
return fingerprints;
|
||||
}
|
||||
|
||||
public void setFingerprints(TLLongVector fingerprints) {
|
||||
this.fingerprints = fingerprints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeTLBytes(pq, stream);
|
||||
writeTLVector(fingerprints, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
pq = readTLBytes(stream);
|
||||
fingerprints = readTLLongVector(stream, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "resPQ#05162463";
|
||||
}
|
||||
}
|
82
src/org/telegram/mtproto/tl/pq/ServerDhFailure.java
Normal file
82
src/org/telegram/mtproto/tl/pq/ServerDhFailure.java
Normal file
@ -0,0 +1,82 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 6:31
|
||||
*/
|
||||
public class ServerDhFailure extends ServerDhParams {
|
||||
|
||||
public static final int CLASS_ID = 0x79cb045d;
|
||||
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected byte[] newNonceHash;
|
||||
|
||||
public ServerDhFailure(byte[] nonce, byte[] serverNonce, byte[] newNonceHash) {
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.newNonceHash = newNonceHash;
|
||||
}
|
||||
|
||||
public ServerDhFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public void setNonce(byte[] nonce) {
|
||||
this.nonce = nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public void setServerNonce(byte[] serverNonce) {
|
||||
this.serverNonce = serverNonce;
|
||||
}
|
||||
|
||||
public byte[] getNewNonceHash() {
|
||||
return newNonceHash;
|
||||
}
|
||||
|
||||
public void setNewNonceHash(byte[] newNonceHash) {
|
||||
this.newNonceHash = newNonceHash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeByteArray(newNonceHash, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
newNonceHash = readBytes(16, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "server_DH_params_fail#79cb045d";
|
||||
}
|
||||
}
|
89
src/org/telegram/mtproto/tl/pq/ServerDhInner.java
Normal file
89
src/org/telegram/mtproto/tl/pq/ServerDhInner.java
Normal file
@ -0,0 +1,89 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 6:56
|
||||
*/
|
||||
public class ServerDhInner extends TLObject {
|
||||
public static final int CLASS_ID = 0xb5890dba;
|
||||
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected int g;
|
||||
protected byte[] dhPrime;
|
||||
protected byte[] g_a;
|
||||
protected int serverTime;
|
||||
|
||||
public ServerDhInner(byte[] nonce, byte[] serverNonce, int g, byte[] dhPrime, byte[] g_a, int serverTime) {
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.g = g;
|
||||
this.dhPrime = dhPrime;
|
||||
this.g_a = g_a;
|
||||
this.serverTime = serverTime;
|
||||
}
|
||||
|
||||
public ServerDhInner() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public int getG() {
|
||||
return g;
|
||||
}
|
||||
|
||||
public byte[] getDhPrime() {
|
||||
return dhPrime;
|
||||
}
|
||||
|
||||
public byte[] getG_a() {
|
||||
return g_a;
|
||||
}
|
||||
|
||||
public int getServerTime() {
|
||||
return serverTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeInt(g, stream);
|
||||
writeTLBytes(dhPrime, stream);
|
||||
writeTLBytes(g_a, stream);
|
||||
writeInt(serverTime, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
g = readInt(stream);
|
||||
dhPrime = readTLBytes(stream);
|
||||
g_a = readTLBytes(stream);
|
||||
serverTime = readInt(stream);
|
||||
}
|
||||
}
|
70
src/org/telegram/mtproto/tl/pq/ServerDhOk.java
Normal file
70
src/org/telegram/mtproto/tl/pq/ServerDhOk.java
Normal file
@ -0,0 +1,70 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static org.telegram.tl.StreamingUtils.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 6:29
|
||||
*/
|
||||
public class ServerDhOk extends ServerDhParams {
|
||||
|
||||
public static final int CLASS_ID = 0xd0e8075c;
|
||||
|
||||
protected byte[] nonce;
|
||||
protected byte[] serverNonce;
|
||||
protected byte[] encryptedAnswer;
|
||||
|
||||
public ServerDhOk(byte[] nonce, byte[] serverNonce, byte[] encryptedAnswer) {
|
||||
this.nonce = nonce;
|
||||
this.serverNonce = serverNonce;
|
||||
this.encryptedAnswer = encryptedAnswer;
|
||||
}
|
||||
|
||||
public ServerDhOk() {
|
||||
|
||||
}
|
||||
|
||||
public byte[] getNonce() {
|
||||
return nonce;
|
||||
}
|
||||
|
||||
public byte[] getServerNonce() {
|
||||
return serverNonce;
|
||||
}
|
||||
|
||||
public byte[] getEncryptedAnswer() {
|
||||
return encryptedAnswer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClassId() {
|
||||
return CLASS_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serializeBody(OutputStream stream) throws IOException {
|
||||
writeByteArray(nonce, stream);
|
||||
writeByteArray(serverNonce, stream);
|
||||
writeTLBytes(encryptedAnswer, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeBody(InputStream stream, TLContext context) throws IOException {
|
||||
nonce = readBytes(16, stream);
|
||||
serverNonce = readBytes(16, stream);
|
||||
encryptedAnswer = readTLBytes(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "server_DH_params_ok#d0e8075c";
|
||||
}
|
||||
}
|
12
src/org/telegram/mtproto/tl/pq/ServerDhParams.java
Normal file
12
src/org/telegram/mtproto/tl/pq/ServerDhParams.java
Normal file
@ -0,0 +1,12 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLObject;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 6:27
|
||||
*/
|
||||
public abstract class ServerDhParams extends TLObject {
|
||||
}
|
26
src/org/telegram/mtproto/tl/pq/TLInitContext.java
Normal file
26
src/org/telegram/mtproto/tl/pq/TLInitContext.java
Normal file
@ -0,0 +1,26 @@
|
||||
package org.telegram.mtproto.tl.pq;
|
||||
|
||||
import org.telegram.tl.TLContext;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: ex3ndr
|
||||
* Date: 03.11.13
|
||||
* Time: 5:29
|
||||
*/
|
||||
public class TLInitContext extends TLContext {
|
||||
@Override
|
||||
protected void init() {
|
||||
registerClass(ReqPQ.CLASS_ID, ReqPQ.class);
|
||||
registerClass(ResPQ.CLASS_ID, ResPQ.class);
|
||||
registerClass(ReqDhParams.CLASS_ID, ReqDhParams.class);
|
||||
registerClass(ServerDhOk.CLASS_ID, ServerDhOk.class);
|
||||
registerClass(ServerDhFailure.CLASS_ID, ServerDhFailure.class);
|
||||
registerClass(ServerDhInner.CLASS_ID, ServerDhInner.class);
|
||||
registerClass(DhGenOk.CLASS_ID, DhGenOk.class);
|
||||
registerClass(DhGenFailure.CLASS_ID, DhGenFailure.class);
|
||||
registerClass(DhGenRetry.CLASS_ID, DhGenRetry.class);
|
||||
registerClass(ReqSetDhClientParams.CLASS_ID, ReqSetDhClientParams.class);
|
||||
registerClass(ClientDhInner.CLASS_ID, ClientDhInner.class);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user