Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
dbird committed Jan 13, 2011
1 parent 5d5a122 commit c25b628
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/net/jradius/packet/RadiusResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public RadiusResponse(int id, AttributeList list)
*/
public boolean verifyAuthenticator(byte[] requestAuthenticator, String sharedSecret)
{
ByteBuffer buffer = ByteBuffer.allocate(1500);
ByteBuffer buffer = ByteBuffer.allocate(4096);
RadiusFormat.getInstance().packAttributeList(getAttributes(), buffer, true);
byte[] hash = RadiusUtils.makeRFC2865ResponseAuthenticator(sharedSecret,
(byte)(getCode() & 0xff), (byte)(getIdentifier() & 0xff),
Expand All @@ -68,7 +68,7 @@ public boolean verifyAuthenticator(byte[] requestAuthenticator, String sharedSec

public void generateAuthenticator(byte[] requestAuthenticator, String sharedSecret)
{
ByteBuffer buffer = ByteBuffer.allocate(1500);
ByteBuffer buffer = ByteBuffer.allocate(4096);
RadiusFormat.getInstance().packAttributeList(getAttributes(), buffer, true);
setAuthenticator(RadiusUtils.makeRFC2865ResponseAuthenticator( sharedSecret,
(byte)(getCode() & 0xff), (byte)(getIdentifier() & 0xff),
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/java/net/jradius/util/MessageAuthenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class MessageAuthenticator
public static void generateRequestMessageAuthenticator(RadiusPacket request, String sharedSecret) throws IOException
{
byte[] hash = new byte[16];
ByteBuffer buffer = ByteBuffer.allocate(1500);
ByteBuffer buffer = ByteBuffer.allocate(4096);
request.overwriteAttribute(AttributeFactory.newAttribute(AttributeDictionary.MESSAGE_AUTHENTICATOR, hash));
format.packPacket(request, sharedSecret, buffer, true);
System.arraycopy(MD5.hmac_md5(buffer.array(), 0, buffer.position(), sharedSecret.getBytes()), 0, hash, 0, 16);
Expand All @@ -28,7 +28,7 @@ public static void generateResponseMessageAuthenticator(RadiusPacket request, Ra
byte[] hash = new byte[16];
byte[] requestAuth = request.getAuthenticator();
byte[] replyAuth = reply.getAuthenticator();
ByteBuffer buffer = ByteBuffer.allocate(1500);
ByteBuffer buffer = ByteBuffer.allocate(4096);
reply.setAuthenticator(requestAuth);
reply.overwriteAttribute(AttributeFactory.newAttribute(AttributeDictionary.MESSAGE_AUTHENTICATOR, hash));
format.packPacket(reply, sharedSecret, buffer, true);
Expand All @@ -39,7 +39,7 @@ public static void generateResponseMessageAuthenticator(RadiusPacket request, Ra
public static Boolean verifyRequest(RadiusPacket request, String sharedSecret) throws IOException
{
byte[] hash = new byte[16];
ByteBuffer buffer = ByteBuffer.allocate(1500);
ByteBuffer buffer = ByteBuffer.allocate(4096);

RadiusAttribute attr = request.findAttribute(AttributeDictionary.MESSAGE_AUTHENTICATOR);
if (attr == null) return null;
Expand All @@ -60,7 +60,7 @@ public static Boolean verifyReply(byte[] requestAuth, RadiusPacket reply, String
byte[] replyAuth = reply.getAuthenticator();
byte[] hash = new byte[16];

ByteBuffer buffer = ByteBuffer.allocate(1500);
ByteBuffer buffer = ByteBuffer.allocate(4096);

RadiusAttribute attr = reply.findAttribute(AttributeDictionary.MESSAGE_AUTHENTICATOR);
if (attr == null) return null;
Expand Down

0 comments on commit c25b628

Please sign in to comment.