|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.caplin.keymaster.keygenerator.KeyGenerator
public class KeyGenerator
KeyGenerator creates a set of keys, one private, one public and another version of
the public key in DER (binary) format.
The DER key is used by Caplin Liberator to authenticate the user. The private key is used by
StandardKeyMaster
to generate a token for a request made by a user.
This class uses the external library bcprov-jdk14-125.jar to provide some security functionality.
This is one of the entry point classes for the package. The class expects two arguments.
Property | Example | Description |
---|---|---|
key.generator.private.key.store.filename | 'privatekey.store' | The name of the file that the private key will be stored in. |
key.generator.public.key.store.filename | 'publickey.store' | The name of the file that the public key will be stored in. |
key.generator.public.key.der.filename | 'publickey.der' | The name of the DER formatted public key. The file should end in '.der'. |
key.generator.key.size | '1024' | The size of the generated key. Both keys use this size. |
key.generator.security.provider.class.name | 'org.bouncycastle.jce.provider.BouncyCastleProvider' | The name of the encryption package. Need to have a JAR or similar to match the package. |
key.generator.security.provider.name | 'BC' | The name of the security provider that the key will be produced with. |
key.generator.Level | 'FINEST' | Specifies the level of logging required. @see java.util.logging.Level |
key.generator.FilenameAttribute | 'log.txt' | Specifies the name of the file to log messages to. The file is NOT appended. File is created relative to the users current location, unless a path is specified as well (e.g. ../log.txt). |
Constructor Summary | |
---|---|
KeyGenerator(String propsFilename,
String serverName)
This constructor initialises the class variables to the properties specified in the properties file. |
Method Summary | |
---|---|
KeyPair |
generate()
Generates a pair of keys using the KeyPairGenerator method generateKeyPair. |
static void |
main(String[] args)
Creates an instance of the KeyGenerator class and generates the three keys. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyGenerator(String propsFilename, String serverName) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchAlgorithmException, NoSuchProviderException
This constructor initialises the class variables to the properties specified in the properties file.
propsFilename
- String containing the location of the properties file.serverName
- String specifying the name of the server to create the keys for.
IOException
- Thrown by FileInputStream
ClassNotFoundException
- thrown by internal method
IllegalAccessException
- thrown by internal method
InstantiationException
- thrown by internal method
NoSuchAlgorithmException
- thrown by internal method
NoSuchProviderException
- thrown by internal methodMethod Detail |
---|
public KeyPair generate()
Generates a pair of keys using the KeyPairGenerator method generateKeyPair.
KeyPairGenerator
public static void main(String[] args) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, NoSuchAlgorithmException, NoSuchProviderException
Creates an instance of the KeyGenerator class and generates the three keys.
args
- Two expected. The name of the properties file and the server name.
IOException
- thrown by KeyGenerator constructor
ClassNotFoundException
- thrown by KeyGenerator constructor
IllegalAccessException
- thrown by KeyGenerator constructor
InstantiationException
- thrown by KeyGenerator constructor
NoSuchAlgorithmException
- thrown by KeyGenerator constructor
NoSuchProviderException
- thrown by KeyGenerator constructor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |