[jboss-identity-commits] JBoss Identity SVN: r231 - in xmlkey/trunk/skms: src/main/java/org/jboss/identity/skms/v1/model and 11 other directories.

jboss-identity-commits at lists.jboss.org jboss-identity-commits at lists.jboss.org
Mon Jan 19 00:48:37 EST 2009


Author: anil.saldhana at jboss.com
Date: 2009-01-19 00:48:37 -0500 (Mon, 19 Jan 2009)
New Revision: 231

Added:
   xmlkey/trunk/skms/src/test/java/org/
   xmlkey/trunk/skms/src/test/java/org/jboss/
   xmlkey/trunk/skms/src/test/java/org/jboss/test/
   xmlkey/trunk/skms/src/test/java/org/jboss/test/identity/
   xmlkey/trunk/skms/src/test/java/org/jboss/test/identity/skms/
   xmlkey/trunk/skms/src/test/java/org/jboss/test/identity/skms/v1/
   xmlkey/trunk/skms/src/test/java/org/jboss/test/identity/skms/v1/SymmetricKeyUnitTestCase.java
   xmlkey/trunk/skms/src/test/resources/ekmi/
   xmlkey/trunk/skms/src/test/resources/ekmi/v1/
   xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/
   xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/symkeyrequest-01.xml
   xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/symkeyresponse-01.xml
Modified:
   xmlkey/trunk/skms/.classpath
   xmlkey/trunk/skms/pom.xml
   xmlkey/trunk/skms/src/main/java/org/jboss/identity/skms/v1/model/ObjectFactory.java
Log:
skms

Modified: xmlkey/trunk/skms/.classpath
===================================================================
--- xmlkey/trunk/skms/.classpath	2009-01-19 04:12:50 UTC (rev 230)
+++ xmlkey/trunk/skms/.classpath	2009-01-19 05:48:37 UTC (rev 231)
@@ -8,5 +8,8 @@
 	<classpathentry combineaccessrules="false" kind="src" path="/common"/>
 	<classpathentry kind="var" path="M2_REPO/org/jboss/identity/jboss-identity-xmlsec-model/1.0.0-SNAPSHOT/jboss-identity-xmlsec-model-1.0.0-SNAPSHOT.jar"/>
 	<classpathentry kind="var" path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+	<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar"/>
 	<classpathentry kind="output" path="target-eclipse"/>
 </classpath>

Modified: xmlkey/trunk/skms/pom.xml
===================================================================
--- xmlkey/trunk/skms/pom.xml	2009-01-19 04:12:50 UTC (rev 230)
+++ xmlkey/trunk/skms/pom.xml	2009-01-19 05:48:37 UTC (rev 231)
@@ -66,6 +66,10 @@
         <artifactId>jaxb-api</artifactId>
       </dependency>
       <dependency>
+        <groupId>sun-jaxb</groupId>
+        <artifactId>jaxb-impl</artifactId>
+      </dependency>
+      <dependency>
         <groupId>stax</groupId>
         <artifactId>stax-api</artifactId>
         <version>1.0</version>

Modified: xmlkey/trunk/skms/src/main/java/org/jboss/identity/skms/v1/model/ObjectFactory.java
===================================================================
--- xmlkey/trunk/skms/src/main/java/org/jboss/identity/skms/v1/model/ObjectFactory.java	2009-01-19 04:12:50 UTC (rev 230)
+++ xmlkey/trunk/skms/src/main/java/org/jboss/identity/skms/v1/model/ObjectFactory.java	2009-01-19 05:48:37 UTC (rev 231)
@@ -93,8 +93,25 @@
     public KeyUsePolicyType createKeyUsePolicyType() {
         return new KeyUsePolicyType();
     }
+    
+    /**
+     * Create an instance of {@link KeyCachePolicyRequest }
+     *
+     */
+    public KeyCachePolicyRequest createKeyCachePolicyRequest() {
+        return new KeyCachePolicyRequest();
+    }
 
     /**
+     * Create an instance of {@link KeyCachePolicyResponse }
+     *
+     */
+    public KeyCachePolicyResponse createKeyCachePolicyResponse() {
+        return new KeyCachePolicyResponse();
+    }
+
+
+    /**
      * Create an instance of {@link PermittedDatesType.PermittedDate }
      * 
      */
