Package org.apache.http.impl.auth
Class NTLMEngineImpl.NTLMMessage
- java.lang.Object
-
- org.apache.http.impl.auth.NTLMEngineImpl.NTLMMessage
-
- Direct Known Subclasses:
NTLMEngineImpl.Type1Message,NTLMEngineImpl.Type2Message,NTLMEngineImpl.Type3Message
- Enclosing class:
- NTLMEngineImpl
static class NTLMEngineImpl.NTLMMessage extends java.lang.ObjectNTLM message generation, base class
-
-
Field Summary
Fields Modifier and Type Field Description protected intcurrentOutputPositionThe current output positionprotected byte[]messageContentsThe current response
-
Constructor Summary
Constructors Constructor Description NTLMMessage()Constructor to use when message contents are not yet knownNTLMMessage(byte[] message, int expectedType)Constructor to use when message bytes are knownNTLMMessage(java.lang.String messageBody, int expectedType)Constructor taking a string
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddByte(byte b)Adds the given byte to the response.protected voidaddBytes(byte[] bytes)Adds the given bytes to the response.protected voidaddULong(int value)Adds a ULong to the responseprotected voidaddUShort(int value)Adds a USHORT to the responseprotected voidbuildMessage()byte[]getBytes()protected intgetMessageLength()Get the message lengthprotected intgetPreambleLength()Get the length of the signature and flags, so calculations can adjust offsets accordingly.java.lang.StringgetResponse()Returns the response that has been generated after shrinking the array if required and base64 encodes the response.protected voidprepareResponse(int maxlength, int messageType)Prepares the object to create a response of the given length.protected bytereadByte(int position)Read a byte from a position within the message bufferprotected voidreadBytes(byte[] buffer, int position)Read a bunch of bytes from a position in the message bufferprotected byte[]readSecurityBuffer(int position)Read a security buffer from a position within the message bufferprotected intreadULong(int position)Read a ulong from a position within the message bufferprotected intreadUShort(int position)Read a ushort from a position within the message buffer
-
-
-
Constructor Detail
-
NTLMMessage
NTLMMessage()
Constructor to use when message contents are not yet known
-
NTLMMessage
NTLMMessage(java.lang.String messageBody, int expectedType) throws NTLMEngineExceptionConstructor taking a string- Throws:
NTLMEngineException
-
NTLMMessage
NTLMMessage(byte[] message, int expectedType) throws NTLMEngineExceptionConstructor to use when message bytes are known- Throws:
NTLMEngineException
-
-
Method Detail
-
getPreambleLength
protected int getPreambleLength()
Get the length of the signature and flags, so calculations can adjust offsets accordingly.
-
getMessageLength
protected int getMessageLength()
Get the message length
-
readByte
protected byte readByte(int position) throws NTLMEngineExceptionRead a byte from a position within the message buffer- Throws:
NTLMEngineException
-
readBytes
protected void readBytes(byte[] buffer, int position) throws NTLMEngineExceptionRead a bunch of bytes from a position in the message buffer- Throws:
NTLMEngineException
-
readUShort
protected int readUShort(int position) throws NTLMEngineExceptionRead a ushort from a position within the message buffer- Throws:
NTLMEngineException
-
readULong
protected int readULong(int position) throws NTLMEngineExceptionRead a ulong from a position within the message buffer- Throws:
NTLMEngineException
-
readSecurityBuffer
protected byte[] readSecurityBuffer(int position) throws NTLMEngineExceptionRead a security buffer from a position within the message buffer- Throws:
NTLMEngineException
-
prepareResponse
protected void prepareResponse(int maxlength, int messageType)Prepares the object to create a response of the given length.- Parameters:
maxlength- the maximum length of the response to prepare, including the type and the signature (which this method adds).
-
addByte
protected void addByte(byte b)
Adds the given byte to the response.- Parameters:
b- the byte to add.
-
addBytes
protected void addBytes(byte[] bytes)
Adds the given bytes to the response.- Parameters:
bytes- the bytes to add.
-
addUShort
protected void addUShort(int value)
Adds a USHORT to the response
-
addULong
protected void addULong(int value)
Adds a ULong to the response
-
getResponse
public java.lang.String getResponse()
Returns the response that has been generated after shrinking the array if required and base64 encodes the response.- Returns:
- The response as above.
-
getBytes
public byte[] getBytes()
-
buildMessage
protected void buildMessage()
-
-