APIs

Show:

Constructor

ServerSecureChannelLayer

(
  • options
)

Parameters:

  • options Object
    • parent OPCUAServerEndPoint

      parent

    • [timeout= 10000] Number optional

      timeout in milliseconds

    • [defaultSecureTokenLifetime= 30000] optional

      defaultSecureTokenLifetime

    • [objectFactory] optional

      an factory that provides a method createObjectId(id) for the message builder

Methods

_check_receiverCertificateThumbprint verify that the receiverCertificateThumbprint send by the client matching the CertificateThumbPrint of the server

(
  • clientSecurityHeader
)
Boolean private

Parameters:

  • clientSecurityHeader Object

Returns:

Boolean:

_prepare_security_header

(
  • request
  • message
)
AsymmetricAlgorithmSecurityHeader private

Parameters:

  • request Object
  • message Object

_process_certificates

(
  • message
  • callback
)
private async

_process_certificates extracts client public keys from client certificate and store them in self.receiverPublicKey and self.receiverCertificate it also caches self.receiverPublicKeyLength.

so they can be used by security channel.

Parameters:

  • message Object

    the message coming from the client

  • callback Object

_read_headers

(
  • binaryStream
)
Boolean private

Parameters:

  • binaryStream Object

Returns:

Boolean:

chunkSecureMessage

(
  • msgType
  • options
  • message
  • messageChunkCallback
)

Parameters:

  • msgType String
  • options Object
    • tokenId
    • chunkSize

      [default=8196]

    • signatureLength Integer

      [default=0]

    • signingFunc Function

      [default=null]

  • message Object
  • messageChunkCallback Function

close

(
  • callback
)
async

Abruptly close a Server SecureChannel ,by terminating the underlying transport.

Parameters:

  • callback Function

getCertificate

() Buffer

Returns:

Buffer:

the X509 DER form certificate

getCertificate

() Buffer

Returns:

Buffer:

the X509 DER form certificate

getPrivateKey

() Buffer

Returns:

Buffer:

the privateKey

init

(
  • socket
  • callback
)
async

Parameters:

  • socket Socket
  • callback Function

send_error_and_abort

(
  • statusCode
  • description
  • message
  • callback
)
async

send a ServiceFault response

Parameters:

  • statusCode StatusCode

    the status code

  • description String
  • message String
  • callback Function

send_response

(
  • msgType
  • response
  • message
  • [callback]
)
async

Parameters:

  • msgType Object
  • response Object
  • message Object
  • [callback] Function optional

    an optional callback function

update

(
  • options
)

Parameters:

  • options Object
    • securityHeader Object

      SecurityHeader

    • [derivedKeys] Object optional

      derivedKeys

Properties

bytesRead

Number

the number of bytes read so far by this channel

bytesWritten

Number

the number of bytes written so far by this channel

endpoints

OPCUAServerEndPoint

the endpoint associated with this secure channel

hashKey

String

The unique hash key to identify this secure channel

hasSession

Boolean

true when the secure channel is assigned to a active session

isOpened

Boolean

true when the secure channel has been opened successfully

Events

abort

notify the observers that the SecureChannel has aborted. the reason could be :

  • a CloseSecureChannelRequest has been received.
  • a invalid message has been received the event is sent after the underlying transport layer has been closed.

invalid_sequence_number

notify the observers that a message with an invalid sequence number has been received.

Event Payload:

  • expected Number
    sequence Number
  • actual Number
    sequence Number

message

notify the observer that a OPCUA message has been received. It is up to one observer to call send_response or send_error_and_abort to complete the transaction.

Event Payload:

  • message Object