package org.bouncycastle.crypto.tls.test;

import java.io.IOException;

import org.bouncycastle.crypto.tls.AlertDescription;
import org.bouncycastle.crypto.tls.CipherSuite;
import org.bouncycastle.crypto.tls.DefaultTlsServer;
import org.bouncycastle.crypto.tls.ProtocolVersion;
import org.bouncycastle.crypto.tls.TlsCredentials;
import org.bouncycastle.crypto.tls.TlsFatalAlert;

public class MockDTLSServer extends DefaultTlsServer {

    protected ProtocolVersion getMaximumVersion() {
        return ProtocolVersion.DTLSv10;
    }

    protected ProtocolVersion getMinimumVersion() {
        return ProtocolVersion.DTLSv10;
    }

    public TlsCredentials getCredentials() throws IOException {

        switch (selectedCipherSuite) {
        case CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA:
        case CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA:
        case CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA:
        case CipherSuite.TLS_RSA_WITH_CAMELLIA_128_CBC_SHA:
        case CipherSuite.TLS_RSA_WITH_CAMELLIA_256_CBC_SHA:
        case CipherSuite.TLS_RSA_WITH_SEED_CBC_SHA:
            return TlsTestUtils.loadEncryptionCredentials(context, new String[] {
                "x509-server.pem", "x509-ca.pem" }, "x509-server-key.pem");

        default:
            /*
             * Note: internal error here; selected a key exchange we don't implement!
             */
            throw new TlsFatalAlert(AlertDescription.internal_error);
        }
    }
}

@@ -438,24 +438,464 @@
 Server %7B%0D%0A%0D%0A
+    protected int%5B%5D getCipherSuites() %7B%0D%0A        return new int%5B%5D %7B%0D%0A//            CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA,%0D%0A//            CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA,%0D%0A//            CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,%0D%0A            CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA,%0D%0A            CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA,%0D%0A            CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA,%0D%0A        %7D;%0D%0A    %7D%0D%0A%0D%0A
     protecte
@@ -1697,24 +1697,550 @@
 y.pem%22);%0D%0A%0D%0A
+        case CipherSuite.TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA:%0D%0A        case CipherSuite.TLS_DHE_RSA_WITH_AES_128_CBC_SHA:%0D%0A        case CipherSuite.TLS_DHE_RSA_WITH_AES_256_CBC_SHA:%0D%0A        case CipherSuite.TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA:%0D%0A        case CipherSuite.TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA:%0D%0A        case CipherSuite.TLS_DHE_RSA_WITH_SEED_CBC_SHA:%0D%0A            return TlsTestUtils.loadSignerCredentials(context, new String%5B%5D %7B %22x509-server.pem%22,%0D%0A                %22x509-ca.pem%22 %7D, %22x509-server-key.pem%22);%0D%0A%0D%0A
         defa

Prepare for DHE_RSA