com.threerings.presents.net
Class AESAuthRequest

java.lang.Object
  extended by com.threerings.io.SimpleStreamableObject
      extended by com.threerings.presents.net.Message
          extended by com.threerings.presents.net.UpstreamMessage
              extended by com.threerings.presents.net.AuthRequest
                  extended by com.threerings.presents.net.AESAuthRequest
All Implemented Interfaces:
Streamable

public class AESAuthRequest
extends AuthRequest

Sends an AES encrypted auth request to the server. It assumes that SecureUtil.ciphersSupported(java.security.PrivateKey) has succeeded.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
protected  Credentials _clearCreds
          Our unencrypted credentials.
protected  byte[] _contents
          Our encrypted contents.
protected  byte[] _key
          Our encryption key.
 
Fields inherited from class com.threerings.presents.net.AuthRequest
_bootGroups, _creds, _version, _zone
 
Fields inherited from class com.threerings.presents.net.UpstreamMessage
_nextMessageId, messageId
 
Fields inherited from class com.threerings.presents.net.Message
received
 
Constructor Summary
AESAuthRequest()
          Zero argument constructor used when unserializing an instance.
AESAuthRequest(byte[] key, Credentials creds, String version, String[] bootGroups)
          Constructs a auth request with the supplied credentials and client version information.
 
Method Summary
static AuthRequest createAuthRequest(Credentials creds, String version, String[] bootGroups, boolean requireSecureAuth)
          Creates an auth request, secured if able, unsecured if not.
static AuthRequest createAuthRequest(Credentials creds, String version, String[] bootGroups, boolean requireSecureAuth, PublicKeyCredentials pkcreds, SecureResponse resp)
          Creates an auth request, secured if able, unsecured if not.
 void decrypt(byte[] key)
          Decrypts the request after transmission.
 Credentials getCredentials()
          Returns a reference to the credentials provided with this request.
 byte[] getSecret()
          Returns a shared secret key used for sending encrypted data to the client.
 void readObject(ObjectInputStream in)
          Read in our encrypted contents.
 String toString()
           
 void writeObject(ObjectOutputStream out)
          A customized AES encrypting write object.
 
Methods inherited from class com.threerings.presents.net.AuthRequest
getBootGroups, getTimeZone, getVersion
 
Methods inherited from class com.threerings.presents.net.UpstreamMessage
nextMessageId
 
Methods inherited from class com.threerings.presents.net.Message
getTransport, noteActualTransport, setTransport
 
Methods inherited from class com.threerings.io.SimpleStreamableObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_key

protected transient byte[] _key
Our encryption key.


_contents

protected transient byte[] _contents
Our encrypted contents.


_clearCreds

protected transient Credentials _clearCreds
Our unencrypted credentials.

Constructor Detail

AESAuthRequest

public AESAuthRequest()
Zero argument constructor used when unserializing an instance.


AESAuthRequest

public AESAuthRequest(byte[] key,
                      Credentials creds,
                      String version,
                      String[] bootGroups)
Constructs a auth request with the supplied credentials and client version information.

Method Detail

createAuthRequest

public static AuthRequest createAuthRequest(Credentials creds,
                                            String version,
                                            String[] bootGroups,
                                            boolean requireSecureAuth)
Creates an auth request, secured if able, unsecured if not.


createAuthRequest

public static AuthRequest createAuthRequest(Credentials creds,
                                            String version,
                                            String[] bootGroups,
                                            boolean requireSecureAuth,
                                            PublicKeyCredentials pkcreds,
                                            SecureResponse resp)
Creates an auth request, secured if able, unsecured if not.


getCredentials

public Credentials getCredentials()
Description copied from class: AuthRequest
Returns a reference to the credentials provided with this request.

Overrides:
getCredentials in class AuthRequest

getSecret

public byte[] getSecret()
Description copied from class: AuthRequest
Returns a shared secret key used for sending encrypted data to the client.

Overrides:
getSecret in class AuthRequest

toString

public String toString()
Overrides:
toString in class AuthRequest

decrypt

public void decrypt(byte[] key)
             throws IOException,
                    ClassNotFoundException
Decrypts the request after transmission.

Throws:
IOException
ClassNotFoundException

writeObject

public void writeObject(ObjectOutputStream out)
                 throws IOException
A customized AES encrypting write object.

Throws:
IOException

readObject

public void readObject(ObjectInputStream in)
                throws IOException,
                       ClassNotFoundException
Read in our encrypted contents.

Overrides:
readObject in class AuthRequest
Throws:
IOException
ClassNotFoundException