[#4637] More helpful exception message when a non PKCS#8 key is used.

Motivation:

We should throw a more helpful exception when a non PKCS#8 key is used by the user.

Modifications:

Change exception message to give a hint what is wrong.

Result:

Easier for user to understand whats wrong with their used key.
This commit is contained in:
Norman Maurer 2016-01-05 09:43:00 +01:00
parent 61cfdd7671
commit f0f014d0c7

View File

@ -125,7 +125,8 @@ final class PemReader {
Matcher m = KEY_PATTERN.matcher(content);
if (!m.find()) {
throw new KeyException("found no private key in input stream");
throw new KeyException("could not find a PKCS #8 private key in input stream" +
" (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)");
}
ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII);