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
52 changes: 31 additions & 21 deletions src/java/com/wolfssl/provider/jsse/WolfSSLImplementSSLSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,9 @@ public synchronized Certificate[] getPeerCertificates()
try {
x509 = this.ssl.getPeerCertificate();
} catch (IllegalStateException | WolfSSLJNIException ex) {
Logger.getLogger(
WolfSSLImplementSSLSession.class.getName()).log(
Level.SEVERE, null, ex);
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
() -> "Error getting peer certificate: "
+ ex.getMessage());
x509 = 0;
}

Expand Down Expand Up @@ -636,9 +636,9 @@ public synchronized javax.security.cert.X509Certificate[] getPeerCertificateChai

} catch (IllegalStateException | WolfSSLJNIException |
WolfSSLException ex) {
Logger.getLogger(
WolfSSLImplementSSLSession.class.getName()).log(
Level.SEVERE, null, ex);
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
() -> "Error getting peer certificate chain: "
+ ex.getMessage());
}
return null;
}
Expand Down Expand Up @@ -682,9 +682,8 @@ public synchronized Principal getPeerPrincipal()

} catch (IllegalStateException | WolfSSLJNIException |
WolfSSLException ex) {
Logger.getLogger(
WolfSSLImplementSSLSession.class.getName()).log(
Level.SEVERE, null, ex);
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
() -> "Error getting peer principal: " + ex.getMessage());
}
return null;
}
Expand Down Expand Up @@ -735,9 +734,8 @@ public synchronized String getCipherSuite() {
return currentCipher;
}
} catch (IllegalStateException | WolfSSLJNIException ex) {
Logger.getLogger(
WolfSSLImplementSSLSession.class.getName()).log(
Level.SEVERE, null, ex);
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
() -> "Error getting cipher suite: " + ex.getMessage());
}

return this.cipherSuite;
Expand Down Expand Up @@ -804,17 +802,29 @@ public synchronized int getPacketBufferSize() {

/* Try to get maximum TLS record size from native wolfSSL */
if (ssl != null) {
nativeMax = ssl.getMaxOutputSize();
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
() -> "ssl.getMaxOutputSize() returned: " + nativeMax);

if ((nativeMax > 0) && (nativeMax > ret)) {
ret = nativeMax;
try {
nativeMax = ssl.getMaxOutputSize();
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
() -> "ssl.getMaxOutputSize() returned: " + nativeMax);
if ((nativeMax > 0) && (nativeMax > ret)) {
ret = nativeMax;
}
if (ret > this.packetBufSz) {
this.packetBufSz = ret;
}
} catch (IllegalStateException ex) {
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
() -> "Error getting packet buffer size: "
+ ex.getMessage());
/* If ssl.getMaxOutputSize failed, check for cached value */
if (this.packetBufSz > ret) {
ret = this.packetBufSz;
} else {
/* Cache ret if greater than or equal to packetBufSz */
this.packetBufSz = ret;
}
}

if (ret > this.packetBufSz) {
this.packetBufSz = ret;
}
} else if (this.packetBufSz >= 0) {
ret = this.packetBufSz;
}
Expand Down