com.motorola.iden.provider
Class DH

java.lang.Object
  |
  +--com.motorola.iden.crypto.KeyAgreementSpi
        |
        +--com.motorola.iden.provider.DH

public class DH
extends KeyAgreementSpi

Implement Diffie-Hellman KeyAgreement Algorithm.

MOTOROLA and the Stylized M Logo are registered trademarks of Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© Copyright 2002 - 2004 Motorola, Inc. All Rights Reserved.

See Also:
[CipherSpi]

Constructor Summary
DH()
           
 
Method Summary
protected  Key engineDoPhase(Key key, boolean lastPhase)
          Executes the next phase of this key agreement with the given key that was received from one of the other parties involved in this key agreement.
protected  byte[] engineGenerateSecret()
          Generates the shared secret and returns it in a new buffer.
protected  void engineInit(Key key, AlgorithmParameterSpec params)
          Initializes this key agreement with the given key, set of algorithm parameters, and source of randomness.
protected  void finalize()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DH

public DH()
Method Detail

engineInit

protected final void engineInit(Key key,
                                AlgorithmParameterSpec params)
                         throws InvalidKeyException,
                                InvalidAlgorithmParameterException
Initializes this key agreement with the given key, set of algorithm parameters, and source of randomness.
Overrides:
engineInit in class KeyAgreementSpi
Parameters:
key - the party's private information. For example, in the case of the Diffie-Hellman key agreement, this would be the party's own Diffie-Hellman private key.
params - the key agreement parameters
Throws:
InvalidKeyException - if the given key is inappropriate for this key agreement, e.g., is of the wrong type or has an incompatible algorithm type.
InvalidAlgorithmParameterException - if the given parameters are inappropriate for this key agreement.

engineDoPhase

protected final Key engineDoPhase(Key key,
                                  boolean lastPhase)
                           throws InvalidKeyException
Executes the next phase of this key agreement with the given key that was received from one of the other parties involved in this key agreement.
Overrides:
engineDoPhase in class KeyAgreementSpi
Parameters:
key - the key for this phase. For example, in the case of Diffie-Hellman between 2 parties, this would be the other party's Diffie-Hellman public key.
lastPhase - flag which indicates whether or not this is the last phase of this key agreement.
Returns:
the (intermediate) key resulting from this phase, or null if this phase does not yield a key
Throws:
InvalidKeyException - if the given key is inappropriate for this phase.

engineGenerateSecret

protected final byte[] engineGenerateSecret()
Generates the shared secret and returns it in a new buffer.

This method resets this KeyAgreementSpi object, so that it can be reused for further key agreements. Unless this key agreement is reinitialized with one of the engineInit methods, the same private information and algorithm parameters will be used for subsequent key agreements.

Overrides:
engineGenerateSecret in class KeyAgreementSpi
Returns:
the new buffer with the shared secret

finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object