[xmlsectool] 02/02: Add a quick test around EC credentials.
Ian Young
ian at iay.org.uk
Tue May 24 09:34:30 EDT 2016
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch master
in repository xmlsectool.
commit 7836cb48df9eef2a05bf3627477609c5cf2044c5
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Tue May 24 14:18:52 2016 +0100
Add a quick test around EC credentials.
---
.../net/shibboleth/tool/xmlsectool/XSTJ51Test.java | 29 ++++++++++++++++++++++
.../net/shibboleth/tool/xmlsectool/ecsign384.crt | 15 +++++++++++
2 files changed, 44 insertions(+)
diff --git a/src/test/java/net/shibboleth/tool/xmlsectool/XSTJ51Test.java b/src/test/java/net/shibboleth/tool/xmlsectool/XSTJ51Test.java
new file mode 100644
index 0000000..e941ba0
--- /dev/null
+++ b/src/test/java/net/shibboleth/tool/xmlsectool/XSTJ51Test.java
@@ -0,0 +1,29 @@
+package net.shibboleth.tool.xmlsectool;
+
+import java.io.File;
+import java.security.PublicKey;
+
+import org.opensaml.security.x509.BasicX509Credential;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class XSTJ51Test extends BaseTest {
+
+ XSTJ51Test() {
+ super(XSTJ51Test.class);
+ }
+
+ @Test
+ public void testInstance() throws Exception {
+ final File file = packageRelativeFile("ecsign384.crt");
+ final BasicX509Credential cred = CredentialHelper.getFileBasedCredentials(null, null, file.getPath());
+ final PublicKey pk = cred.getPublicKey();
+ Assert.assertEquals(pk.getAlgorithm(), "EC");
+ if (pk instanceof java.security.interfaces.DSAPublicKey) {
+ Assert.fail("should not have been a DSAPublicKey");
+ } else if (pk instanceof java.security.interfaces.RSAPublicKey) {
+ Assert.fail("should not have been a RSAPublicKey");
+ }
+ Assert.assertTrue(pk instanceof java.security.interfaces.ECPublicKey);
+ }
+}
diff --git a/src/test/resources/net/shibboleth/tool/xmlsectool/ecsign384.crt b/src/test/resources/net/shibboleth/tool/xmlsectool/ecsign384.crt
new file mode 100644
index 0000000..ed10573
--- /dev/null
+++ b/src/test/resources/net/shibboleth/tool/xmlsectool/ecsign384.crt
@@ -0,0 +1,15 @@
+-----BEGIN CERTIFICATE-----
+MIICXDCCAeOgAwIBAgIJAJnrL3SN9G0gMAkGByqGSM49BAEwbTELMAkGA1UEBhMC
+R0IxETAPBgNVBAgMCFNjb3RsYW5kMRIwEAYDVQQHDAlFZGluYnVyZ2gxGzAZBgNV
+BAoMElNoaWJib2xldGggUHJvamVjdDEaMBgGA1UEAwwRRUNEU0EgVGVzdCBTaWdu
+ZXIwHhcNMTMwMzA4MTgwMDUyWhcNMTMwNDA3MTgwMDUyWjBtMQswCQYDVQQGEwJH
+QjERMA8GA1UECAwIU2NvdGxhbmQxEjAQBgNVBAcMCUVkaW5idXJnaDEbMBkGA1UE
+CgwSU2hpYmJvbGV0aCBQcm9qZWN0MRowGAYDVQQDDBFFQ0RTQSBUZXN0IFNpZ25l
+cjB2MBAGByqGSM49AgEGBSuBBAAiA2IABJOTcWHcnuaawymYM9ppSrexyjctFpLJ
+uKtnYW54Tr9KAXSX8V2co9leb+v5jCltACx5OkbIOIDmuZOp4O5t8/gBrLN/sv73
+Pb4sIp9a5OHDuojy06mmGqh3D+RLMqjXiKNQME4wHQYDVR0OBBYEFPkX7lxo3PJk
+SfXjs8YVx2QjHp4NMB8GA1UdIwQYMBaAFPkX7lxo3PJkSfXjs8YVx2QjHp4NMAwG
+A1UdEwQFMAMBAf8wCQYHKoZIzj0EAQNoADBlAjEAt2UvyCA7GgvfC6OsmA2Qr5oA
+pjdE/YiVlCexQQADZiuZ5GIvF3dXd5MxrAj0mMP/AjBoxJbpCfKoXzzW+KULUxg3
+RxjaWBJRNfk6Tv0kLvjF2syGmVVdlEfjQLsXQx+Rkvs=
+-----END CERTIFICATE-----
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list