@@ -4105,16 +4105,16 @@ public synchronized byte[] getClientSNIRequest()
41054105 }
41064106
41074107 /**
4108- * Get SNI request used for this session object.
4108+ * Get SNI request used for this session object as bytes .
41094109 *
41104110 * @param type SNI type. Currently supported type is
41114111 * WolfSSL.WOLFSSL_SNI_HOST_NAME.
4112- * @return String representing SNI name requested in this session, or
4112+ * @return SNI name requested in this session as a byte array , or
41134113 * null if not available.
41144114 * @throws IllegalStateException if called when WolfSSLSession is not
41154115 * active
41164116 */
4117- public String getSNIRequest (byte type ) throws IllegalStateException {
4117+ public byte [] getSNIRequestBytes (byte type ) throws IllegalStateException {
41184118
41194119 byte [] reqBytes = null ;
41204120
@@ -4130,12 +4130,29 @@ public String getSNIRequest(byte type) throws IllegalStateException {
41304130 }
41314131
41324132 if (reqBytes != null ) {
4133- return reqBytes . toString () ;
4133+ return reqBytes ;
41344134 }
41354135
41364136 return null ;
41374137 }
41384138
4139+ /**
4140+ * Get SNI request used for this session object as String.
4141+ *
4142+ * @param type SNI type. Currently supported type is
4143+ * WolfSSL.WOLFSSL_SNI_HOST_NAME.
4144+ * @return String representing SNI name requested in this session, or
4145+ * null if not available.
4146+ * @throws IllegalStateException if called when WolfSSLSession is not
4147+ * active
4148+ */
4149+ public String getSNIRequest (byte type ) throws IllegalStateException {
4150+
4151+ confirmObjectIsActive ();
4152+
4153+ return new String (getSNIRequestBytes (type ), StandardCharsets .UTF_8 );
4154+ }
4155+
41394156 /**
41404157 * Enable session tickets for this session.
41414158 *
0 commit comments