google / google/conscrypt

getApplicationProtocol returns null instead of empty String

Open
#1,003 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
326
Avg merge
16h 22m
Merged PRs (30d)
17

Description

Im using Android 11 and the native Conscrypt implementation but this should affect also the JRE version.

The [Java SSLEngine](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/javax/net/ssl/SSLEngine.html#getApplicationProtocol())
defines three states: `null`, an empty response and a string for the application protocol. [getApplicationProtocol](https://github.com/google/conscrypt/blob/1cca353e3133fbd587848a75debaed6eeab0779c/common/src/main/java/org/conscrypt/NativeCrypto.java#L1382) returns just `null` or or value. which is consumed by
[ActiveSession](https://github.com/google/conscrypt/blob/1cca353e3133fbd587848a75debaed6eeab0779c/common/src/main/java/org/conscrypt/ActiveSession.java#L286).

I have a TLS 1.2 page not including an ALPN and the Conscrypt SSLEninge returns for `getApplicationProtocol` null instead of an empty string.

I have created a [test project](https://github.com/koh-osug/alpn-issue) demonstrating the issue.

## Fix:

Return an empty string.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.