de.upb.swtpra05.group03.crypto
Class SigningKeys

java.lang.Object
  extended byde.upb.swtpra05.group03.crypto.SigningKeys

public class SigningKeys
extends java.lang.Object

helper class to load the signing keys

Version:
$Revision: 1.3 $

Field Summary
protected static int KEY_SIZE
          size of key
protected static java.lang.String KEYGEN_ALGO
          algorithm used for key generation
protected static java.lang.String PATH
          path used for saving the keys
 
Constructor Summary
SigningKeys()
           
 
Method Summary
protected static java.security.KeyPair generateKeyPair()
          generates a keypair
static java.security.Key[] loadKeys(java.lang.String name)
          loads the keys used for signing from a keys file
static void main(java.lang.String[] args)
          creates the keys. only needed for the first time, or to change the keys
protected static void saveKeys(java.lang.String name, java.security.PublicKey pubKey, java.security.PrivateKey secKey)
          saves the keys into a file named ${name}.keys
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH

protected static final java.lang.String PATH
path used for saving the keys

See Also:
Constant Field Values

KEYGEN_ALGO

protected static final java.lang.String KEYGEN_ALGO
algorithm used for key generation

See Also:
Constant Field Values

KEY_SIZE

protected static final int KEY_SIZE
size of key

See Also:
Constant Field Values
Constructor Detail

SigningKeys

public SigningKeys()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.security.NoSuchAlgorithmException,
                        java.io.IOException
creates the keys. only needed for the first time, or to change the keys

Parameters:
args -
Throws:
java.security.NoSuchAlgorithmException
java.io.IOException

generateKeyPair

protected static java.security.KeyPair generateKeyPair()
                                                throws java.security.NoSuchAlgorithmException
generates a keypair

Returns:
keypair
Throws:
java.security.NoSuchAlgorithmException

saveKeys

protected static void saveKeys(java.lang.String name,
                               java.security.PublicKey pubKey,
                               java.security.PrivateKey secKey)
                        throws java.io.IOException
saves the keys into a file named ${name}.keys

Parameters:
name - used for the filename
pubKey -
secKey -
Throws:
java.io.IOException

loadKeys

public static java.security.Key[] loadKeys(java.lang.String name)
                                    throws java.io.IOException,
                                           java.security.NoSuchAlgorithmException,
                                           java.security.spec.InvalidKeySpecException
loads the keys used for signing from a keys file

Parameters:
name - can be shuttle or company(control)
Returns:
public and private key
Throws:
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException