public class PSSParameterSpec
extends Object implements AlgorithmParameterSpec
| java.lang.Object | |
| java.security.spec.PSSParameterSpec | |
该类指定了RSA-PSS签名方案的参数规范,如 PKCS#1 v2.1标准中所定义。
其在PKCS#1标准中的ASN.1定义如下:
RSASSA-PSS-params ::= SEQUENCE {
hashAlgorithm [0] OAEP-PSSDigestAlgorithms DEFAULT sha1,
maskGenAlgorithm [1] PKCS1MGFAlgorithms DEFAULT mgf1SHA1,
saltLength [2] INTEGER DEFAULT 20,
trailerField [3] INTEGER DEFAULT 1
}
where
OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-sha1 PARAMETERS NULL }|
{ OID id-sha256 PARAMETERS NULL }|
{ OID id-sha384 PARAMETERS NULL }|
{ OID id-sha512 PARAMETERS NULL },
... -- Allows for future expansion --
}
PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
{ OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
... -- Allows for future expansion --
}
注意:PSSParameterSpec.DEFAULT使用以下内容:消息摘要 - mgf的“SHA-1”屏蔽生成功能(mgf) - “MGF1”参数 - MGF1ParameterSpec.SHA1 SaltLength - 20 TrailerField - 1
Fields |
|
|---|---|
public static final PSSParameterSpec |
DEFAULT 使用所有默认值设置PSS参数。 |
Public constructors |
|
|---|---|
PSSParameterSpec(String mdName, String mgfName, AlgorithmParameterSpec mgfSpec, int saltLen, int trailerField) 使用指定的消息摘要,掩码生成函数,掩码生成函数的参数,salt长度和尾部字段值,创建PKCS#1标准中定义的新的 |
|
PSSParameterSpec(int saltLen) 使用指定的salt长度和PKCS#1中定义的其他默认值创建新的 |
|
公共方法(Public methods) |
|
|---|---|
String |
getDigestAlgorithm() 返回消息摘要算法名称。 |
String |
getMGFAlgorithm() 返回掩码生成函数算法名称。 |
AlgorithmParameterSpec |
getMGFParameters() 返回遮罩生成函数的参数。 |
int |
getSaltLength() 以位为单位返回盐的长度。 |
int |
getTrailerField() 返回尾部字段的值,即 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
PSSParameterSpec (String mdName, String mgfName, AlgorithmParameterSpec mgfSpec, int saltLen, int trailerField)
使用指定的消息摘要,掩码生成函数,掩码生成函数的参数,salt长度和尾部字段值,创建PKCS#1标准中定义的新的 PSSParameterSpec 。
| 参数(Parameters) | |
|---|---|
mdName |
String: the algorithm name of the hash function. |
mgfName |
String: the algorithm name of the mask generation function. |
mgfSpec |
AlgorithmParameterSpec: the parameters for the mask generation function. If null is specified, null will be returned by getMGFParameters(). |
saltLen |
int: the length of salt. |
trailerField |
int: the value of the trailer field. |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if mdName, or mgfName is null. |
IllegalArgumentException |
if saltLen or trailerField is less than 0. |
PSSParameterSpec (int saltLen)
使用指定的salt长度和PKCS#1中定义的其他默认值创建新的 PSSParameterSpec 。
| 参数(Parameters) | |
|---|---|
saltLen |
int: the length of salt in bits to be used in PKCS#1 PSS encoding. |
| 抛出异常(Throws) | |
|---|---|
IllegalArgumentException |
if saltLen is less than 0. |
String getDigestAlgorithm ()
返回消息摘要算法名称。
| 返回(Returns) | |
|---|---|
String |
the message digest algorithm name. |
String getMGFAlgorithm ()
返回掩码生成函数算法名称。
| 返回(Returns) | |
|---|---|
String |
the mask generation function algorithm name. |
AlgorithmParameterSpec getMGFParameters ()
返回遮罩生成函数的参数。
| 返回(Returns) | |
|---|---|
AlgorithmParameterSpec |
the parameters for the mask generation function. |
int getSaltLength ()
以位为单位返回盐的长度。
| 返回(Returns) | |
|---|---|
int |
the salt length. |
int getTrailerField ()
返回尾部字段的值,即PKCS#1 v2.1中的bc。
| 返回(Returns) | |
|---|---|
int |
the value for the trailer field, i.e. bc in PKCS#1 v2.1. |