---
title: Do not use weak SSL context
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > Code Security > Static Code Analysis (SAST) > SAST
  Rules > Do not use weak SSL context
---

# Do not use weak SSL context

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ().
{% /alert %}

{% /callout %}

## Metadata{% #metadata %}

**ID:** `java-security/ssl-context`

**Language:** Java

**Severity:** Notice

**Category:** Security

**CWE**: [327](https://cwe.mitre.org/data/definitions/327.html)

**Related CWEs**:

- [328](https://cwe.mitre.org/data/definitions/328.html)
- [916](https://cwe.mitre.org/data/definitions/916.html)
- [1240](https://cwe.mitre.org/data/definitions/1240.html)

## Description{% #description %}

Do not use `"SSL"` as it uses an old protocol. Use `"TLS"` instead.

#### Learn More{% #learn-more %}

- [Difference between SSL and TLS](https://serverfault.com/questions/64484/functional-implications-of-differences-in-ssl-and-tls/368574#368574)
- [Weak SSL Context](https://find-sec-bugs.github.io/bugs.htm#SSL_CONTEXT)

## Non-Compliant Code Examples{% #non-compliant-code-examples %}

```java
public class Foo {
    
    public static foobar() {
        SSLContext.getInstance("SSL");
    }
}
    
```

## Compliant Code Examples{% #compliant-code-examples %}

```java
public class Foo {
    
    public static foobar() {
        SSLContext.getInstance("TLS");
    }
}
    
```
  Seamless integrations. Try Datadog Code SecurityDatadog Code Security 
{% icon name="icon-external-link" /%}
 