blob: 0ed90c355c03f95b8c207ef8aa69f050d5894716 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
package org.bouncycastle.jce.provider.test;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Security;
import java.security.Signature;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.util.test.SimpleTest;
public class SigNameTest
extends SimpleTest
{
private void checkName(String name)
throws NoSuchProviderException, NoSuchAlgorithmException
{
if (!name.equals(Signature.getInstance(name, "BC").getAlgorithm()))
{
fail("name misatch on " + name);
}
}
public void performTest()
throws Exception
{
checkName("SHA1withRSA");
checkName("SHA224withRSA");
checkName("SHA256withRSA");
checkName("SHA384withRSA");
checkName("SHA512withRSA");
checkName("MD2withRSA");
checkName("MD4withRSA");
checkName("MD5withRSA");
checkName("RIPEMD160withRSA");
checkName("RIPEMD128withRSA");
checkName("RIPEMD256withRSA");
checkName("SHA1withDSA");
checkName("SHA224withDSA");
checkName("SHA256withDSA");
checkName("SHA384withDSA");
checkName("SHA512withDSA");
checkName("NONEwithDSA");
checkName("SHA1withECDSA");
checkName("SHA224withECDSA");
checkName("SHA256withECDSA");
checkName("SHA384withECDSA");
checkName("SHA512withECDSA");
checkName("RIPEMD160withECDSA");
checkName("SHA1withECNR");
checkName("SHA224withECNR");
checkName("SHA256withECNR");
checkName("SHA384withECNR");
checkName("SHA512withECNR");
checkName("SHA1withRSAandMGF1");
checkName("SHA1withRSAandMGF1");
checkName("SHA224withRSAandMGF1");
checkName("SHA256withRSAandMGF1");
checkName("SHA384withRSAandMGF1");
checkName("SHA512withRSAandMGF1");
checkName("GOST3411withGOST3410");
checkName("GOST3411withECGOST3410");
checkName("SHA1withRSA/ISO9796-2");
checkName("MD5withRSA/ISO9796-2");
checkName("RIPEMD160withRSA/ISO9796-2");
}
public String getName()
{
return "SigNameTest";
}
public static void main(
String[] args)
{
Security.addProvider(new BouncyCastleProvider());
runTest(new SigNameTest());
}
}
|