Class MapleAESOFB

java.lang.Object
tools.MapleAESOFB

public class MapleAESOFB extends Object
Provides a class for encrypting MapleStory packets with AES OFB encryption.
Since:
Revision 320
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapleAESOFB(byte[] iv, short mapleVersion)
    Class constructor - Creates an instance of the MapleStory encryption cipher.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    checkPacket(byte[] packet)
    Check the packet to make sure it has a header.
    boolean
    checkPacket(int packetHeader)
    Check the header for validity.
    byte[]
    crypt(byte[] data)
    Encrypts data and generates a new IV.
    static final void
    funnyShit(byte inputByte, byte[] in)
    Does funny stuff.
    byte[]
    For debugging/testing purposes only.
    static byte[]
    getNewIv(byte[] oldIv)
    Gets a new IV from oldIv
    byte[]
    getPacketHeader(int length)
    Generates a packet header for a packet that is length long.
    static int
    getPacketLength(int packetHeader)
    Gets the packet length from a header.
    Returns the IV of this instance as a string.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MapleAESOFB

      public MapleAESOFB(byte[] iv, short mapleVersion)
      Class constructor - Creates an instance of the MapleStory encryption cipher.
      Parameters:
      iv - The 4-byte IV to use.
  • Method Details

    • getIv

      public byte[] getIv()
      For debugging/testing purposes only.
      Returns:
      The IV.
    • crypt

      public byte[] crypt(byte[] data)
      Encrypts data and generates a new IV.
      Parameters:
      data - The bytes to encrypt.
      Returns:
      The encrypted bytes.
    • getPacketHeader

      public byte[] getPacketHeader(int length)
      Generates a packet header for a packet that is length long.
      Parameters:
      length - How long the packet that this header is for is.
      Returns:
      The header.
    • getPacketLength

      public static int getPacketLength(int packetHeader)
      Gets the packet length from a header.
      Parameters:
      packetHeader - The header as an integer.
      Returns:
      The length of the packet.
    • checkPacket

      public boolean checkPacket(byte[] packet)
      Check the packet to make sure it has a header.
      Parameters:
      packet - The packet to check.
      Returns:
      True if the packet has a correct header, false otherwise.
    • checkPacket

      public boolean checkPacket(int packetHeader)
      Check the header for validity.
      Parameters:
      packetHeader - The packet header to check.
      Returns:
      True if the header is correct, false otherwise.
    • getNewIv

      public static byte[] getNewIv(byte[] oldIv)
      Gets a new IV from oldIv
      Parameters:
      oldIv - The old IV to get a new IV from.
      Returns:
      The new IV.
    • toString

      public String toString()
      Returns the IV of this instance as a string.
      Overrides:
      toString in class Object
    • funnyShit

      public static final void funnyShit(byte inputByte, byte[] in)
      Does funny stuff. this.OldIV must not equal in Modifies in and returns it for convenience.
      Parameters:
      inputByte - The byte to apply the funny stuff to.
      in - Something needed for all this to occur.