org.tranche.users
Class MakeUserZipFileTool

java.lang.Object
  extended by org.tranche.users.MakeUserZipFileTool

public class MakeUserZipFileTool
extends java.lang.Object

This is a helper class that makes user files, i.e. X.509 certificates and assocated private keys. The information is saved in a password protected ZIP file.

Author:
Jayson Falkner - jfalkner@umich.edu, James "Augie" Hill - augman85@gmail.com

Constructor Summary
MakeUserZipFileTool()
           
 
Method Summary
 java.lang.String getName()
          Returns the CN value that will be used on the X.509 certificate.
 java.lang.String getPassphrase()
          Returns the passphrase that was used when AES 256 bit encrypting the file.
 java.io.File getSaveFile()
          Returns a File object representing the file on the local disk that contains the user information.
 java.security.cert.X509Certificate getSignerCertificate()
          Gets the signer's certificates.
 java.security.PrivateKey getSignerPrivateKey()
          Gets the signer's private key.
 long getValidDays()
          Returns the number of days that the user's X.509 certificate should be considered valid.
static void main(java.lang.String[] args)
           
 UserZipFile makeCertificate()
          Executes the creation of the UserZipFile.
 void setName(java.lang.String name)
          Sets the CN value that will be used for the X.509 certificate.
 void setPassphrase(java.lang.String passphrase)
          Sets the passphrase to use for AES 256 bit encryption.
 void setSaveFile(java.io.File saveFile)
          A method to get the file that the user zip file will be saved to.
 void setSignerCertificate(java.security.cert.X509Certificate signerCertificate)
          Sets the signer's certificate.
 void setSignerPrivateKey(java.security.PrivateKey signerPrivateKey)
          Sets the signer's private key.
 void setValidDays(java.util.Date startDate, long validDays)
          Sets the number of days that ther user's X.509 certificate should be considered valid.
 void setValidDays(long validDays)
          Sets the number of days that ther user's X.509 certificate should be considered valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MakeUserZipFileTool

public MakeUserZipFileTool()
Method Detail

makeCertificate

public UserZipFile makeCertificate()
                            throws java.lang.NullPointerException,
                                   java.security.NoSuchAlgorithmException,
                                   java.security.NoSuchProviderException,
                                   java.security.SignatureException,
                                   java.security.InvalidKeyException

Executes the creation of the UserZipFile.

Returns:
Throws:
java.lang.NullPointerException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException
java.security.InvalidKeyException

getName

public java.lang.String getName()

Returns the CN value that will be used on the X.509 certificate.

Returns:
The value that will be used for the CN value of the X.509 certificate.

setName

public void setName(java.lang.String name)

Sets the CN value that will be used for the X.509 certificate.

Parameters:
name - The CN value to use for the X.509 certificate.

getValidDays

public long getValidDays()

Returns the number of days that the user's X.509 certificate should be considered valid.

Returns:
The number of days that the user's X.509 certificate should be considered valid.

setValidDays

public void setValidDays(long validDays)

Sets the number of days that ther user's X.509 certificate should be considered valid.

Parameters:
validDays - The number of days that ther user's X.509 certificate should be considered valid.

setValidDays

public void setValidDays(java.util.Date startDate,
                         long validDays)

Sets the number of days that ther user's X.509 certificate should be considered valid.

Parameters:
startDate - The date the X.509 certificate begins being considered valid.
validDays - The number of days that ther user's X.509 certificate should be considered valid.

getPassphrase

public java.lang.String getPassphrase()

Returns the passphrase that was used when AES 256 bit encrypting the file.

Returns:
The passphrase that was used when AES 256 bit encrypting the file.

setPassphrase

public void setPassphrase(java.lang.String passphrase)

Sets the passphrase to use for AES 256 bit encryption.

Parameters:
passphrase - The passphrase to use for AES 256 bit encryption.

getSaveFile

public java.io.File getSaveFile()

Returns a File object representing the file on the local disk that contains the user information. This file is normally a ZIP archive that has been AES 256 bit encrypted.

Returns:
A File object that represents the file that contains the user's information.

setSaveFile

public void setSaveFile(java.io.File saveFile)

A method to get the file that the user zip file will be saved to. This can be any file on the local filesystem.

Parameters:
saveFile -

getSignerCertificate

public java.security.cert.X509Certificate getSignerCertificate()

Gets the signer's certificates.

Returns:

setSignerCertificate

public void setSignerCertificate(java.security.cert.X509Certificate signerCertificate)

Sets the signer's certificate.

Parameters:
signerCertificate -

getSignerPrivateKey

public java.security.PrivateKey getSignerPrivateKey()

Gets the signer's private key.

Returns:

setSignerPrivateKey

public void setSignerPrivateKey(java.security.PrivateKey signerPrivateKey)

Sets the signer's private key.

Parameters:
signerPrivateKey -

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Parameters:
args -
Throws:
java.lang.Exception


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