Thread: Encrypted id !=10

Results 1 to 7 of 7
  1. #1 Encrypted id !=10 
    Let the good times roll
    Eazy's Avatar
    Join Date
    Jun 2012
    Age
    27
    Posts
    1,234
    Thanks given
    90
    Thanks received
    223
    Rep Power
    70
    What the hell that means? I've never had this problem.

    When I try to log in the game, it won't log in and spams "Encrypted id !=10" to my cmd.

    I've today coding just some shit to my server, just server side things but suddenly got this problem?

    What is this? Does someone know how to fix?




    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Nov 2012
    Posts
    447
    Thanks given
    26
    Thanks received
    35
    Rep Power
    14
    Quote Originally Posted by Eazy View Post
    What the hell that means? I've never had this problem.

    When I try to log in the game, it won't log in and spams "Encrypted id !=10" to my cmd.

    I've today coding just some shit to my server, just server side things but suddenly got this problem?

    What is this? Does someone know how to fix?
    Basically, this is RSA. or UID. go to stream.java and repalce ur Dokeys with this.
    This might not work. if you go to the server files and go to rs2logindecoder and copy the RSA keys to match the keys in stream. it shud work

    public void doKeys() {
    int i = currentOffset;
    currentOffset = 0;
    byte abyte0[] = new byte[i];
    readBytes(i, 0, abyte0);
    BigInteger biginteger2 = new BigInteger(abyte0);
    BigInteger biginteger3 = biginteger2/* .modPow(biginteger, biginteger1) */;
    byte abyte1[] = biginteger3.toByteArray();
    currentOffset = 0;
    writeWordBigEndian(abyte1.length);
    writeBytes(abyte1, abyte1.length, 0);
    }
    Project is finally released, Come try it out @ Optimize-OS.
    Spoiler for Optimize-OS:
    http://www.rune-server.org/runescape-development/rs2-server/advertise/617031-optimize-os-spawn-pking-dont-let-your-enemy-escape-beginning.html
    Reply With Quote  
     

  3. #3  


    Major's Avatar
    Join Date
    Jan 2011
    Posts
    2,997
    Thanks given
    1,293
    Thanks received
    3,556
    Rep Power
    5000
    RSA @Josh
    Reply With Quote  
     

  4. #4  
    Let the good times roll
    Eazy's Avatar
    Join Date
    Jun 2012
    Age
    27
    Posts
    1,234
    Thanks given
    90
    Thanks received
    223
    Rep Power
    70
    Quote Originally Posted by JoshS View Post
    Basically, this is RSA. or UID. go to stream.java and repalce ur Dokeys with this.
    This might not work. if you go to the server files and go to rs2logindecoder and copy the RSA keys to match the keys in stream. it shud work

    public void doKeys() {
    int i = currentOffset;
    currentOffset = 0;
    byte abyte0[] = new byte[i];
    readBytes(i, 0, abyte0);
    BigInteger biginteger2 = new BigInteger(abyte0);
    BigInteger biginteger3 = biginteger2/* .modPow(biginteger, biginteger1) */;
    byte abyte1[] = biginteger3.toByteArray();
    currentOffset = 0;
    writeWordBigEndian(abyte1.length);
    writeBytes(abyte1, abyte1.length, 0);
    }
    I did that what you said. Now it says "Zero or negative login size"

    And the server is working on my laptop.




    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jul 2012
    Posts
    149
    Thanks given
    33
    Thanks received
    6
    Rep Power
    11
    Search != 10 in your server files and see what is causing it.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Nov 2012
    Posts
    447
    Thanks given
    26
    Thanks received
    35
    Rep Power
    14
    Quote Originally Posted by Eazy View Post
    I did that what you said. Now it says "Zero or negative login size"

    And the server is working on my laptop.

    It's now server sided, go to rs2logindecoder, get rid of all the RSA stuff in there and it will work. If you show me ur rs2logindecoder.java, i would be more than happy to do it for you..


    Quote Originally Posted by Major View Post
    RSA @Josh
    Thanks

    Quote Originally Posted by dustey View Post
    Search != 10 in your server files and see what is causing it.
    What kind of help is this.. LMAOO.
    Project is finally released, Come try it out @ Optimize-OS.
    Spoiler for Optimize-OS:
    http://www.rune-server.org/runescape-development/rs2-server/advertise/617031-optimize-os-spawn-pking-dont-let-your-enemy-escape-beginning.html
    Reply With Quote  
     

  7. #7  
    Let the good times roll
    Eazy's Avatar
    Join Date
    Jun 2012
    Age
    27
    Posts
    1,234
    Thanks given
    90
    Thanks received
    223
    Rep Power
    70
    Quote Originally Posted by JoshS View Post
    It's now server sided, go to rs2logindecoder, get rid of all the RSA stuff in there and it will work. If you show me ur rs2logindecoder.java, i would be more than happy to do it for you..




    Thanks



    What kind of help is this.. LMAOO.


    Well, it's here

    Code:
    package core.net;
    
    import java.math.BigInteger;
    
    import org.apache.mina.common.ByteBuffer;
    import org.apache.mina.common.IoFuture;
    import org.apache.mina.common.IoFutureListener;
    import org.apache.mina.common.IoSession;
    import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
    import org.apache.mina.filter.codec.ProtocolCodecFilter;
    import org.apache.mina.filter.codec.ProtocolDecoderOutput;
    
    import core.util.Misc;
    import server.Config;
    import server.Connection;
    import server.Server;
    import server.game.players.Client;
    import server.game.players.PlayerHandler;
    import server.game.players.PlayerSave;
    import core.util.ISAACRandomGen;
    
    /**
     * Login protocol decoder.
     * @author Graham
     * @author Ryan / Lmctruck30 <- login Protocol fixes
     *
     */
    public class RS2LoginProtocolDecoder extends CumulativeProtocolDecoder {
    	
    	public static String UUID;
    	
    	private static final BigInteger RSA_MODULUS = new BigInteger("101467499287200742817649405922164909988164301625901260020658852646131670022028559083001929177369584175077254128294081688150565750878258821501012982850989307778588081384005191934029208432706885756975112054154693846025564206904362178973747767458289064792352686749994567331952188500032716594907961714216359226451");
    
    	private static final BigInteger RSA_EXPONENT = new BigInteger("65537");
    
    	/**
    	 * Parses the data in the provided byte buffer and writes it to
    	 * <code>out</code> as a <code>Packet</code>.
    	 *
    	 * @param session The IoSession the data was read from
    	 * @param in	  The buffer
    	 * @param out	 The decoder output stream to which to write the <code>Packet</code>
    	 * @return Whether enough data was available to create a packet
    	 */
    	@Override
    	public boolean doDecode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) {
    			synchronized(session) {
    				Object loginStageObj = session.getAttribute("LOGIN_STAGE");
    				int loginStage = 0;
    				if(loginStageObj != null) {
    					loginStage = (Integer)loginStageObj;
    				}
    				//Logger.log("recv login packet, stage: "+loginStage);
    				switch(loginStage) {
    				case 0:
    					if(2 <= in.remaining()) {
    						int protocol = in.get() & 0xff;
    						@SuppressWarnings("unused")
    						int nameHash = in.get() & 0xff;
    						if(protocol == 14) {
    							long serverSessionKey = ((long) (java.lang.Math.random() * 99999999D) << 32) + (long) (java.lang.Math.random() * 99999999D);
    						    StaticPacketBuilder s1Response = new StaticPacketBuilder();
    						    s1Response.setBare(true).addBytes(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }).addByte((byte) 0).addLong(serverSessionKey);
    						    session.setAttribute("SERVER_SESSION_KEY", serverSessionKey);
    						    session.write(s1Response.toPacket());
    						    session.setAttribute("LOGIN_STAGE", 1);
    						}
    						return true;
    					} else {
    						in.rewind();
    						return false;
    					}
    				case 1:
    					@SuppressWarnings("unused")
    					int loginType = -1, loginPacketSize = -1, loginEncryptPacketSize = -1;
    					if(2 <= in.remaining()) {
    						loginType = in.get() & 0xff; //should be 16 or 18
    						loginPacketSize = in.get() & 0xff;
    						loginEncryptPacketSize = loginPacketSize-(36+1+1+2);
    						if(loginPacketSize <= 0 || loginEncryptPacketSize <= 0) {
    							System.out.println("Zero or negative login size.");
    							session.close();
    							return false;
    						}
    					} else {
    						in.rewind();
    						return false;
    					}
    					if(loginPacketSize <= in.remaining()) {
    						int magic = in.get() & 0xff;
    						int version = in.getUnsignedShort();
    						if(magic != 255) {
    							//System.out.println("Wrong magic id.");
    							session.close();
    							return false;
    						}
    						if(version != 1) {
    							//Dont Add Anything
    						}
    						@SuppressWarnings("unused")
    						int lowMem = in.get() & 0xff;
    						for(int i = 0; i < 9; i++) {
    							in.getInt();
    						}
    						loginEncryptPacketSize--;
    						if(loginEncryptPacketSize != (in.get() & 0xff)) {
    							System.out.println("Encrypted size mismatch.");
    							session.close();
    							return false;
    						}
                            byte[] encryptionBytes = new byte[loginEncryptPacketSize];
                            in.get(encryptionBytes);
                            ByteBuffer rsaBuffer = ByteBuffer.wrap(new BigInteger(encryptionBytes)
                                    .modPow(RSA_EXPONENT, RSA_MODULUS).toByteArray());
    						if((rsaBuffer.get() & 0xff) != 10) {
    							System.out.println("Encrypted id != 10.");
    							session.close();
    							return false;
    						}
    						long clientSessionKey = rsaBuffer.getLong();
    						long serverSessionKey = rsaBuffer.getLong();
    						int uid = rsaBuffer.getInt();
    						
    						if(uid == 34124 || uid == 935086) {
    							session.close();
    							return false;
    						}
    						UUID = readRS2String(rsaBuffer);
    						String name = readRS2String(rsaBuffer);
    						String pass = readRS2String(rsaBuffer);
    						int sessionKey[] = new int[4];
    						sessionKey[0] = (int)(clientSessionKey >> 32);
    						sessionKey[1] = (int)clientSessionKey;
    						sessionKey[2] = (int)(serverSessionKey >> 32);
    						sessionKey[3] = (int)serverSessionKey;
    						ISAACRandomGen inC = new ISAACRandomGen(sessionKey);
    						for(int i = 0; i < 4; i++) sessionKey[i] += 50;
    						ISAACRandomGen outC = new ISAACRandomGen(sessionKey);
    						load(session, uid, name, pass, inC, outC, version, UUID);
    						// WorkerThread.load(session, name, pass, inC, outC);
    						session.getFilterChain().remove("protocolFilter");
    						session.getFilterChain().addLast("protocolFilter", new ProtocolCodecFilter(new GameCodecFactory(inC)));
    						return true;
    					} else {
    						in.rewind();
    						return false;
    					}
    				}
    			}
    		return false;
    	}
    
    	private synchronized void load(final IoSession session, final int uid, String name, String pass, final ISAACRandomGen inC, ISAACRandomGen outC, int version, String UUID) {
    		session.setAttribute("opcode", -1);
    		session.setAttribute("size", -1);
    		int loginDelay = 1;
    		int returnCode = 2;
    		
    		name = name.trim();
    		name = name.toLowerCase();
    		pass = pass.toLowerCase();
    		
    		if(!name.matches("[A-Za-z0-9 ]+")) {
    			returnCode = 4;
    		}
    		
    		if(name.length() > 12) {
    			returnCode = 8;
    		}
    		
    		Client cl = new Client(session, -1);
    		//cl.playerName = name;
    		cl.playerName = Misc.optimizeText(name);
    		cl.playerName2 = cl.playerName;
    		cl.playerPass = pass;
    		cl.setInStreamDecryption(inC);
    		cl.setOutStreamDecryption(outC);
    		cl.outStream.packetEncryption = outC;
    				
    		cl.saveCharacter = false;
    		
    		char first = name.charAt(0);
    		cl.properName = Character.toUpperCase(first)+ name.substring(1, name.length());
    		
    		if(Connection.isNamedBanned(cl.playerName)) {
    			returnCode = 4;
    		}
    		
    		if(Connection.isUidBanned(UUID)) {
    			returnCode = 22;
    		}
    		
    		if(PlayerHandler.isPlayerOn(name)) {
    			returnCode = 5;
    		}
    		
    		//if(Config.CLIENT_VERSION != version) {
    			//returnCode = 6;
    		//}
    		
    		if(PlayerHandler.playerCount >= Config.MAX_PLAYERS) {
    			returnCode = 7;
    		}
    		
    //		Login Limit Exceeded
    //		if() {
    //			returnCode = 9;
    //		}
    		
    		if(Server.UpdateServer) {
    			returnCode = 14;
    		}
    		
    //		if(Connection.checkLoginList(loginIp)) {
    //			returnCode = 16;
    //		}
    		
    //		Just Left World Login Delay Included
    //		if() {
    //			returnCode = 21;
    //		}
    		
    		if(returnCode == 2) {
    			int load = PlayerSave.loadGame(cl, cl.playerName, cl.playerPass);
    			if (load == 0)
    				cl.addStarter = true;
    			if(load == 3) {
    				returnCode = 3;
    				cl.saveFile = false;
    			} else {
    				for(int i = 0; i < cl.playerEquipment.length; i++) {
    					if(cl.playerEquipment[i] == 0) {
    						cl.playerEquipment[i] = -1;
    						cl.playerEquipmentN[i] = 0;
    					}
    				}
    				if(!Server.playerHandler.newPlayerClient(cl)) {
    					returnCode = 7;
    					cl.saveFile = false;
    				} else {
    					cl.saveFile = true;
    				}
    			}
    		}
    		
    		cl.packetType = -1;
    		cl.packetSize = 0;
    		
    		StaticPacketBuilder bldr = new StaticPacketBuilder();
    		bldr.setBare(true);
    		bldr.addByte((byte) returnCode);
    		if(returnCode == 2) {
    			cl.saveCharacter = true;
    			if(cl.playerRights == 3) {
    				bldr.addByte((byte) 2);
    			} else {
    				bldr.addByte((byte) cl.playerRights);
    			}
    			//cl.playerServer = "riotscape.no-ip.info";
    		} else if(returnCode == 21) {
    			bldr.addByte((byte) loginDelay);
    		} else {
    			bldr.addByte((byte) 0);
    		}
    		cl.isActive = true;
    		bldr.addByte((byte) 0);
    		Packet pkt = bldr.toPacket();
    		@SuppressWarnings("unused")
    		final Client fcl = cl;
    		session.setAttachment(cl);
    		session.write(pkt).addListener(new IoFutureListener() {
    			@Override
    			public void operationComplete(IoFuture arg0) {
    				session.getFilterChain().remove("protocolFilter");
    				session.getFilterChain().addFirst("protocolFilter", new ProtocolCodecFilter(new GameCodecFactory(inC)));				
    			}
    		});
    	}
    
    	private synchronized String readRS2String(ByteBuffer in) {
    		StringBuilder sb = new StringBuilder();
    		byte b;
    		while((b = in.get()) != 10) {
    			sb.append((char) b);
    		}
    		return sb.toString();
    	}
    
    
    
    	/**
    	 * Releases the buffer used by the given session.
    	 *
    	 * @param session The session for which to release the buffer
    	 * @throws Exception if failed to dispose all resources
    	 */
    	@Override
    	public void dispose(IoSession session) throws Exception {
    		super.dispose(session);
    	}
    
    }




    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Encrypted id != 10 Error.
    By GodComplex2 in forum Help
    Replies: 6
    Last Post: 01-08-2014, 10:55 PM
  2. encrypted id 10...
    By Chilly in forum Help
    Replies: 5
    Last Post: 02-19-2013, 12:54 AM
  3. Encrypted id !=10 Help needed
    By Heyt in forum Help
    Replies: 2
    Last Post: 09-24-2012, 03:41 AM
  4. Encrypted id != 10. adding rsa
    By Newell in forum Help
    Replies: 4
    Last Post: 08-17-2012, 11:19 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •