org.tranche.security
Class Signature

java.lang.Object
  extended by org.tranche.security.Signature
All Implemented Interfaces:
java.io.Serializable

public class Signature
extends java.lang.Object
implements java.io.Serializable

Abstracts the absolute minimum required for a signature. This is what the Signature interface should require, but the initial code had that funky 'getEncoding()' concept.

Author:
Jayson Falkner - jfalkner@umich.edu, James "Augie" Hill - augie@umich.edu
See Also:
Serialized Form

Constructor Summary
Signature(byte[] bytes)
           
Signature(byte[] sig, java.lang.String algorithm, java.security.cert.X509Certificate cert)
           
Signature(java.io.InputStream in)
           
 
Method Summary
 void deserialize(java.io.InputStream in)
           
 boolean equals(java.lang.Object o)
          A custom equals() method for use by the hash algorithms.
 java.lang.String getAlgorithm()
           
 byte[] getBytes()
           
 java.security.cert.X509Certificate getCert()
           
 java.lang.String getUserName()
           
 int hashCode()
          The custom hash code.
 void serialize(java.io.OutputStream out)
           
 byte[] toByteArray()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Signature

public Signature(byte[] sig,
                 java.lang.String algorithm,
                 java.security.cert.X509Certificate cert)
Parameters:
sig - the signature's bytes received
algorithm - the signature's algorithm received
cert - the signature's certificate received

Signature

public Signature(java.io.InputStream in)
          throws java.io.IOException,
                 java.security.GeneralSecurityException
Parameters:
in -
Throws:
java.io.IOException
java.security.GeneralSecurityException

Signature

public Signature(byte[] bytes)
          throws java.io.IOException,
                 java.security.GeneralSecurityException
Parameters:
bytes -
Throws:
java.io.IOException
java.security.GeneralSecurityException
Method Detail

getBytes

public byte[] getBytes()
Returns:
the signature's bytes

getAlgorithm

public java.lang.String getAlgorithm()
Returns:
the signature's algorithm

getCert

public java.security.cert.X509Certificate getCert()
Returns:
the signature's certificate

getUserName

public java.lang.String getUserName()
Returns:

toByteArray

public byte[] toByteArray()
                   throws java.io.IOException,
                          java.security.cert.CertificateEncodingException
Returns:
Throws:
java.io.IOException
java.security.cert.CertificateEncodingException

serialize

public void serialize(java.io.OutputStream out)
               throws java.io.IOException,
                      java.security.cert.CertificateEncodingException
Parameters:
out -
Throws:
java.io.IOException
java.security.cert.CertificateEncodingException

deserialize

public void deserialize(java.io.InputStream in)
                 throws java.io.IOException,
                        java.security.GeneralSecurityException
Parameters:
in -
Throws:
java.io.IOException
java.security.GeneralSecurityException

equals

public boolean equals(java.lang.Object o)

A custom equals() method for use by the hash algorithms.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object compared to this signature object.
Returns:
true if the object is equal to this signature object; false otherwise

hashCode

public int hashCode()

The custom hash code.

Overrides:
hashCode in class java.lang.Object
Returns:
the custom hash code


This code is free for use both commercially and non-commercially as stated in the project's license