/** * Reads an int from 4 bytes of the given array at offset 0. * * @param b the byte array to read * @param offset the offset at which to start * @return the int value */ public static int makeIntFromByte4(byte[] b) { return makeIntFromByte4(b, 0); }
/** * Reads an int from 4 bytes of the given array at offset 0. * * @param b the byte array to read * @return the integer value */ public static final int makeIntFromByte4(byte[] b) { return makeIntFromByte4(b, 0); }
/** * Reads an int from 4 bytes of the given array at offset 0. * * @param b the byte array to read * @return the integer value */ public static final int makeIntFromByte4(byte[] b) { return makeIntFromByte4(b, 0); }
/** * Extracts the NTLM flags from the type 2 message. * * @param msg the type 2 message byte array * @return the proxy flags as an int */ public static final int extractFlagsFromType2Message(byte[] msg) { byte[] flagsBytes = new byte[4]; System.arraycopy(msg, 20, flagsBytes, 0, 4); ByteUtilities.changeWordEndianess(flagsBytes, 0, 4); return ByteUtilities.makeIntFromByte4(flagsBytes); }
/** * Extracts the NTLM flags from the type 2 message. * * @param msg the type 2 message byte array * @return the proxy flags as an int */ public static final int extractFlagsFromType2Message(byte[] msg) { byte[] flagsBytes = new byte[4]; System.arraycopy(msg, 20, flagsBytes, 0, 4); ByteUtilities.changeWordEndianess(flagsBytes, 0, 4); return ByteUtilities.makeIntFromByte4(flagsBytes); }
/** * Extracts the NTLM flags from the type 2 message. * * @param msg the type 2 message byte array * @return the proxy flags as an int */ public static int extractFlagsFromType2Message(byte[] msg) { byte[] flagsBytes = new byte[4]; System.arraycopy(msg, 20, flagsBytes, 0, 4); ByteUtilities.changeWordEndianess(flagsBytes, 0, 4); return ByteUtilities.makeIntFromByte4(flagsBytes); }
/** * Reads the byte array described by the security buffer stored at the * <code>securityBufferOffset</code> offset. * * @param msg the message where to read the security buffer and it's value * @param securityBufferOffset the offset at which to read the security buffer * @return a new byte array holding the data pointed by the security buffer */ public static final byte[] readSecurityBufferTarget(byte[] msg, int securityBufferOffset) { byte[] securityBuffer = new byte[8]; System.arraycopy(msg, securityBufferOffset, securityBuffer, 0, 8); ByteUtilities.changeWordEndianess(securityBuffer, 0, 8); int length = ByteUtilities.makeIntFromByte2(securityBuffer); int offset = ByteUtilities.makeIntFromByte4(securityBuffer, 4); byte[] secBufValue = new byte[length]; System.arraycopy(msg, offset, secBufValue, 0, length); return secBufValue; }
/** * Reads the byte array described by the security buffer stored at the * <code>securityBufferOffset</code> offset. * * @param msg the message where to read the security buffer and it's value * @param securityBufferOffset the offset at which to read the security buffer * @return a new byte array holding the data pointed by the security buffer */ public static final byte[] readSecurityBufferTarget(byte[] msg, int securityBufferOffset) { byte[] securityBuffer = new byte[8]; System.arraycopy(msg, securityBufferOffset, securityBuffer, 0, 8); ByteUtilities.changeWordEndianess(securityBuffer, 0, 8); int length = ByteUtilities.makeIntFromByte2(securityBuffer); int offset = ByteUtilities.makeIntFromByte4(securityBuffer, 4); byte[] secBufValue = new byte[length]; System.arraycopy(msg, offset, secBufValue, 0, length); return secBufValue; }
/** * Reads the byte array described by the security buffer stored at the * <code>securityBufferOffset</code> offset. * * @param msg the message where to read the security buffer and it's value * @param securityBufferOffset the offset at which to read the security buffer * @return a new byte array holding the data pointed by the security buffer */ public static byte[] readSecurityBufferTarget( byte[] msg, int securityBufferOffset) { byte[] securityBuffer = new byte[8]; System.arraycopy(msg, securityBufferOffset, securityBuffer, 0, 8); ByteUtilities.changeWordEndianess(securityBuffer, 0, 8); int length = ByteUtilities.makeIntFromByte2(securityBuffer); int offset = ByteUtilities.makeIntFromByte4(securityBuffer, 4); byte[] secBufValue = new byte[length]; System.arraycopy(msg, offset, secBufValue, 0, length); return secBufValue; }