Class MapleAESOFB
java.lang.Object
tools.MapleAESOFB
Provides a class for encrypting MapleStory packets with AES OFB encryption.
- Since:
- Revision 320
-
Constructor Summary
ConstructorsConstructorDescriptionMapleAESOFB(byte[] iv, short mapleVersion) Class constructor - Creates an instance of the MapleStory encryption cipher. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckPacket(byte[] packet) Check the packet to make sure it has a header.booleancheckPacket(int packetHeader) Check the header for validity.byte[]crypt(byte[] data) Encryptsdataand generates a new IV.static final voidfunnyShit(byte inputByte, byte[] in) Does funny stuff.byte[]getIv()For debugging/testing purposes only.static byte[]getNewIv(byte[] oldIv) Gets a new IV fromoldIvbyte[]getPacketHeader(int length) Generates a packet header for a packet that islengthlong.static intgetPacketLength(int packetHeader) Gets the packet length from a header.toString()Returns the IV of this instance as a string.
-
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) Encryptsdataand 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 islengthlong.- 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:
Trueif the packet has a correct header,falseotherwise.
-
checkPacket
public boolean checkPacket(int packetHeader) Check the header for validity.- Parameters:
packetHeader- The packet header to check.- Returns:
Trueif the header is correct,falseotherwise.
-
getNewIv
public static byte[] getNewIv(byte[] oldIv) Gets a new IV fromoldIv- Parameters:
oldIv- The old IV to get a new IV from.- Returns:
- The new IV.
-
toString
-
funnyShit
public static final void funnyShit(byte inputByte, byte[] in) Does funny stuff.this.OldIVmust not equalinModifiesinand returns it for convenience.- Parameters:
inputByte- The byte to apply the funny stuff to.in- Something needed for all this to occur.
-