jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java
changeset 26736 5a93000b26cd
parent 25859 3317bb8137f4
child 32275 17eeb583a331
equal deleted inserted replaced
26735:4502faa0cc22 26736:5a93000b26cd
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    75 
    75 
    76 public class KeyAgreement {
    76 public class KeyAgreement {
    77 
    77 
    78     private static final Debug debug =
    78     private static final Debug debug =
    79                         Debug.getInstance("jca", "KeyAgreement");
    79                         Debug.getInstance("jca", "KeyAgreement");
       
    80 
       
    81     private static final Debug pdebug =
       
    82                         Debug.getInstance("provider", "Provider");
       
    83     private static final boolean skipDebug =
       
    84         Debug.isOn("engine=") && !Debug.isOn("keyagreement");
    80 
    85 
    81     // The provider
    86     // The provider
    82     private Provider provider;
    87     private Provider provider;
    83 
    88 
    84     // The provider implementation (delegate)
    89     // The provider implementation (delegate)
   466             } catch (InvalidAlgorithmParameterException e) {
   471             } catch (InvalidAlgorithmParameterException e) {
   467                 // should never occur
   472                 // should never occur
   468                 throw new InvalidKeyException(e);
   473                 throw new InvalidKeyException(e);
   469             }
   474             }
   470         }
   475         }
       
   476 
       
   477         if (!skipDebug && pdebug != null) {
       
   478             pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
       
   479                 this.provider.getName());
       
   480         }
   471     }
   481     }
   472 
   482 
   473     /**
   483     /**
   474      * Initializes this key agreement with the given key and set of
   484      * Initializes this key agreement with the given key and set of
   475      * algorithm parameters.
   485      * algorithm parameters.
   522         if (spi != null) {
   532         if (spi != null) {
   523             spi.engineInit(key, params, random);
   533             spi.engineInit(key, params, random);
   524         } else {
   534         } else {
   525             chooseProvider(I_PARAMS, key, params, random);
   535             chooseProvider(I_PARAMS, key, params, random);
   526         }
   536         }
       
   537 
       
   538         if (!skipDebug && pdebug != null) {
       
   539             pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
       
   540                 this.provider.getName());
       
   541         }
   527     }
   542     }
   528 
   543 
   529     /**
   544     /**
   530      * Executes the next phase of this key agreement with the given
   545      * Executes the next phase of this key agreement with the given
   531      * key that was received from one of the other parties involved in this key
   546      * key that was received from one of the other parties involved in this key