jdk/src/share/classes/com/sun/crypto/provider/DHKeyAgreement.java
changeset 16080 0e6266b88242
parent 12201 d77ed23f4992
child 17916 e02ddef88f77
equal deleted inserted replaced
16079:7252530399e2 16080:0e6266b88242
    39 import javax.crypto.KeyAgreementSpi;
    39 import javax.crypto.KeyAgreementSpi;
    40 import javax.crypto.ShortBufferException;
    40 import javax.crypto.ShortBufferException;
    41 import javax.crypto.SecretKey;
    41 import javax.crypto.SecretKey;
    42 import javax.crypto.spec.*;
    42 import javax.crypto.spec.*;
    43 
    43 
       
    44 import sun.security.util.KeyUtil;
       
    45 
    44 /**
    46 /**
    45  * This class implements the Diffie-Hellman key agreement protocol between
    47  * This class implements the Diffie-Hellman key agreement protocol between
    46  * any number of parties.
    48  * any number of parties.
    47  *
    49  *
    48  * @author Jan Luehe
    50  * @author Jan Luehe
   197             throw new InvalidKeyException("Incompatible parameters");
   199             throw new InvalidKeyException("Incompatible parameters");
   198         }
   200         }
   199         if (pub_g != null && !(init_g.equals(pub_g))) {
   201         if (pub_g != null && !(init_g.equals(pub_g))) {
   200             throw new InvalidKeyException("Incompatible parameters");
   202             throw new InvalidKeyException("Incompatible parameters");
   201         }
   203         }
       
   204 
       
   205         // validate the Diffie-Hellman public key
       
   206         KeyUtil.validate(dhPubKey);
   202 
   207 
   203         // store the y value
   208         // store the y value
   204         this.y = dhPubKey.getY();
   209         this.y = dhPubKey.getY();
   205 
   210 
   206         // we've received a public key (from one of the other parties),
   211         // we've received a public key (from one of the other parties),