Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.jce.provider.dh
Class DHKeyAgreement  view DHKeyAgreement download DHKeyAgreement.java

java.lang.Object
  extended byjavax.crypto.KeyAgreementSpi
      extended bycryptix.jce.provider.dh.DHKeyAgreement

public final class DHKeyAgreement
extends javax.crypto.KeyAgreementSpi

Diffie-Hellman key agreement, PKCS#3 style.


Field Summary
private  java.math.BigInteger masterSecret
          Our master secret.
private  int masterSecretLen
           
private  java.math.BigInteger privG
          Private key components.
private  java.math.BigInteger privP
          Private key components.
private  java.math.BigInteger privX
          Private key components.
private  int state
          Current state.
private static int STATE_COMPLETE
          Constants for state machine.
private static int STATE_NEED_PUB_KEY
          Constants for state machine.
private static int STATE_UNINITIALIZED
          Constants for state machine.
private static java.math.BigInteger ZERO
          BigInteger constants.
 
Constructor Summary
DHKeyAgreement()
          Constructor for use by javax.crypto.KeyAgreement only.
 
Method Summary
protected  java.security.Key engineDoPhase(java.security.Key key, boolean lastPhase)
          This
protected  byte[] engineGenerateSecret()
          Generate the shared secret in a new byte array.
protected  int engineGenerateSecret(byte[] sharedSecret, int offset)
          Generate the shared secret, storing it into the specified array.
protected  javax.crypto.SecretKey engineGenerateSecret(java.lang.String algorithm)
          Generate the shared secret and return it as a javax.crypto.SecretKey.
protected  void engineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
          Not yet implemented.
protected  void engineInit(java.security.Key key, java.security.SecureRandom unused)
          Initialize the KeyAgreement with private value x (wrapped in a DHPrivateKey.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

privG

private java.math.BigInteger privG
Private key components.


privP

private java.math.BigInteger privP
Private key components.


privX

private java.math.BigInteger privX
Private key components.


masterSecret

private java.math.BigInteger masterSecret
Our master secret. Under construction during STATE_NEED_PUB_KEY, final if STATE_COMPLETE.


masterSecretLen

private int masterSecretLen

STATE_UNINITIALIZED

private static final int STATE_UNINITIALIZED
Constants for state machine.

See Also:
Constant Field Values

STATE_NEED_PUB_KEY

private static final int STATE_NEED_PUB_KEY
Constants for state machine.

See Also:
Constant Field Values

STATE_COMPLETE

private static final int STATE_COMPLETE
Constants for state machine.

See Also:
Constant Field Values

state

private int state
Current state.


ZERO

private static final java.math.BigInteger ZERO
BigInteger constants.

Constructor Detail

DHKeyAgreement

public DHKeyAgreement()
Constructor for use by javax.crypto.KeyAgreement only.

Method Detail

engineInit

protected void engineInit(java.security.Key key,
                          java.security.SecureRandom unused)
                   throws java.security.InvalidKeyException
Initialize the KeyAgreement with private value x (wrapped in a DHPrivateKey.


engineInit

protected void engineInit(java.security.Key key,
                          java.security.spec.AlgorithmParameterSpec params,
                          java.security.SecureRandom random)
                   throws java.security.InvalidKeyException,
                          java.security.InvalidAlgorithmParameterException
Not yet implemented.


engineDoPhase

protected java.security.Key engineDoPhase(java.security.Key key,
                                          boolean lastPhase)
                                   throws java.security.InvalidKeyException,
                                          java.lang.IllegalStateException
This


engineGenerateSecret

protected byte[] engineGenerateSecret()
                               throws java.lang.IllegalStateException
Description copied from class: javax.crypto.KeyAgreementSpi
Generate the shared secret in a new byte array.


engineGenerateSecret

protected int engineGenerateSecret(byte[] sharedSecret,
                                   int offset)
                            throws java.lang.IllegalStateException,
                                   javax.crypto.ShortBufferException
Description copied from class: javax.crypto.KeyAgreementSpi
Generate the shared secret, storing it into the specified array.


engineGenerateSecret

protected javax.crypto.SecretKey engineGenerateSecret(java.lang.String algorithm)
                                               throws java.lang.IllegalStateException,
                                                      java.security.NoSuchAlgorithmException,
                                                      java.security.InvalidKeyException
Description copied from class: javax.crypto.KeyAgreementSpi
Generate the shared secret and return it as a javax.crypto.SecretKey.