[java-xmltooling COMMIT] in /branches/REL_1/src/test: java/org/opensaml/xml/security/credential/BasicKeyInfoGenerator...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Jan 22 22:07:25 EST 2013
Author: scantor
Date: Tue Jan 22 22:07:25 2013
New Revision: 784
URL: http://svn.shibboleth.net/view/java-xmltooling?rev=784&view=rev
Log:
JXT-95: Additional unit tests for DER and X509Digest KeyInfo.
Added:
branches/REL_1/src/test/java/org/opensaml/xml/security/keyinfo/DEREncodedKeyValueTest.java (with props)
branches/REL_1/src/test/resources/data/org/opensaml/xml/security/keyinfo/X509CertificatesWithDigest.xml (with props)
Modified:
branches/REL_1/src/test/java/org/opensaml/xml/security/credential/BasicKeyInfoGeneratorTest.java
branches/REL_1/src/test/java/org/opensaml/xml/security/keyinfo/CertChainX509DataTest.java
branches/REL_1/src/test/java/org/opensaml/xml/security/keyinfo/KeyInfoHelperTest.java
Modified: branches/REL_1/src/test/java/org/opensaml/xml/security/credential/BasicKeyInfoGeneratorTest.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/test/java/org/opensaml/xml/security/credential/BasicKeyInfoGeneratorTest.java?rev=784&r1=783&r2=784&view=diff
==============================================================================
--- branches/REL_1/src/test/java/org/opensaml/xml/security/credential/BasicKeyInfoGeneratorTest.java (original)
+++ branches/REL_1/src/test/java/org/opensaml/xml/security/credential/BasicKeyInfoGeneratorTest.java Tue Jan 22 22:07:25 2013
@@ -26,6 +26,7 @@
import org.opensaml.xml.security.SecurityHelper;
import org.opensaml.xml.security.keyinfo.KeyInfoGenerator;
import org.opensaml.xml.security.keyinfo.KeyInfoHelper;
+import org.opensaml.xml.signature.DEREncodedKeyValue;
import org.opensaml.xml.signature.KeyInfo;
/**
@@ -86,6 +87,7 @@
*/
public void testEmitPublicKey() throws SecurityException, KeyException {
factory.setEmitPublicKeyValue(true);
+ factory.setEmitPublicDEREncodedKeyValue(true);
generator = factory.newInstance();
KeyInfo keyInfo = generator.generate(credential);
@@ -93,10 +95,15 @@
assertNotNull("Generated KeyInfo was null", keyInfo);
assertNotNull("Generated KeyInfo children list was null", keyInfo.getOrderedChildren());
- assertEquals("Unexpected number of KeyInfo children", 1, keyInfo.getOrderedChildren().size());
+ assertEquals("Unexpected number of KeyInfo children", 2, keyInfo.getOrderedChildren().size());
assertEquals("Unexpected number of KeyValue elements", 1, keyInfo.getKeyValues().size());
+ assertEquals("Unexpected number of DEREncodedKeyValue elements", 1,
+ keyInfo.getXMLObjects(DEREncodedKeyValue.DEFAULT_ELEMENT_NAME).size());
PublicKey generatedKey = KeyInfoHelper.getKey(keyInfo.getKeyValues().get(0));
assertEquals("Unexpected key value", pubKey, generatedKey);
+ PublicKey generatedKey2 = KeyInfoHelper.getKey(
+ (DEREncodedKeyValue) keyInfo.getXMLObjects(DEREncodedKeyValue.DEFAULT_ELEMENT_NAME).get(0));
+ assertEquals("Unexpected key value", pubKey, generatedKey2);
}
/**
@@ -150,6 +157,7 @@
factory.setEmitKeyNames(true);
factory.setEmitEntityIDAsKeyName(true);
factory.setEmitPublicKeyValue(true);
+ factory.setEmitPublicDEREncodedKeyValue(true);
keyInfo = generator.generate(credential);
@@ -160,7 +168,7 @@
assertNotNull("Generated KeyInfo was null", keyInfo);
assertNotNull("Generated KeyInfo children list was null", keyInfo.getOrderedChildren());
- assertEquals("Unexpected # of KeyInfo children found", 4, keyInfo.getOrderedChildren().size());
+ assertEquals("Unexpected # of KeyInfo children found", 5, keyInfo.getOrderedChildren().size());
}
}
Modified: branches/REL_1/src/test/java/org/opensaml/xml/security/keyinfo/CertChainX509DataTest.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/test/java/org/opensaml/xml/security/keyinfo/CertChainX509DataTest.java?rev=784&r1=783&r2=784&view=diff
==============================================================================
--- branches/REL_1/src/test/java/org/opensaml/xml/security/keyinfo/CertChainX509DataTest.java (original)
+++ branches/REL_1/src/test/java/org/opensaml/xml/security/keyinfo/CertChainX509DataTest.java Tue Jan 22 22:07:25 2013
@@ -79,7 +79,7 @@
"pkJf5neHUinKAqgoRfPXowudZg1Zl8DjzoOBn+MNHRrR5KYbVGvdHcxoJLCwVB/v";
private String entityCertSKIBase64 = "OBGBOSNoqgroOhl9RniD0sMlRa4=";
-
+ private String entityCertDigestBase64 = "xSZMa2KvZfsOQzv86Ho/5VmwY4E=";
private X509Certificate caCert;
private String caCertBase64 =
@@ -119,24 +119,11 @@
new X500Principal("cn=foobar.example.org, O=Internet2");
new X500Principal("cn=ca.example.org, O=Internet2");
Base64.decode(entityCertSKIBase64);
- }
-
- /**
- * Test resolution with multiple certs, end-entity cert identified by KeyValue.
- *
- * @throws SecurityException on error resolving credentials
- */
- public void testResolutionWithKeyValue() throws SecurityException {
[... 300 lines stripped ...]
More information about the commits
mailing list