title: RabbitMQ SSL Connection with spring-amqp 1.4.3
body: <p>I am trying to connect to RabbitMQ over SSL. I have followed the RabbitMQ SSL documentation linked here <a href="https://www.rabbitmq.com/ssl.html" rel="nofollow">https://www.rabbitmq.com/ssl.html</a>
  As per RabbitMQ SSL documentation connecting using SSLv3 and TLSv1 is not recommeded due to known vulnerabilities. Due to this I have disabled these protocols on RabbitMQ as per instructions.</p>
  
  <p>I am using spring-amqp 1.4.3 to connect to RabbitMQ. Plese find below code snippet</p>
  
  <pre><code>            ApplicationContext context =
              new GenericXmlApplicationContext("classpath:/testConfig/testrabbit-context.xml");
          RabbitTemplate template = context.getBean(RabbitTemplate.class);
          MessageProperties messageProperties = new MessageProperties();
          org.springframework.amqp.core.Message amqpMessage = new org.springframework.amqp.core.Message(
                  "Test".getBytes(), messageProperties);
          String routingKey = "TEST.businessevent.route";
          template.send(routingKey, amqpMessage);
  </code></pre>
  
  <p>Please find below my config</p>
  
  <pre><code>        &lt;rabbit:connection-factory id="rabbitConnectionFactory"
      connection-factory="clientConnectionFactory"        
      host="localhost" 
      port="5671" 
      username="username"
      password="password" 
      virtual-host="test_host" /&gt;
  
  &lt;rabbit:admin connection-factory="rabbitConnectionFactory" /&gt;
  
  &lt;rabbit:template id="rabbitTemplate"
      connection-factory="rabbitConnectionFactory" exchange="test_topic" /&gt;
  
  &lt;rabbit:topic-exchange name="test_topic" durable="true" /&gt;  
  
  &lt;bean id="clientConnectionFactory"
      class="org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean"&gt;
  &lt;property name="useSSL" value="true" /&gt;
  &lt;property name="sslPropertiesLocation" value="/testconfig/rabbitSSL.properties"/&gt;
  
  &lt;/bean&gt;
  </code></pre>
  
  <p>Properties file rabbitSSL.properties is as follows</p>
  
  <pre><code>    keyStore=file:/client/keycert.p12
      trustStore=file:/lib/security/rabbitStore
      keyStore.passPhrase=testpassword
      trustStore.passPhrase=testpassword
  </code></pre>
  
  <p>However when I use the above code and config to connect to RabbitMQ over SSL I am getting a fatal alert: protocol_version. 
  When I looked at the org.springframework.amqp.rabbit.connection.RabbitConnectionFactoryBean class that Spring is using to connect to RabbitMQ, I can see that the protocol appears to be hard coded to SSLv3. </p>
  
  <pre><code>                SSLContext context = SSLContext.getInstance("SSLv3");
          context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
          this.connectionFactory.useSslProtocol(context);
  </code></pre>
  
  <p>This code works fine if I do not disable SSLv3 on RabbitMQ. However I need to connect to RabbitMQ using Tlsv1.2. Can I do that using Spring amqp 1.4.3 or do I need to use another version. Thanks for any help you can provide me with this issue.</p>