class TLSSocket extends Object with StObject
- Annotations
- @JSType() @JSImport("tls", "TLSSocket") @native()
- Source
- TLSSocket.scala
- Alphabetic
- By Inheritance
- TLSSocket
- StObject
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addListener(event: scala.Predef.String, listener: Function1[Any, Unit]): TLSSocket.this.type
- def addListener_OCSPResponse(event: OCSPResponse, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("addListener")
- def addListener_keylog(event: keylog, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("addListener")
- def addListener_secureConnect(event: secureConnect, listener: Function0[Unit]): TLSSocket.this.type
- Annotations
- @JSName("addListener")
- def addListener_session(event: session, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("addListener")
- var alpnProtocol: UndefOr[scala.Predef.String]
String containing the selected ALPN protocol.
String containing the selected ALPN protocol. When ALPN has no selected protocol, tlsSocket.alpnProtocol equals false.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- var authorizationError: Error
The reason why the peer's certificate has not been verified.
The reason why the peer's certificate has not been verified. This property becomes available only when tlsSocket.authorized === false.
- var authorized: Boolean
A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- def disableRenegotiation(): Unit
Disables TLS renegotiation for this TLSSocket instance.
Disables TLS renegotiation for this TLSSocket instance. Once called, attempts to renegotiate will trigger an 'error' event on the TLSSocket.
- def emit(event: Symbol, args: Any*): Boolean
- def emit(event: scala.Predef.String, args: Any*): Boolean
- def emit_OCSPResponse(event: OCSPResponse, response: Buffer): Boolean
- Annotations
- @JSName("emit")
- def emit_keylog(event: keylog, line: Buffer): Boolean
- Annotations
- @JSName("emit")
- def emit_secureConnect(event: secureConnect): Boolean
- Annotations
- @JSName("emit")
- def emit_session(event: session, session: Buffer): Boolean
- Annotations
- @JSName("emit")
- def enableTrace(): Unit
When enabled, TLS packet trace information is written to
stderr.When enabled, TLS packet trace information is written to
stderr. This can be used to debug TLS connection problems.Note: The format of the output is identical to the output of
openssl s_client -traceoropenssl s_server -trace. While it is produced by OpenSSL'sSSL_trace()function, the format is undocumented, can change without notice, and should not be relied on. - var encrypted: Boolean
Static boolean value, always true.
Static boolean value, always true. May be used to distinguish TLS sockets from regular ones.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exportKeyingMaterial(length: Double, label: scala.Predef.String, context: Buffer): Buffer
- length
number of bytes to retrieve from keying material
- label
an application specific label, typically this will be a value from the [IANA Exporter Label Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels).
- context
optionally provide a context.
- def getCertificate(): |[|[PeerCertificate, Object], Null]
Returns an object representing the local certificate.
Returns an object representing the local certificate. The returned object has some properties corresponding to the fields of the certificate.
See tls.TLSSocket.getPeerCertificate() for an example of the certificate structure.
If there is no local certificate, an empty object will be returned. If the socket has been destroyed, null will be returned.
- def getCipher(): CipherNameAndProtocol
Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def getEphemeralKeyInfo(): |[|[EphemeralKeyInfo, Object], Null]
Returns an object representing the type, name, and size of parameter of an ephemeral key exchange in Perfect Forward Secrecy on a client connection.
Returns an object representing the type, name, and size of parameter of an ephemeral key exchange in Perfect Forward Secrecy on a client connection. It returns an empty object when the key exchange is not ephemeral. As this is only supported on a client socket; null is returned if called on a server socket. The supported types are 'DH' and 'ECDH'. The name property is available only when type is 'ECDH'.
For example: { type: 'ECDH', name: 'prime256v1', size: 256 }.
- def getFinished(): UndefOr[Buffer]
Returns the latest Finished message that has been sent to the socket as part of a SSL/TLS handshake, or undefined if no Finished message has been sent yet.
Returns the latest Finished message that has been sent to the socket as part of a SSL/TLS handshake, or undefined if no Finished message has been sent yet.
As the Finished messages are message digests of the complete handshake (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can be used for external authentication procedures when the authentication provided by SSL/TLS is not desired or is not enough.
Corresponds to the SSL_get_finished routine in OpenSSL and may be used to implement the tls-unique channel binding from RFC 5929.
- def getPeerCertificate(detailed: Boolean): |[PeerCertificate, DetailedPeerCertificate]
- def getPeerCertificate(): |[PeerCertificate, DetailedPeerCertificate]
- def getPeerCertificate_PeerCertificate(): PeerCertificate
- Annotations
- @JSName("getPeerCertificate")
- def getPeerCertificate_false(detailed: false): PeerCertificate
- Annotations
- @JSName("getPeerCertificate")
- def getPeerCertificate_true(detailed: true): DetailedPeerCertificate
Returns an object representing the peer's certificate.
Returns an object representing the peer's certificate. The returned object has some properties corresponding to the field of the certificate. If detailed argument is true the full chain with issuer property will be returned, if false only the top certificate without issuer property. If the peer does not provide a certificate, it returns null or an empty object.
- detailed
- If true; the full chain with issuer property will be returned.
- Annotations
- @JSName("getPeerCertificate")
- def getPeerFinished(): UndefOr[Buffer]
Returns the latest Finished message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or undefined if there is no Finished message so far.
Returns the latest Finished message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or undefined if there is no Finished message so far.
As the Finished messages are message digests of the complete handshake (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can be used for external authentication procedures when the authentication provided by SSL/TLS is not desired or is not enough.
Corresponds to the SSL_get_peer_finished routine in OpenSSL and may be used to implement the tls-unique channel binding from RFC 5929.
- def getPeerX509Certificate(): UndefOr[X509Certificate]
If there is no peer certificate, or the socket has been destroyed,
undefinedwill be returned. - def getProtocol(): |[scala.Predef.String, Null]
Returns a string containing the negotiated SSL/TLS protocol version of the current connection.
Returns a string containing the negotiated SSL/TLS protocol version of the current connection. The value
'unknown'will be returned for connected sockets that have not completed the handshaking process. The valuenullwill be returned for server sockets or disconnected client sockets. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_get_version.html for more information. - def getSession(): UndefOr[Buffer]
Could be used to speed up handshake establishment when reconnecting to the server.
- def getSharedSigalgs(): Array[scala.Predef.String]
Returns a list of signature algorithms shared between the server and the client in the order of decreasing preference.
- def getTLSTicket(): UndefOr[Buffer]
NOTE: Works only with client TLS sockets.
NOTE: Works only with client TLS sockets. Useful only for debugging, for session reuse provide session option to tls.connect().
- def getX509Certificate(): UndefOr[X509Certificate]
If there is no local certificate, or the socket has been destroyed,
undefinedwill be returned. - def hasOwnProperty(v: scala.Predef.String): Boolean
- Definition Classes
- Object
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
- def isSessionReused(): Boolean
Returns true if the session was reused, false otherwise.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def on(event: scala.Predef.String, listener: Function1[Any, Unit]): TLSSocket.this.type
- def on_OCSPResponse(event: OCSPResponse, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("on")
- def on_keylog(event: keylog, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("on")
- def on_secureConnect(event: secureConnect, listener: Function0[Unit]): TLSSocket.this.type
- Annotations
- @JSName("on")
- def on_session(event: session, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("on")
- def once(event: scala.Predef.String, listener: Function1[Any, Unit]): TLSSocket.this.type
- def once_OCSPResponse(event: OCSPResponse, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("once")
- def once_keylog(event: keylog, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("once")
- def once_secureConnect(event: secureConnect, listener: Function0[Unit]): TLSSocket.this.type
- Annotations
- @JSName("once")
- def once_session(event: session, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("once")
- def prependListener(event: scala.Predef.String, listener: Function1[Any, Unit]): TLSSocket.this.type
- def prependListener_OCSPResponse(event: OCSPResponse, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_keylog(event: keylog, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_secureConnect(event: secureConnect, listener: Function0[Unit]): TLSSocket.this.type
- Annotations
- @JSName("prependListener")
- def prependListener_session(event: session, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("prependListener")
- def prependOnceListener(event: scala.Predef.String, listener: Function1[Any, Unit]): TLSSocket.this.type
- def prependOnceListener_OCSPResponse(event: OCSPResponse, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_keylog(event: keylog, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_secureConnect(event: secureConnect, listener: Function0[Unit]): TLSSocket.this.type
- Annotations
- @JSName("prependOnceListener")
- def prependOnceListener_session(event: session, listener: Function1[Buffer, Unit]): TLSSocket.this.type
- Annotations
- @JSName("prependOnceListener")
- def propertyIsEnumerable(v: scala.Predef.String): Boolean
- Definition Classes
- Object
- def renegotiate(options: RejectUnauthorized, callback: Function1[|[Error, Null], Unit]): UndefOr[Boolean]
Initiate TLS renegotiation process.
Initiate TLS renegotiation process.
NOTE: Can be used to request peer's certificate after the secure connection has been established. ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout.
- options
- The options may contain the following fields: rejectUnauthorized, requestCert (See tls.createServer() for details).
- callback
- callback(err) will be executed with null as err, once the renegotiation is successfully completed.
- returns
undefinedwhen socket is destroy,falseif negotiaion can't be initiated.
- def setMaxSendFragment(size: Double): Boolean
Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512).
Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). Smaller fragment size decreases buffering latency on the client: large fragments are buffered by the TLS layer until the entire fragment is received and its integrity is verified; large fragments can span multiple roundtrips, and their processing can be delayed due to packet loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead, which may decrease overall server throughput.
- size
- TLS fragment size (default and maximum value is: 16384, minimum is: 512).
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toLocaleString(): scala.Predef.String
- Definition Classes
- Object
- def toString(): java.lang.String
- Definition Classes
- AnyRef → Any
- def valueOf(): Any
- Definition Classes
- Object
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated