net.sf.typekey4j
Class TypeKey4J

java.lang.Object
  extended bynet.sf.typekey4j.TypeKey4J

public class TypeKey4J
extends java.lang.Object

TypeKey4J handles TypeKey authentication in Java

To use:
     TypeKey4J typeKey4J = new TypeKey4J();
     typeKey4J.setProxyConfiguration(someProxyHost, someProxyPort); // If applicable
     typeKey4J.retrieveTypekeyDSAKey();
     boolean verified = typeKey4J.verify(version, email, name, nick, ts, sig, token);
 

Version:
$Id: $
Author:
David Czarnecki

Constructor Summary
TypeKey4J()
          TypeKey4J constructor
 
Method Summary
 java.util.Date getLastKeyRetrieval()
          Retrieve the date/time of the last DSA public key retrieval from TypeKey
 void retrieveTypekeyDSAKey()
          Retrieve the TypeKey DSA public key
 void setProxyConfiguration(java.lang.String proxyHost, int proxyPort)
          Set proxy information for use in a firewall environment
 boolean verify(java.lang.String version, java.lang.String email, java.lang.String name, java.lang.String nick, java.lang.String ts, java.lang.String sig, java.lang.String token)
          Verify TypeKey authentication information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeKey4J

public TypeKey4J()
TypeKey4J constructor

Method Detail

setProxyConfiguration

public void setProxyConfiguration(java.lang.String proxyHost,
                                  int proxyPort)
Set proxy information for use in a firewall environment

Parameters:
proxyHost - Proxy host
proxyPort - Proxy port

retrieveTypekeyDSAKey

public void retrieveTypekeyDSAKey()
Retrieve the TypeKey DSA public key


getLastKeyRetrieval

public java.util.Date getLastKeyRetrieval()
Retrieve the date/time of the last DSA public key retrieval from TypeKey

Returns:
Date/time of the last DSA public key retrieval from TypeKey

verify

public boolean verify(java.lang.String version,
                      java.lang.String email,
                      java.lang.String name,
                      java.lang.String nick,
                      java.lang.String ts,
                      java.lang.String sig,
                      java.lang.String token)
Verify TypeKey authentication information

Parameters:
version - TypeKey version; typically will always be 1.1
email - The user's email address. If the user chose not to pass an email address, this field will contain the SHA1 hash [1] of the string "mailto:<email>"
name - This field supplies the user's unique login name
nick - The user's "display name": the name by which the user wants to be known publicly
ts - This is the timestamp when the signature was generated, expressed as seconds since the epoch (1970-01-01 00:00:00 UTC)
sig - The DSA signature of the string formed by concatenating the following values, separated by double-colons: <email>::<name>::<nick>::<ts>::<site-token>
token - TypeKey token
Returns:
true if signature verified, false otherwise or if fault occurred