< prev index next >
src/java.base/share/classes/javax/crypto/KeyAgreement.java
Print this page
rev 15967 : [mq]: GetInstance
*** 163,185 ****
* See the KeyAgreement section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
! * @return the new {@code KeyAgreement} object.
*
! * @exception NullPointerException if the specified algorithm
! * is null.
*
! * @exception NoSuchAlgorithmException if no Provider supports a
! * KeyAgreementSpi implementation for the
! * specified algorithm.
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm)
throws NoSuchAlgorithmException {
List<Service> services =
GetInstance.getServices("KeyAgreement", algorithm);
// make sure there is at least one service from a signed provider
Iterator<Service> t = services.iterator();
while (t.hasNext()) {
--- 163,185 ----
* See the KeyAgreement section in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyAgreement">
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
! * @return the new {@code KeyAgreement} object
*
! * @throws NoSuchAlgorithmException if no {@code Provider} supports a
! * {@code KeyAgreementSpi} implementation for the
! * specified algorithm
*
! * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm)
throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
List<Service> services =
GetInstance.getServices("KeyAgreement", algorithm);
// make sure there is at least one service from a signed provider
Iterator<Service> t = services.iterator();
while (t.hasNext()) {
*** 212,241 ****
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
! * @return the new {@code KeyAgreement} object.
*
! * @exception NullPointerException if the specified algorithm
! * is null.
*
! * @exception NoSuchAlgorithmException if a KeyAgreementSpi
* implementation for the specified algorithm is not
! * available from the specified provider.
*
! * @exception NoSuchProviderException if the specified provider is not
! * registered in the security provider list.
*
! * @exception IllegalArgumentException if the {@code provider}
! * is null or empty.
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
Instance instance = JceSecurity.getInstance
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
return new KeyAgreement((KeyAgreementSpi)instance.impl,
instance.provider, algorithm);
}
--- 212,241 ----
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the name of the provider.
*
! * @return the new {@code KeyAgreement} object
*
! * @throws IllegalArgumentException if the {@code provider}
! * is {@code null} or empty
*
! * @throws NoSuchAlgorithmException if a {@code KeyAgreementSpi}
* implementation for the specified algorithm is not
! * available from the specified provider
*
! * @throws NoSuchProviderException if the specified provider is not
! * registered in the security provider list
*
! * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException,
NoSuchProviderException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
return new KeyAgreement((KeyAgreementSpi)instance.impl,
instance.provider, algorithm);
}
*** 256,281 ****
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the provider.
*
! * @return the new {@code KeyAgreement} object.
*
! * @exception NullPointerException if the specified algorithm
! * is null.
*
! * @exception NoSuchAlgorithmException if a KeyAgreementSpi
* implementation for the specified algorithm is not available
! * from the specified Provider object.
*
! * @exception IllegalArgumentException if the {@code provider}
! * is null.
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
Instance instance = JceSecurity.getInstance
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
return new KeyAgreement((KeyAgreementSpi)instance.impl,
instance.provider, algorithm);
}
--- 256,281 ----
* Java Cryptography Architecture Standard Algorithm Name Documentation</a>
* for information about standard algorithm names.
*
* @param provider the provider.
*
! * @return the new {@code KeyAgreement} object
*
! * @throws IllegalArgumentException if the {@code provider}
! * is {@code null}
*
! * @throws NoSuchAlgorithmException if a {@code KeyAgreementSpi}
* implementation for the specified algorithm is not available
! * from the specified Provider object
*
! * @throws NullPointerException if {@code algorithm} is {@code null}
*
* @see java.security.Provider
*/
public static final KeyAgreement getInstance(String algorithm,
Provider provider) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(algorithm, "null algorithm name");
Instance instance = JceSecurity.getInstance
("KeyAgreement", KeyAgreementSpi.class, algorithm, provider);
return new KeyAgreement((KeyAgreementSpi)instance.impl,
instance.provider, algorithm);
}
< prev index next >