diff options
Diffstat (limited to 'prov/src/test/java/org/spongycastle/jce/provider/test/SigNameTest.java')
-rw-r--r-- | prov/src/test/java/org/spongycastle/jce/provider/test/SigNameTest.java | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/prov/src/test/java/org/spongycastle/jce/provider/test/SigNameTest.java b/prov/src/test/java/org/spongycastle/jce/provider/test/SigNameTest.java new file mode 100644 index 00000000..02fe1176 --- /dev/null +++ b/prov/src/test/java/org/spongycastle/jce/provider/test/SigNameTest.java @@ -0,0 +1,83 @@ +package org.spongycastle.jce.provider.test; + +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.Security; +import java.security.Signature; + +import org.spongycastle.jce.provider.BouncyCastleProvider; +import org.spongycastle.util.test.SimpleTest; + +public class SigNameTest + extends SimpleTest +{ + private void checkName(String name) + throws NoSuchProviderException, NoSuchAlgorithmException + { + if (!name.equals(Signature.getInstance(name, "SC").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()); + } +}
\ No newline at end of file |