Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,12 @@ public static X509Certificate[] loadCertificatesFromPemStream(InputStream inStre
}

public static PrivateKey loadPrivateKeyFromPemFile(String keyFilePath) throws KeyManagementException {
PrivateKey privateKey = null;

if (keyFilePath == null || keyFilePath.isEmpty()) {
return privateKey;
return null;
}

PrivateKey privateKey;

try (FileInputStream input = new FileInputStream(keyFilePath)) {
privateKey = loadPrivateKeyFromPemStream(input);
} catch (IOException e) {
Expand All @@ -438,12 +438,12 @@ public static PrivateKey loadPrivateKeyFromPemFile(String keyFilePath) throws Ke
}

public static PrivateKey loadPrivateKeyFromPemStream(InputStream inStream) throws KeyManagementException {
PrivateKey privateKey = null;

if (inStream == null) {
return privateKey;
return null;
}

PrivateKey privateKey;

try (BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, StandardCharsets.UTF_8))) {
if (inStream.markSupported()) {
inStream.reset();
Expand Down