com.dyuproject.openid
Class DiffieHellmanAssociation

java.lang.Object
  extended by com.dyuproject.openid.DiffieHellmanAssociation
All Implemented Interfaces:
Association

public final class DiffieHellmanAssociation
extends Object
implements Association

Association using DiffieHellman session - which allows two parties that have no prior knowledge of each other to jointly establish a shared secret key over an insecure communications channel.

Author:
David Yu
Date created:
Sep 8, 2008

Field Summary
 
Fields inherited from interface com.dyuproject.openid.Association
ASSOC_HMAC_SHA1, ASSOC_HMAC_SHA256, SESSION_DH_SHA1, SESSION_DH_SHA256, SESSION_NO_ENCRYPTION
 
Constructor Summary
DiffieHellmanAssociation()
           
DiffieHellmanAssociation(SessionType type)
           
 
Method Summary
 boolean associate(OpenIdUser user, OpenIdContext context)
          Associates the user with his openid provider and stores the association data for future verification.
 SessionType getSessionAssociationType()
          Gets the session type of this association.
static void parseInputByLineSeparator(BufferedReader br, char keyValueSeparator, Map<String,Object> parseMap)
          Parses the key/value pair of each line separated by the given char keyValueSeparator.
 boolean verifyAuth(OpenIdUser user, Map<String,String> authRedirect, OpenIdContext context)
          Verifies the authentication response by validating against the previous association data stored from Association.associate(OpenIdUser, OpenIdContext)
static byte[] xor(BigInteger sharedSecretKey, byte[] encMacKey, String digestType)
          Digest the given sharedSecretKey into a byte array and performx xor of each single byte against the given encMacKey.
static byte[] xor(byte[] sharedSecret, byte[] encMacKey)
          Performs xor of each single byte of the 2 byte arrays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiffieHellmanAssociation

public DiffieHellmanAssociation()

DiffieHellmanAssociation

public DiffieHellmanAssociation(SessionType type)
Method Detail

getSessionAssociationType

public SessionType getSessionAssociationType()
Gets the session type of this association.


associate

public boolean associate(OpenIdUser user,
                         OpenIdContext context)
                  throws Exception
Description copied from interface: Association
Associates the user with his openid provider and stores the association data for future verification.

Specified by:
associate in interface Association
Throws:
Exception

verifyAuth

public boolean verifyAuth(OpenIdUser user,
                          Map<String,String> authRedirect,
                          OpenIdContext context)
                   throws Exception
Description copied from interface: Association
Verifies the authentication response by validating against the previous association data stored from Association.associate(OpenIdUser, OpenIdContext)

Specified by:
verifyAuth in interface Association
Throws:
Exception

xor

public static byte[] xor(BigInteger sharedSecretKey,
                         byte[] encMacKey,
                         String digestType)
                  throws Exception
Digest the given sharedSecretKey into a byte array and performx xor of each single byte against the given encMacKey.

Throws:
Exception

xor

public static byte[] xor(byte[] sharedSecret,
                         byte[] encMacKey)
                  throws Exception
Performs xor of each single byte of the 2 byte arrays.

Throws:
IllegalStateException - if the 2 byte arrays are not the same size.
Exception

parseInputByLineSeparator

public static void parseInputByLineSeparator(BufferedReader br,
                                             char keyValueSeparator,
                                             Map<String,Object> parseMap)
                                      throws IOException
Parses the key/value pair of each line separated by the given char keyValueSeparator.

Throws:
IOException


Copyright © 2008-2013. All Rights Reserved.