de.upb.swtpra05.group03.crypto
Class AliceCrypto

java.lang.Object
  extended byde.upb.swtpra05.group03.crypto.Crypto
      extended byde.upb.swtpra05.group03.crypto.AliceCrypto
Direct Known Subclasses:
CompanyCrypto

public class AliceCrypto
extends Crypto

crypto class used for the 'alice' role known from DiffieHellman example

Version:
$Revision: 1.3 $

Field Summary
private  javax.crypto.KeyAgreement keyAgree
          object used for the key agreement
private static boolean SKIP_PARAM_GENERATION
          use pregenerated modulus and base
private static java.math.BigInteger skip1024Base
          The base used with the SKIP 1024 bit modulus
private static java.math.BigInteger skip1024Modulus
          The SKIP 1024 bit modulus
private static byte[] skip1024ModulusBytes
          The 1024 bit Diffie-Hellman modulus values used by SKIP
 
Fields inherited from class de.upb.swtpra05.group03.crypto.Crypto
AGREEMENT_ALGORITHM, CIPHER_ALGORITHM, KEY_ALGORITHM, pubKeyFactory, SIGNATURE_ALGORITHM, signer, state, STATE_INIT, STATE_READY, STATE_WAITING, verifyer
 
Constructor Summary
AliceCrypto()
          Constructor
 
Method Summary
 DataSigPair generatePublicKey()
          generates a public key for the key agreement
 void generateSecretKey(DataSigPair dsp)
          generates the secret key by using the others public key for the key agreement
 
Methods inherited from class de.upb.swtpra05.group03.crypto.Crypto
decryptObject, encryptObject, genPublicKeyFromX509, getSecretKey, isReady, loadSigningKeys, reset, setSecretKey, setSecretKey, sign, verify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SKIP_PARAM_GENERATION

private static final boolean SKIP_PARAM_GENERATION
use pregenerated modulus and base

See Also:
Constant Field Values

keyAgree

private final javax.crypto.KeyAgreement keyAgree
object used for the key agreement


skip1024ModulusBytes

private static final byte[] skip1024ModulusBytes
The 1024 bit Diffie-Hellman modulus values used by SKIP


skip1024Modulus

private static final java.math.BigInteger skip1024Modulus
The SKIP 1024 bit modulus


skip1024Base

private static final java.math.BigInteger skip1024Base
The base used with the SKIP 1024 bit modulus

Constructor Detail

AliceCrypto

public AliceCrypto()
            throws java.security.NoSuchAlgorithmException,
                   javax.crypto.NoSuchPaddingException
Constructor

Throws:
javax.crypto.NoSuchPaddingException
java.security.NoSuchAlgorithmException
Method Detail

generatePublicKey

public DataSigPair generatePublicKey()
                              throws java.security.NoSuchAlgorithmException,
                                     java.security.InvalidAlgorithmParameterException,
                                     java.security.InvalidKeyException,
                                     java.security.SignatureException,
                                     java.security.spec.InvalidParameterSpecException
generates a public key for the key agreement

Returns:
two dim bytearray containing public key and signature
Throws:
java.security.NoSuchAlgorithmException
java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyException
java.security.SignatureException
java.security.spec.InvalidParameterSpecException

generateSecretKey

public void generateSecretKey(DataSigPair dsp)
                       throws java.security.SignatureException,
                              java.security.NoSuchAlgorithmException,
                              java.security.spec.InvalidKeySpecException,
                              java.security.InvalidKeyException,
                              java.lang.IllegalStateException
generates the secret key by using the others public key for the key agreement

Parameters:
dsp - object containing key and signature
Throws:
java.security.SignatureException
java.security.NoSuchAlgorithmException
java.security.spec.InvalidKeySpecException
java.lang.IllegalStateException
java.security.InvalidKeyException