directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r581323 - /directory/sandbox/erodriguez/kerberos-pkinit/src/test/java/org/apache/directory/server/kerberos/pkinit/DhKeyAgreementTest.java
Date Tue, 02 Oct 2007 18:00:45 GMT
Author: erodriguez
Date: Tue Oct  2 11:00:44 2007
New Revision: 581323

URL: http://svn.apache.org/viewvc?rev=581323&view=rev
Log:
Added skeleton TestCase to test PKINIT's Diffie-Hellman mechanism when client and server DH
nonces are used.

Modified:
    directory/sandbox/erodriguez/kerberos-pkinit/src/test/java/org/apache/directory/server/kerberos/pkinit/DhKeyAgreementTest.java

Modified: directory/sandbox/erodriguez/kerberos-pkinit/src/test/java/org/apache/directory/server/kerberos/pkinit/DhKeyAgreementTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/erodriguez/kerberos-pkinit/src/test/java/org/apache/directory/server/kerberos/pkinit/DhKeyAgreementTest.java?rev=581323&r1=581322&r2=581323&view=diff
==============================================================================
--- directory/sandbox/erodriguez/kerberos-pkinit/src/test/java/org/apache/directory/server/kerberos/pkinit/DhKeyAgreementTest.java
(original)
+++ directory/sandbox/erodriguez/kerberos-pkinit/src/test/java/org/apache/directory/server/kerberos/pkinit/DhKeyAgreementTest.java
Tue Oct  2 11:00:44 2007
@@ -67,4 +67,38 @@
 
         assertTrue( Arrays.equals( clearText, recovered ) );
     }
+
+
+    /**
+     * Tests Diffie-Hellman using Oakley 1024-bit Modular Exponential (MODP)
+     * well-known group 2 [RFC2412], including the optional DH nonce.
+     * 
+     * @throws Exception
+     */
+    public void testPreGeneratedDhParamsWithNonce() throws Exception
+    {
+        // TODO - Generate client nonce.
+        byte[] clientDhNonce = new byte[0];
+        // TODO - Generate server nonce.
+        byte[] serverDhNonce = new byte[0];
+
+        DhClient client = new DhClient();
+        DhServer server = new DhServer();
+
+        byte[] clientPubKeyEnc = client.init( DhGroup.MODP_GROUP2 );
+        byte[] serverPubKeyEnc = server.initAndDoPhase( clientPubKeyEnc );
+
+        server.generateKey( clientDhNonce, serverDhNonce );
+
+        client.doPhase( serverPubKeyEnc );
+
+        client.generateKey( clientDhNonce, serverDhNonce );
+
+        byte[] clearText = "This is just an example".getBytes();
+
+        byte[] cipherText = server.encryptAes( clearText );
+        byte[] recovered = client.decryptAes( cipherText );
+
+        assertTrue( Arrays.equals( clearText, recovered ) );
+    }
 }



Mime
View raw message