2999N/A/*
2999N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2999N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2999N/A *
2999N/A * This code is free software; you can redistribute it and/or modify it
2999N/A * under the terms of the GNU General Public License version 2 only, as
2999N/A * published by the Free Software Foundation. Oracle designates this
2999N/A * particular file as subject to the "Classpath" exception as provided
2999N/A * by Oracle in the LICENSE file that accompanied this code.
2999N/A *
2999N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2999N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2999N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2999N/A * version 2 for more details (a copy is included in the LICENSE file that
2999N/A * accompanied this code).
2999N/A *
2999N/A * You should have received a copy of the GNU General Public License version
2999N/A * 2 along with this work; if not, write to the Free Software Foundation,
2999N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2999N/A *
2999N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2999N/A * or visit www.oracle.com if you need additional information or have any
2999N/A * questions.
2999N/A */
2999N/A
2999N/Apackage java.security;
2999N/A
2999N/Aimport java.util.Set;
2999N/A
2999N/A/**
2999N/A * This interface specifies constraints for cryptographic algorithms,
2999N/A * keys (key sizes), and other algorithm parameters.
2999N/A * <p>
2999N/A * {@code AlgorithmConstraints} objects are immutable. An implementation
2999N/A * of this interface should not provide methods that can change the state
2999N/A * of an instance once it has been created.
2999N/A * <p>
2999N/A * Note that {@code AlgorithmConstraints} can be used to represent the
2999N/A * restrictions described by the security properties
2999N/A * {@code jdk.certpath.disabledAlgorithms} and
2999N/A * {@code jdk.tls.disabledAlgorithms}, or could be used by a
2999N/A * concrete {@code PKIXCertPathChecker} to check whether a specified
2999N/A * certificate in the certification path contains the required algorithm
2999N/A * constraints.
2999N/A *
2999N/A * @see javax.net.ssl.SSLParameters#getAlgorithmConstraints
2999N/A * @see javax.net.ssl.SSLParameters#setAlgorithmConstraints(AlgorithmConstraints)
2999N/A *
2999N/A * @since 1.7
2999N/A */
2999N/A
2999N/Apublic interface AlgorithmConstraints {
2999N/A
2999N/A /**
2999N/A * Determines whether an algorithm is granted permission for the
2999N/A * specified cryptographic primitives.
2999N/A *
2999N/A * @param primitives a set of cryptographic primitives
2999N/A * @param algorithm the algorithm name
2999N/A * @param parameters the algorithm parameters, or null if no additional
2999N/A * parameters
2999N/A *
2999N/A * @return true if the algorithm is permitted and can be used for all
2999N/A * of the specified cryptographic primitives
2999N/A *
2999N/A * @throws IllegalArgumentException if primitives or algorithm is null
2999N/A * or empty
2999N/A */
2999N/A public boolean permits(Set<CryptoPrimitive> primitives,
2999N/A String algorithm, AlgorithmParameters parameters);
2999N/A
2999N/A /**
2999N/A * Determines whether a key is granted permission for the specified
2999N/A * cryptographic primitives.
2999N/A * <p>
2999N/A * This method is usually used to check key size and key usage.
2999N/A *
2999N/A * @param primitives a set of cryptographic primitives
2999N/A * @param key the key
2999N/A *
2999N/A * @return true if the key can be used for all of the specified
2999N/A * cryptographic primitives
2999N/A *
2999N/A * @throws IllegalArgumentException if primitives is null or empty,
2999N/A * or the key is null
2999N/A */
2999N/A public boolean permits(Set<CryptoPrimitive> primitives, Key key);
2999N/A
2999N/A /**
2999N/A * Determines whether an algorithm and the corresponding key are granted
2999N/A * permission for the specified cryptographic primitives.
2999N/A *
2999N/A * @param primitives a set of cryptographic primitives
2999N/A * @param algorithm the algorithm name
2999N/A * @param key the key
2999N/A * @param parameters the algorithm parameters, or null if no additional
2999N/A * parameters
2999N/A *
2999N/A * @return true if the key and the algorithm can be used for all of the
2999N/A * specified cryptographic primitives
2999N/A *
2999N/A * @throws IllegalArgumentException if primitives or algorithm is null
2999N/A * or empty, or the key is null
2999N/A */
2999N/A public boolean permits(Set<CryptoPrimitive> primitives,
2999N/A String algorithm, Key key, AlgorithmParameters parameters);
2999N/A
2999N/A}