< prev index next >

src/java.base/share/classes/javax/crypto/KeyAgreement.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 135      */
 136     public final String getAlgorithm() {
 137         return this.algorithm;
 138     }
 139 
 140     /**
 141      * Returns a {@code KeyAgreement} object that implements the
 142      * specified key agreement algorithm.
 143      *
 144      * <p> This method traverses the list of registered security Providers,
 145      * starting with the most preferred Provider.
 146      * A new KeyAgreement object encapsulating the
 147      * KeyAgreementSpi implementation from the first
 148      * Provider that supports the specified algorithm is returned.
 149      *
 150      * <p> Note that the list of registered providers may be retrieved via
 151      * the {@link Security#getProviders() Security.getProviders()} method.
 152      *
 153      * @implNote
 154      * The JDK Reference Implementation additionally uses the
 155      * {@code jdk.security.provider.preferred} property to determine

 156      * the preferred provider order for the specified algorithm. This
 157      * may be different than the order of providers returned by
 158      * {@link Security#getProviders() Security.getProviders()}.
 159      *
 160      * @param algorithm the standard name of the requested key agreement
 161      * algorithm.
 162      * See the KeyAgreement section in the <a href=
 163      * "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement">
 164      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
 165      * for information about standard algorithm names.
 166      *
 167      * @return the new {@code KeyAgreement} object.
 168      *
 169      * @exception NullPointerException if the specified algorithm
 170      *          is null.
 171      *
 172      * @exception NoSuchAlgorithmException if no Provider supports a
 173      *          KeyAgreementSpi implementation for the
 174      *          specified algorithm.
 175      *


   1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 135      */
 136     public final String getAlgorithm() {
 137         return this.algorithm;
 138     }
 139 
 140     /**
 141      * Returns a {@code KeyAgreement} object that implements the
 142      * specified key agreement algorithm.
 143      *
 144      * <p> This method traverses the list of registered security Providers,
 145      * starting with the most preferred Provider.
 146      * A new KeyAgreement object encapsulating the
 147      * KeyAgreementSpi implementation from the first
 148      * Provider that supports the specified algorithm is returned.
 149      *
 150      * <p> Note that the list of registered providers may be retrieved via
 151      * the {@link Security#getProviders() Security.getProviders()} method.
 152      *
 153      * @implNote
 154      * The JDK Reference Implementation additionally uses the
 155      * {@code jdk.security.provider.preferred}
 156      * {@link Security#getProperty(String) Security} property to determine
 157      * the preferred provider order for the specified algorithm. This
 158      * may be different than the order of providers returned by
 159      * {@link Security#getProviders() Security.getProviders()}.
 160      *
 161      * @param algorithm the standard name of the requested key agreement
 162      * algorithm.
 163      * See the KeyAgreement section in the <a href=
 164      * "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement">
 165      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
 166      * for information about standard algorithm names.
 167      *
 168      * @return the new {@code KeyAgreement} object.
 169      *
 170      * @exception NullPointerException if the specified algorithm
 171      *          is null.
 172      *
 173      * @exception NoSuchAlgorithmException if no Provider supports a
 174      *          KeyAgreementSpi implementation for the
 175      *          specified algorithm.
 176      *


< prev index next >