【函数】 | String signWithRSA(String algorithm, String privateKey, String string) |
【说明】 | 对字符串进行RSA签名。 |
【返回】 | 字符串的签名。 |
【参数】 |
algorithm:签名算法,支持以下算法:
privateKey:签名使用的私钥,使用rexseeKeyPairGenerator.generateRSAKeyPair()生成密钥对。 string:要签名的字符串。 |
【示例】 | 参见verifyWithRSA()。 |
【函数】 | String verifyWithRSA(String algorithm, String publicKey, String signatureString, String string) |
【说明】 | 对字符串的签名进行验证。 |
【返回】 | true或false,表示签名正确与否。 |
【参数】 |
algorithm:签名算法。
publicKey:签名使用的公钥,使用rexseeKeyPairGenerator.generateRSAKeyPair()生成密钥对。 signatureString:签名字符串。 string:要验证的字符串。 |
【示例】 |
函数代码
verifyRSA('MD5withRSA/ISO9796-2',256);
MD5withRSA/ISO9796-2
verifyRSA('SHA1withRSA/ISO9796-2',256);
SHA1withRSA/ISO9796-2
verifyRSA('MD5WithRSAEncryption',512);
MD5WithRSAEncryption
verifyRSA('MD4WithRSAEncryption',512);
MD4WithRSAEncryption
verifyRSA('RSASSA-PSS',512);
RSASSA-PSS
verifyRSA('SHA1withRSA/PSS',512);
SHA1withRSA/PSS
verifyRSA('SHA224withRSA/PSS',512);
SHA224withRSA/PSS
verifyRSA('SHA256withRSA/PSS',1024);
SHA256withRSA/PSS
verifyRSA('SHA384withRSA/PSS',1024);
SHA384withRSA/PSS
verifyRSA('SHA512withRSA/PSS',2048);
SHA512withRSA/PSS
verifyRSA('SHA1WithRSAEncryption',512);
SHA1WithRSAEncryption
verifyRSA('SHA224WithRSAEncryption',512);
SHA224WithRSAEncryption
verifyRSA('SHA256WithRSAEncryption',512);
SHA256WithRSAEncryption
verifyRSA('SHA384WithRSAEncryption',1024);
SHA384WithRSAEncryption
verifyRSA('SHA512WithRSAEncryption',1024);
SHA512WithRSAEncryption
verifyRSA('1.2.840.113549.1.1.10',512);
1.2.840.113549.1.1.10
|
【函数】 | String signFileWithRSA(String algorithm, String privateKey, String path) |
【说明】 | 对文件进行RSA签名。 |
【返回】 | 文件的签名。 |
【参数】 |
algorithm:签名算法。
privateKey:签名使用的私钥,使用rexseeKeyPairGenerator.generateRSAKeyPair()生成密钥对。 path:要签名的文件路径。 |
【示例】 | 参见verifyFileWithRSA()。 |
【函数】 | String verifyFileWithRSA(String algorithm, String publicKey, String signatureString, String path) |
【说明】 | 对文件的RSA签名进行验证。 |
【返回】 | true或false,表示签名正确与否。 |
【参数】 |
algorithm:签名算法。
publicKey:签名使用的公钥,使用rexseeKeyPairGenerator.generateRSAKeyPair()生成密钥对。 signatureString:签名字符串。 path:要验证的文件路径。 |
【示例】 |
函数代码
verifyFileRSA('MD5withRSA/ISO9796-2',256);
MD5withRSA/ISO9796-2
|
【函数】 | String signWithDSA(String algorithm, String privateKey, String string) |
【说明】 | 对字符串进行DSA签名。 |
【返回】 | 字符串的签名。 |
【参数】 |
algorithm:签名算法,支持以下算法:
privateKey:签名使用的私钥,使用rexseeKeyPairGenerator.generateDSAKeyPair()生成密钥对。 string:要签名的字符串。 |
【示例】 | 参见verifyWithDSA()。 |
【函数】 | String verifyWithDSA(String algorithm, String publicKey, String signatureString, String string) |
【说明】 | 对字符串的DSA签名进行验证。 |
【返回】 | true或false,表示签名正确与否。 |
【参数】 |
algorithm:签名算法。
publicKey:签名使用的公钥。使用rexseeKeyPairGenerator生成密钥对,注意其算法必须和这里的算法类型匹配,例如都是用RSA类算法或都是用DSA类算法。 signatureString:签名字符串。 string:要验证的字符串。 |
【示例】 |
函数代码
verifyDSA('DSA',512);
DSA
verifyDSA('NONEWITHDSA',256);
NONEWITHDSA
verifyDSA('SHA1withDSA',512);
SHA1withDSA
|
【函数】 | String signFileWithDSA(String algorithm, String privateKey, String path) |
【说明】 | 对文件进行DSA签名。 |
【返回】 | 文件的签名。 |
【参数】 |
algorithm:签名算法。
privateKey:签名使用的私钥,使用rexseeKeyPairGenerator.generateDSAKeyPair()生成密钥对。 path:要签名文件路径。 |
【示例】 | 参见verifyFileWithDSA()。 |
【函数】 | String verifyFileWithDSA(String algorithm, String publicKey, String signatureString, String path) |
【说明】 | 对字符串的DSA签名进行验证。 |
【返回】 | true或false,表示签名正确与否。 |
【参数】 |
algorithm:签名算法。
publicKey:签名使用的公钥。使用rexseeKeyPairGenerator生成密钥对,注意其算法必须和这里的算法类型匹配,例如都是用RSA类算法或都是用DSA类算法。 signatureString:签名字符串。 string:要验证的字符串。 |
【示例】 |
函数代码
verifyFileDSA('DSA',512);
DSA
verifyFileDSA('NONEWITHDSA',256);
NONEWITHDSA
verifyFileDSA('SHA1withDSA',512);
SHA1withDSA
|