@@ -231,6 +248,14 @@
     }
 
     /**
+     * Create an instance of {@link SymkeyRequest }
+     * 
+     */
+    public SymkeyRequest createSymkeyRequest() {
+        return new SymkeyRequest();
+    }
+    
+    /**
      * Create an instance of {@link SymkeyResponse }
      * 
      */

Added: xmlkey/trunk/skms/src/test/java/org/jboss/test/identity/skms/v1/SymmetricKeyUnitTestCase.java
===================================================================
--- xmlkey/trunk/skms/src/test/java/org/jboss/test/identity/skms/v1/SymmetricKeyUnitTestCase.java	                        (rev 0)
+++ xmlkey/trunk/skms/src/test/java/org/jboss/test/identity/skms/v1/SymmetricKeyUnitTestCase.java	2009-01-19 05:48:37 UTC (rev 231)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.skms.v1;
+
+import java.io.InputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+import junit.framework.TestCase;
+
+import org.jboss.identity.skms.v1.model.ObjectFactory;
+import org.jboss.identity.skms.v1.model.SymkeyRequest;
+import org.jboss.identity.skms.v1.model.SymkeyResponse;
+
+/**
+ * Unit Test Symmetric Key request / response
+ * @author Anil.Saldhana at redhat.com
+ * @since Jan 18, 2009
+ */
+public class SymmetricKeyUnitTestCase extends TestCase
+{
+   /**
+    <ekmi:SymkeyRequest xmlns:ekmi=”http://docs.oasis-open.org/ekmi/2008/01">
+       <ekmi:GlobalKeyID>10514-0-0</ekmi:GlobalKeyID>
+    </ekmi:SymkeyRequest>
+    */ 
+   public void testSymmetricKeyRequest() throws Exception
+   { 
+      String globalId = "10514-0-0";
+      ObjectFactory objectFactory = new ObjectFactory(); 
+      SymkeyRequest symKeyRequest = objectFactory.createSymkeyRequest();
+      symKeyRequest.getGlobalKeyID().add(globalId);
+      
+      assertEquals(globalId, symKeyRequest.getGlobalKeyID().get(0));
+      
+      //Lets parse the request from a file
+      JAXBContext jaxb = JAXBContext.newInstance("org.jboss.identity.skms.v1.model");
+      Unmarshaller unmarshaller = jaxb.createUnmarshaller();
+      
+      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+      InputStream is = tcl.getResourceAsStream("ekmi/v1/xml/symkeyrequest-01.xml");
+      assertNotNull("Inputstream is not null", is);  
+      SymkeyRequest symRequest = (SymkeyRequest) unmarshaller.unmarshal(is);
+      assertNotNull("SymKeyRequest != null", symRequest);
+      assertEquals(globalId, symRequest.getGlobalKeyID().get(0));
+   }
+   
+   /**
+    * Test the read of SymKeyResponse
+    * @throws Exception
+    */
+   public void testSymKeyResponseReadFromXML() throws Exception
+   {
+    //Lets parse the request from a file
+      JAXBContext jaxb = JAXBContext.newInstance("org.jboss.identity.skms.v1.model");
+      Unmarshaller unmarshaller = jaxb.createUnmarshaller();
+      
+      ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+      InputStream is = tcl.getResourceAsStream("ekmi/v1/xml/symkeyresponse-01.xml");
+      assertNotNull("Inputstream is not null", is);  
+      SymkeyResponse symResponse = (SymkeyResponse) unmarshaller.unmarshal(is);
+      assertNotNull("SymKeyResponse != null", symResponse);
+   }
+}
\ No newline at end of file

Added: xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/symkeyrequest-01.xml
===================================================================
--- xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/symkeyrequest-01.xml	                        (rev 0)
+++ xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/symkeyrequest-01.xml	2009-01-19 05:48:37 UTC (rev 231)
@@ -0,0 +1,3 @@
+<ekmi:SymkeyRequest xmlns:ekmi="http://docs.oasis-open.org/ekmi/2008/01">
+   <ekmi:GlobalKeyID>10514-0-0</ekmi:GlobalKeyID>
+</ekmi:SymkeyRequest>
\ No newline at end of file

