summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java')
-rw-r--r--src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
index a5fef69..ccd813e 100644
--- a/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
+++ b/src/main/java/org/openslx/imagemaster/serversession/ServerAuthenticator.java
@@ -51,7 +51,8 @@ public class ServerAuthenticator
String address, ByteBuffer challengeResponse )
throws AuthenticationException, TException
{
- byte[] bytes = challengeResponse.array();
+ byte[] bytes = new byte[ 512 ];
+ challengeResponse.get( bytes );
boolean result = false;
@@ -59,18 +60,18 @@ public class ServerAuthenticator
try {
verifier = new AsymMessageVerifier( organization );
} catch ( Exception e ) {
- throw new ServerAuthenticationException(ServerAuthenticationError.INVALID_ORGANIZATION, "Organization not found.");
+ throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_ORGANIZATION, "Organization not found." );
}
-
+
try {
result = verifier.verifyMessage( bytes, authenticatingServers.get( organization ).getBytes() );
} catch ( Exception e ) {
log.error( "Error while verifying message", e );
- throw new ServerAuthenticationException(ServerAuthenticationError.INVALID_KEY, "Could not verfiy key.");
+ throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_KEY, "Could not verfiy key." );
}
if ( !result ) {
- throw new ServerAuthenticationException(ServerAuthenticationError.INVALID_KEY, "Could not verfiy key.");
+ throw new ServerAuthenticationException( ServerAuthenticationError.INVALID_KEY, "Could not verfiy key." );
}
log.info( "Server of organinzation '" + organization + " authenticated." );