summaryrefslogtreecommitdiffstats
path: root/bcprov/src/main/java/org/bouncycastle/jce/provider/test/SigNameTest.java
diff options
context:
space:
mode:
authorSergio Giro <sgiro@google.com>2016-02-01 18:52:42 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-02-01 18:52:42 +0000
commit9218edabd1ef9852bc2f13115dcadc81b442dd6c (patch)
tree8229ff72c8cbb06f49dce3a8382930919fa6fc2b /bcprov/src/main/java/org/bouncycastle/jce/provider/test/SigNameTest.java
parent9b30eb05e5be69d51881a0d1b31e503e97acd784 (diff)
parent397d32894b89b506dc318e0f83446187c9b76ebe (diff)
downloadandroid_external_bouncycastle-9218edabd1ef9852bc2f13115dcadc81b442dd6c.tar.gz
android_external_bouncycastle-9218edabd1ef9852bc2f13115dcadc81b442dd6c.tar.bz2
android_external_bouncycastle-9218edabd1ef9852bc2f13115dcadc81b442dd6c.zip
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge-152-from-upstream"
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/jce/provider/test/SigNameTest.java')
-rw-r--r--bcprov/src/main/java/org/bouncycastle/jce/provider/test/SigNameTest.java92
1 files changed, 92 insertions, 0 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/jce/provider/test/SigNameTest.java b/bcprov/src/main/java/org/bouncycastle/jce/provider/test/SigNameTest.java
new file mode 100644
index 0000000..19f9e6d
--- /dev/null
+++ b/bcprov/src/main/java/org/bouncycastle/jce/provider/test/SigNameTest.java
@@ -0,0 +1,92 @@
+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");
+
+ checkName("RIPEMD128withRSA/X9.31");
+ checkName("RIPEMD160withRSA/X9.31");
+ checkName("SHA1withRSA/X9.31");
+ checkName("SHA224withRSA/X9.31");
+ checkName("SHA256withRSA/X9.31");
+ checkName("SHA384withRSA/X9.31");
+ checkName("SHA512withRSA/X9.31");
+ checkName("WhirlpoolwithRSA/X9.31");
+ }
+
+ public String getName()
+ {
+ return "SigNameTest";
+ }
+
+ public static void main(
+ String[] args)
+ {
+ Security.addProvider(new BouncyCastleProvider());
+
+ runTest(new SigNameTest());
+ }
+} \ No newline at end of file