Most visited

Recently visited

Added in API level 24

AlgorithmConstraints

public interface AlgorithmConstraints

java.security.AlgorithmConstraints


此接口指定密码算法,密钥(密钥大小)和其他算法参数的约束。

AlgorithmConstraints对象是不可变的。 该接口的实现不应该提供可以在创建实例后更改实例状态的方法。

请注意,可以使用 AlgorithmConstraints来表示安全属性 jdk.certpath.disabledAlgorithmsjdk.tls.disabledAlgorithms所描述的限制,或者可以由具体的 PKIXCertPathChecker用来检查证书路径中的指定证书是否包含所需的算法约束。

也可以看看:

Summary

Public methods

abstract boolean permits(Set<CryptoPrimitive> primitives, String algorithm, AlgorithmParameters parameters)

确定算法是否被授予指定加密基元的权限。

abstract boolean permits(Set<CryptoPrimitive> primitives, String algorithm, Key key, AlgorithmParameters parameters)

确定算法和相应的密钥是否被授予指定密码原语的权限。

abstract boolean permits(Set<CryptoPrimitive> primitives, Key key)

确定是否授予某个密钥对指定的加密基元的权限。

Public methods

permits

Added in API level 24
boolean permits (Set<CryptoPrimitive> primitives, 
                String algorithm, 
                AlgorithmParameters parameters)

确定算法是否被授予指定加密基元的权限。

Parameters
primitives Set: a set of cryptographic primitives
algorithm String: the algorithm name
parameters AlgorithmParameters: the algorithm parameters, or null if no additional parameters
Returns
boolean true if the algorithm is permitted and can be used for all of the specified cryptographic primitives
Throws
IllegalArgumentException if primitives or algorithm is null or empty

permits

Added in API level 24
boolean permits (Set<CryptoPrimitive> primitives, 
                String algorithm, 
                Key key, 
                AlgorithmParameters parameters)

确定算法和相应的密钥是否被授予指定密码原语的权限。

Parameters
primitives Set: a set of cryptographic primitives
algorithm String: the algorithm name
key Key: the key
parameters AlgorithmParameters: the algorithm parameters, or null if no additional parameters
Returns
boolean true if the key and the algorithm can be used for all of the specified cryptographic primitives
Throws
IllegalArgumentException if primitives or algorithm is null or empty, or the key is null

permits

Added in API level 24
boolean permits (Set<CryptoPrimitive> primitives, 
                Key key)

确定是否授予某个密钥对指定的加密基元的权限。

此方法通常用于检查密钥大小和密钥使用情况。

Parameters
primitives Set: a set of cryptographic primitives
key Key: the key
Returns
boolean true if the key can be used for all of the specified cryptographic primitives
Throws
IllegalArgumentException if primitives is null or empty, or the key is null

Hooray!