< prev index next >

src/java.base/share/classes/java/security/Signature.java

Print this page


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


 188             new ServiceId("Cipher", "RSA//PKCS1Padding"),
 189             new ServiceId("Cipher", "RSA"),
 190         }
 191     );
 192 
 193     /**
 194      * Returns a Signature object that implements the specified signature
 195      * algorithm.
 196      *
 197      * <p> This method traverses the list of registered security Providers,
 198      * starting with the most preferred Provider.
 199      * A new Signature object encapsulating the
 200      * SignatureSpi implementation from the first
 201      * Provider that supports the specified algorithm is returned.
 202      *
 203      * <p> Note that the list of registered providers may be retrieved via
 204      * the {@link Security#getProviders() Security.getProviders()} method.
 205      *
 206      * @implNote
 207      * The JDK Reference Implementation additionally uses the
 208      * {@code jdk.security.provider.preferred} property to determine

 209      * the preferred provider order for the specified algorithm. This
 210      * may be different than the order of providers returned by
 211      * {@link Security#getProviders() Security.getProviders()}.
 212      *
 213      * @param algorithm the standard name of the algorithm requested.
 214      * See the Signature section in the <a href=
 215      * "{@docRoot}/../technotes/guides/security/StandardNames.html#Signature">
 216      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
 217      * for information about standard algorithm names.
 218      *
 219      * @return the new Signature object.
 220      *
 221      * @exception NoSuchAlgorithmException if no Provider supports a
 222      *          Signature implementation for the
 223      *          specified algorithm.
 224      *
 225      * @see Provider
 226      */
 227     public static Signature getInstance(String algorithm)
 228             throws NoSuchAlgorithmException {


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


 188             new ServiceId("Cipher", "RSA//PKCS1Padding"),
 189             new ServiceId("Cipher", "RSA"),
 190         }
 191     );
 192 
 193     /**
 194      * Returns a Signature object that implements the specified signature
 195      * algorithm.
 196      *
 197      * <p> This method traverses the list of registered security Providers,
 198      * starting with the most preferred Provider.
 199      * A new Signature object encapsulating the
 200      * SignatureSpi implementation from the first
 201      * Provider that supports the specified algorithm is returned.
 202      *
 203      * <p> Note that the list of registered providers may be retrieved via
 204      * the {@link Security#getProviders() Security.getProviders()} method.
 205      *
 206      * @implNote
 207      * The JDK Reference Implementation additionally uses the
 208      * {@code jdk.security.provider.preferred}
 209      * {@link Security#getProperty(String) Security} property to determine
 210      * the preferred provider order for the specified algorithm. This
 211      * may be different than the order of providers returned by
 212      * {@link Security#getProviders() Security.getProviders()}.
 213      *
 214      * @param algorithm the standard name of the algorithm requested.
 215      * See the Signature section in the <a href=
 216      * "{@docRoot}/../technotes/guides/security/StandardNames.html#Signature">
 217      * Java Cryptography Architecture Standard Algorithm Name Documentation</a>
 218      * for information about standard algorithm names.
 219      *
 220      * @return the new Signature object.
 221      *
 222      * @exception NoSuchAlgorithmException if no Provider supports a
 223      *          Signature implementation for the
 224      *          specified algorithm.
 225      *
 226      * @see Provider
 227      */
 228     public static Signature getInstance(String algorithm)
 229             throws NoSuchAlgorithmException {


< prev index next >