Added: xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/symkeyresponse-01.xml
===================================================================
--- xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/symkeyresponse-01.xml	                        (rev 0)
+++ xmlkey/trunk/skms/src/test/resources/ekmi/v1/xml/symkeyresponse-01.xml	2009-01-19 05:48:37 UTC (rev 231)
@@ -0,0 +1,59 @@
+<ekmi:SymkeyResponse xmlns:ekmi='http://docs.oasis-open.org/ekmi/2008/01'
+	xmlns:xenc='http://www.w3.org/2001/04/xmlenc#'
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<ekmi:Symkey>
+		<ekmi:SymkeyRequestID>10514-1-7476</ekmi:SymkeyRequestID>
+		<ekmi:GlobalKeyID>10514-1-235</ekmi:GlobalKeyID>
+		<ekmi:KeyUsePolicy>
+			<ekmi:KeyUsePolicyID>10514-4</ekmi:KeyUsePolicyID>
+			<ekmi:PolicyName>DES-EDE KeyUsePolicy</ekmi:PolicyName>
+			<ekmi:KeyClass>HR-Class</ekmi:KeyClass>
+			<ekmi:KeyAlgorithm> http://www.w3.org/2001/04/xmlenc#tripledes-cbc
+			</ekmi:KeyAlgorithm>
+			<ekmi:KeySize>192</ekmi:KeySize>
+			<ekmi:Status>Active</ekmi:Status>
+			<ekmi:Permissions>
+				<ekmi:PermittedApplications ekmi:any="false">
+					<ekmi:PermittedApplication>
+						<ekmi:ApplicationID>10514-23</ekmi:ApplicationID>
+						<ekmi:ApplicationName> Payroll Application</ekmi:ApplicationName>
+						<ekmi:ApplicationVersion>1.0</ekmi:ApplicationVersion>
+						<ekmi:ApplicationDigestAlgorithm>
+							http://www.w3.org/2000/09/xmldsig#sha1
+						</ekmi:ApplicationDigestAlgorithm>
+						<ekmi:ApplicationDigestValue> NIG4bKkt4cziEqFFuOoBTM81efU=
+						</ekmi:ApplicationDigestValue>
+					</ekmi:PermittedApplication>
+				</ekmi:PermittedApplications>
+				<ekmi:PermittedDates ekmi:any="false">
+					<ekmi:PermittedDate>
+						<ekmi:StartDate>2008-01-01</ekmi:StartDate>
+						<ekmi:EndDate>2008-12-31</ekmi:EndDate>
+					</ekmi:PermittedDate>
+				</ekmi:PermittedDates>
+				<ekmi:PermittedDays ekmi:any="true" xsi:nil="true" />
+				<ekmi:PermittedDuration ekmi:any="true"
+					xsi:nil="true" />
+				<ekmi:PermittedLevels ekmi:any="true" xsi:nil="true" />
+				<ekmi:PermittedLocations ekmi:any="true"
+					xsi:nil="true" />
+				<ekmi:PermittedNumberOfTransactions
+					ekmi:any="true" xsi:nil="true" />
+				<ekmi:PermittedTimes ekmi:any="false">
+					<ekmi:PermittedTime>
+						<ekmi:StartTime>07:00:00</ekmi:StartTime>
+						<ekmi:EndTime>19:00:00</ekmi:EndTime>
+					</ekmi:PermittedTime>
+				</ekmi:PermittedTimes>
+				<ekmi:PermittedUses ekmi:any="true" xsi:nil="true" />
+			</ekmi:Permissions>
+		</ekmi:KeyUsePolicy>
+		<ekmi:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
+		<xenc:CipherData>
+			<xenc:CipherValue>
+				E9zWB/y93hVSzeTLiDcQoDxmlNxTuxSffMNwCJmt1dIqzQHBnpdQ81g6DKdkCFjJM
+				hQhywCx9sfYjv9h5FDqUiQXGOca8EU871zBoXBjDxjfg1pU8tGFbpWZcd/ATpJD/2fw
+				UJow/qimxi8+huUYJMtaGHtXuLlWtx27STRcRpIsY=</xenc:CipherValue>
+		</xenc:CipherData>
+	</ekmi:Symkey>
+</ekmi:SymkeyResponse>
\ No newline at end of file




More information about the jboss-identity-commits mailing list