From 610cdacd4020db00eb6a29f52a71c8bf04bbc9a2 Mon Sep 17 00:00:00 2001
From: Lyubomir Marinov <lyubomir.marinov@jitsi.org>
Date: Mon, 12 May 2014 11:50:16 +0300
Subject: [PATCH] Implements DefaultTlsServer.getRSAEncryptionCredentials()
 which may be required by certain cipher suites.

---
 .../transform/dtls/TlsServerImpl.java         | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/src/org/jitsi/impl/neomedia/transform/dtls/TlsServerImpl.java b/src/org/jitsi/impl/neomedia/transform/dtls/TlsServerImpl.java
index c5828c8b..fe199bdd 100644
--- a/src/org/jitsi/impl/neomedia/transform/dtls/TlsServerImpl.java
+++ b/src/org/jitsi/impl/neomedia/transform/dtls/TlsServerImpl.java
@@ -26,6 +26,10 @@ public class TlsServerImpl
      */
     private static final Logger logger = Logger.getLogger(TlsServerImpl.class);
 
+    /**
+     *
+     * @see TlsServer#getCertificateRequest()
+     */
     private final CertificateRequest certificateRequest
         = new CertificateRequest(
                 new short[] { ClientCertificateType.rsa_sign },
@@ -43,6 +47,16 @@ public class TlsServerImpl
      */
     private final DtlsPacketTransformer packetTransformer;
 
+    /**
+     *
+     * @see DefaultTlsServer#getRSAEncryptionCredentials()
+     */
+    private TlsEncryptionCredentials rsaEncryptionCredentials;
+
+    /**
+     *
+     * @see DefaultTlsServer#getRSASignerCredentials()
+     */
     private TlsSignerCredentials rsaSignerCredentials;
 
     /**
@@ -162,6 +176,36 @@ protected ProtocolVersion getMinimumVersion()
 
     /**
      * {@inheritDoc}
+     *
+     * Depending on the <tt>selectedCipherSuite</tt>, <tt>DefaultTlsServer</tt>
+     * will require either <tt>rsaEncryptionCredentials</tt> or
+     * <tt>rsaSignerCredentials</tt> neither of which is implemented by
+     * <tt>DefaultTlsServer</tt>.
+     */
+    @Override
+    protected TlsEncryptionCredentials getRSAEncryptionCredentials()
+        throws IOException
+    {
+        if (rsaEncryptionCredentials == null)
+        {
+            DtlsControlImpl dtlsControl = getDtlsControl();
+
+            rsaEncryptionCredentials
+                = new DefaultTlsEncryptionCredentials(
+                        context,
+                        dtlsControl.getCertificate(),
+                        dtlsControl.getKeyPair().getPrivate());
+        }
+        return rsaEncryptionCredentials;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * Depending on the <tt>selectedCipherSuite</tt>, <tt>DefaultTlsServer</tt>
+     * will require either <tt>rsaEncryptionCredentials</tt> or
+     * <tt>rsaSignerCredentials</tt> neither of which is implemented by
+     * <tt>DefaultTlsServer</tt>.
      */
     @Override
     protected TlsSignerCredentials getRSASignerCredentials()
-- 
GitLab