< prev index next >

src/java.base/share/classes/javax/net/ssl/SSLContext.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 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


 121             sm.checkPermission(new SSLPermission("setDefaultSSLContext"));
 122         }
 123         defaultContext = context;
 124     }
 125 
 126     /**
 127      * Returns a {@code SSLContext} object that implements the
 128      * specified secure socket protocol.
 129      *
 130      * <p> This method traverses the list of registered security Providers,
 131      * starting with the most preferred Provider.
 132      * A new SSLContext object encapsulating the
 133      * SSLContextSpi implementation from the first
 134      * Provider that supports the specified protocol is returned.
 135      *
 136      * <p> Note that the list of registered providers may be retrieved via
 137      * the {@link Security#getProviders() Security.getProviders()} method.
 138      *
 139      * @implNote
 140      * The JDK Reference Implementation additionally uses the
 141      * {@code jdk.security.provider.preferred} property to determine

 142      * the preferred provider order for the specified algorithm. This
 143      * may be different than the order of providers returned by
 144      * {@link Security#getProviders() Security.getProviders()}.
 145      *
 146      * @param protocol the standard name of the requested protocol.
 147      *          See the SSLContext section in the <a href=
 148      * "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext">
 149      *          Java Cryptography Architecture Standard Algorithm Name
 150      *          Documentation</a>
 151      *          for information about standard protocol names.
 152      *
 153      * @return the new {@code SSLContext} object.
 154      *
 155      * @exception NoSuchAlgorithmException if no Provider supports a
 156      *          SSLContextSpi implementation for the
 157      *          specified protocol.
 158      * @exception NullPointerException if protocol is null.
 159      *
 160      * @see java.security.Provider
 161      */


   1 /*
   2  * Copyright (c) 1999, 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


 121             sm.checkPermission(new SSLPermission("setDefaultSSLContext"));
 122         }
 123         defaultContext = context;
 124     }
 125 
 126     /**
 127      * Returns a {@code SSLContext} object that implements the
 128      * specified secure socket protocol.
 129      *
 130      * <p> This method traverses the list of registered security Providers,
 131      * starting with the most preferred Provider.
 132      * A new SSLContext object encapsulating the
 133      * SSLContextSpi implementation from the first
 134      * Provider that supports the specified protocol is returned.
 135      *
 136      * <p> Note that the list of registered providers may be retrieved via
 137      * the {@link Security#getProviders() Security.getProviders()} method.
 138      *
 139      * @implNote
 140      * The JDK Reference Implementation additionally uses the
 141      * {@code jdk.security.provider.preferred}
 142      * {@link Security#getProperty(String) Security} property to determine
 143      * the preferred provider order for the specified algorithm. This
 144      * may be different than the order of providers returned by
 145      * {@link Security#getProviders() Security.getProviders()}.
 146      *
 147      * @param protocol the standard name of the requested protocol.
 148      *          See the SSLContext section in the <a href=
 149      * "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext">
 150      *          Java Cryptography Architecture Standard Algorithm Name
 151      *          Documentation</a>
 152      *          for information about standard protocol names.
 153      *
 154      * @return the new {@code SSLContext} object.
 155      *
 156      * @exception NoSuchAlgorithmException if no Provider supports a
 157      *          SSLContextSpi implementation for the
 158      *          specified protocol.
 159      * @exception NullPointerException if protocol is null.
 160      *
 161      * @see java.security.Provider
 162      */


< prev index next >