SecureBlackbox 2020 PHP Edition

Questions / Feedback?

RESTServer Class

Properties   Methods   Events   Configuration Settings   Errors  

The RESTServer class supports server-side functionality of the REST protocol.

Class Name

SecureBlackbox_RESTServer

Procedural Interface

 secureblackbox_restserver_open();
 secureblackbox_restserver_close($res);
 secureblackbox_restserver_register_callback($res, $id, $function);
 secureblackbox_restserver_get_last_error($res);
 secureblackbox_restserver_get_last_error_code($res);
 secureblackbox_restserver_set($res, $id, $index, $value);
 secureblackbox_restserver_get($res, $id, $index);
 secureblackbox_restserver_do_config($res, $configurationstring);
 secureblackbox_restserver_do_dropclient($res, $connectionid, $forced);
 secureblackbox_restserver_do_getrequestbytes($res, $connectionid);
 secureblackbox_restserver_do_getrequestheader($res, $connectionid, $headername);
 secureblackbox_restserver_do_getrequeststring($res, $connectionid);
 secureblackbox_restserver_do_getrequestusername($res, $connectionid);
 secureblackbox_restserver_do_listclients($res);
 secureblackbox_restserver_do_pinclient($res, $connectionid);
 secureblackbox_restserver_do_setresponsebytes($res, $connectionid, $bytes, $contenttype);
 secureblackbox_restserver_do_setresponsefile($res, $connectionid, $filename, $contenttype);
 secureblackbox_restserver_do_setresponseheader($res, $connectionid, $headername, $value);
 secureblackbox_restserver_do_setresponsejson($res, $connectionid, $data);
 secureblackbox_restserver_do_setresponsestatus($res, $connectionid, $statuscode);
 secureblackbox_restserver_do_setresponsestring($res, $connectionid, $datastr, $contenttype);
 secureblackbox_restserver_do_setresponsexml($res, $connectionid, $data);
 secureblackbox_restserver_do_start($res);
 secureblackbox_restserver_do_stop($res);

Remarks

Use this control to add REST server functionality to your application.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

ActiveIndicates whether the server is active and is listening to new connections.
AllowKeepAliveEnables or disables keep-alive mode.
AuthBasicEnables or disables basic authentication.
AuthDigestEnables or disables digest authentication.
AuthDigestExpireSpecifies digest expiration time for digest authentication.
AuthRealmSpecifies authentication realm for digest and NTLM authentication.
BoundPortIndicates the bound listening port.
CompressionLevelThe default compression level to use.
DocumentRootThe document root of the server.
ErrorOriginIndicates the endpoint where the error originates from.
ErrorSeverityThe severity of the error that happened.
ExternalCryptoCustomParamsCustom parameters to be passed to the signing service (uninterpreted).
ExternalCryptoDataAdditional data to be included in the async state and mirrored back by the requestor.
ExternalCryptoExternalHashCalculationSpecifies whether the message hash is to be calculated at the external endpoint.
ExternalCryptoHashAlgorithmSpecifies the request's signature hash algorithm.
ExternalCryptoKeyIDThe ID of the pre-shared key used for DC request authentication.
ExternalCryptoKeySecretThe pre-shared key used for DC request authentication.
ExternalCryptoMethodSpecifies the asynchronous signing method.
ExternalCryptoModeSpecifies the external cryptography mode.
ExternalCryptoPublicKeyAlgorithmProvide public key algorithm here if the certificate is not available on the pre-signing stage.
HandshakeTimeoutSpecifies the handshake timeout in milliseconds.
HostThe host to bind the listening port to.
PinnedClientAddressThe client's IP address.
PinnedClientChainValidationDetailsThe details of a certificate chain validation outcome.
PinnedClientChainValidationResultThe outcome of a certificate chain validation routine.
PinnedClientCiphersuiteThe cipher suite employed by this connection.
PinnedClientClientAuthenticatedSpecifies whether client authentication was performed during this connection.
PinnedClientDigestAlgorithmThe digest algorithm used in a TLS-enabled connection.
PinnedClientEncryptionAlgorithmThe symmetric encryption algorithm used in a TLS-enabled connection.
PinnedClientIDThe client connection's unique identifier.
PinnedClientKeyExchangeAlgorithmThe key exchange algorithm used in a TLS-enabled connection.
PinnedClientKeyExchangeKeyBitsThe length of the key exchange key of a TLS-enabled connection.
PinnedClientNamedECCurveThe elliptic curve used in this connection.
PinnedClientPFSCipherIndicates whether the chosen ciphersuite provides perfect forward secrecy (PFS).
PinnedClientPortThe remote port of the client connection.
PinnedClientPublicKeyBitsThe length of the public key.
PinnedClientResumedSessionIndicates whether a TLS-enabled connection was spawned from another TLS connection.
PinnedClientSecureConnectionIndicates whether TLS or SSL is enabled for this connection.
PinnedClientSignatureAlgorithmThe signature algorithm used in a TLS handshake.
PinnedClientSymmetricBlockSizeThe block size of the symmetric algorithm used.
PinnedClientSymmetricKeyBitsThe key length of the symmetric algorithm used.
PinnedClientTotalBytesReceivedThe total number of bytes received over this connection.
PinnedClientTotalBytesSentThe total number of bytes sent over this connection.
PinnedClientValidationLogContains the server certificate's chain validation log.
PinnedClientVersionIndicates the version of SSL/TLS protocol negotiated during this connection.
PinnedClientCertCountThe number of records in the PinnedClientCert arrays.
PinnedClientCertBytesReturns raw certificate data in DER format.
PinnedClientCertCAKeyIDA unique identifier (fingerprint) of the CA certificate's private key.
PinnedClientCertFingerprintContains the fingerprint (a hash imprint) of this certificate.
PinnedClientCertHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
PinnedClientCertIssuerThe common name of the certificate issuer (CA), typically a company name.
PinnedClientCertIssuerRDNA collection of information, in the form of [OID, Value] pairs, uniquely identifying the certificate issuer.
PinnedClientCertKeyAlgorithmSpecifies the public key algorithm of this certificate.
PinnedClientCertKeyBitsReturns the length of the public key.
PinnedClientCertKeyFingerprintReturns a fingerprint of the public key contained in the certificate.
PinnedClientCertKeyUsageIndicates the purposes of the key contained in the certificate, in the form of an OR'ed flag set.
PinnedClientCertPublicKeyBytesContains the certificate's public key in DER format.
PinnedClientCertSelfSignedIndicates whether the certificate is self-signed (root) or signed by an external CA.
PinnedClientCertSerialNumberReturns the certificate's serial number.
PinnedClientCertSigAlgorithmIndicates the algorithm that was used by the CA to sign this certificate.
PinnedClientCertSubjectThe common name of the certificate holder, typically an individual's name, a URL, an e-mail address, or a company name.
PinnedClientCertSubjectKeyIDContains a unique identifier (fingerprint) of the certificate's private key.
PinnedClientCertSubjectRDNA collection of information, in the form of [OID, Value] pairs, uniquely identifying the certificate holder (subject).
PinnedClientCertValidFromThe time point at which the certificate becomes valid, in UTC.
PinnedClientCertValidToThe time point at which the certificate expires, in UTC.
PortSpecifies the port number to listen for connections on.
PortRangeFromSpecifies the lower limit of the listening port range for incoming connections.
PortRangeToSpecifies the upper limit of the listening port range for incoming connections.
ServerCertCountThe number of records in the ServerCert arrays.
ServerCertBytesReturns raw certificate data in DER format.
ServerCertHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
SessionTimeoutSpecifies the default session timeout value in milliseconds.
SocketIncomingSpeedLimitThe maximum number of bytes to read from the socket, per second.
SocketLocalAddressThe local network interface to bind the socket to.
SocketLocalPortThe local port number to bind the socket to.
SocketOutgoingSpeedLimitThe maximum number of bytes to write to the socket, per second.
SocketTimeoutThe maximum period of waiting, in milliseconds, after which the socket operation is considered unsuccessful.
SocketUseIPv6Enables or disables IP protocol version 6.
TempDirThe temporary path to use.
TLSAutoValidateCertificatesSpecifies whether server-side TLS certificates should be validated automatically using internal validation rules.
TLSBaseConfigurationSelects the base configuration for the TLS settings.
TLSCiphersuitesA list of ciphersuites separated with commas or semicolons.
TLSECCurvesDefines the elliptic curves to enable.
TLSForceResumeIfDestinationChangesWhether to force TLS session resumption when the destination address changes.
TLSPreSharedIdentityDefines the identity used when the PSK (Pre-Shared Key) key-exchange mechanism is negotiated.
TLSPreSharedKeyContains the pre-shared for the PSK (Pre-Shared Key) key-exchange mechanism, encoded with base16.
TLSPreSharedKeyCiphersuiteDefines the ciphersuite used for PSK (Pre-Shared Key) negotiation.
TLSRenegotiationAttackPreventionModeSelects renegotiation attack prevention mechanism.
TLSRevocationCheckSpecifies the kind(s) of revocation check to perform.
TLSSSLOptionsVarious SSL (TLS) protocol options, set of cssloExpectShutdownMessage 0x001 Wait for the close-notify message when shutting down the connection cssloOpenSSLDTLSWorkaround 0x002 (DEPRECATED) Use a DTLS version workaround when talking to very old OpenSSL versions cssloDisableKexLengthAlignment 0x004 Do not align the client-side PMS by the RSA modulus size.
TLSTLSModeSpecifies the TLS mode to use.
TLSUseExtendedMasterSecretEnables Extended Master Secret Extension, as defined in RFC 7627.
TLSUseSessionResumptionEnables or disables TLS session resumption capability.
TLSVersionsTh SSL/TLS versions to enable by default.
UseChunkedTransferEnables chunked transfer.
UseCompressionEnables or disables server-side compression.
UserCountThe number of records in the User arrays.
UserAssociatedDataContains the user's Associated Data when SSH AEAD (Authenticated Encryption with Associated Data) algorithm is used.
UserBasePathBase path for this user in the server's file system.
UserCertContains the user's certificate.
UserDataContains uninterpreted user-defined data that should be associated with the user account, such as comments or custom settings.
UserHandleAllows to get or set a 'handle', a unique identifier of the underlying property object.
UserHashAlgorithmSpecifies the hash algorithm used to generate TOTP (Time-based One-Time Passwords) passwords for this user.
UserIncomingSpeedLimitSpecifies the incoming speed limit for this user.
UserOutgoingSpeedLimitSpecifies the outgoing speed limit for this user.
UserPasswordThe user's authentication password.
UserSharedSecretContains the user's secret key, which is essentially a shared secret between the client and server.
UserUsernameThe registered name (login) of the user.
UseTLSEnables or disables the TLS requirement.
WebsiteNameSpecifies the web site name to use in the certificate.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

ConfigSets or retrieves a configuration setting.
DropClientTerminates a client connection.
GetRequestBytesReturns the contents of the client's HTTP request.
GetRequestHeaderReturns a request header value.
GetRequestStringReturns the contents of the client's HTTP request.
GetRequestUsernameReturns the username for a connection.
ListClientsEnumerates the connected clients.
PinClientTakes a snapshot of the connection's properties.
SetResponseBytesSets a byte array to be served as a response.
SetResponseFileSets a file to be served as a response.
SetResponseHeaderSets a response header.
SetResponseJSONSets a string to be served as a JSON response.
SetResponseStatusSets an HTTP status to be sent with the response.
SetResponseStringSets a string to be served as a response.
SetResponseXMLSets a string to be served as an XML response.
StartStarts the server.
StopStops the server.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

AcceptReports an incoming connection.
AuthAttemptFires when a connected client makes an authentication attempt.
CertificateValidateFires when a client certificate needs to be validated.
ConnectReports an accepted connection.
CustomRequestReports a request of a non-standard type (method).
DataSupplies a data chunk received within a POST or PUT upload.
DeleteRequestReports a DELETE request.
DisconnectFires to report a disconnected client.
ErrorInformation about errors during data delivery.
ExternalSignHandles remote or external signing initiated by the server protocol.
FileErrorReports a file access error to the application.
GetRequestReports a GET request.
HeadRequestReports a HEAD request.
NotificationThis event notifies the application about an underlying control flow event.
OptionsRequestReports an OPTIONS request.
PatchRequestReports a PATCH request.
PostRequestReports a POST request.
PutRequestReports a PUT request.
TLSEstablishedReports the setup of a TLS session.
TLSPSKRequests a pre-shared key for TLS-PSK.
TLSShutdownReports closure of a TLS session.
TraceRequestReports a TRACE request.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

AllowOptionsResponseWithoutAuthEnables unauthenticated responses to OPTIONS requests.
ClientAuthEnables or disables certificate-based client authentication.
DualStackAllows the use of ip4 and ip6 simultaneously.
HomePageSpecifies the home page resource name.
HostThe host to bind to.
RequestFilterThe request string modifier.
ServerSSLDHKeyLengthSets the size of the TLS DHE key exchange group.
TLSExtensionsProvides access to TLS extensions.
WebsiteNameThe website name for the TLS certificate.
CheckKeyIntegrityBeforeUseEnables or disable private key integrity check before use.
CookieCachingSpecifies whether a cookie cache should be used for HTTP(S) transports.
CookiesGets or sets local cookies for the class (supported for HTTPClient, RESTClient and SOAPClient only).
DefDeriveKeyIterationsSpecifies the default key derivation algorithm iteration count.
EnableClientSideSSLFFDHEEnables or disables finite field DHE key exchange support in TLS clients.
GlobalCookiesGets or sets global cookies for all the HTTP transports.
HttpUserAgentSpecifies the user agent name to be used by all HTTP clients.
LogDestinationSpecifies the debug log destination.
LogDetailsSpecifies the debug log details to dump.
LogFileSpecifies the debug log filename.
LogFiltersSpecifies the debug log filters.
LogFlushModeSpecifies the log flush mode.
LogLevelSpecifies the debug log level.
LogMaxEventCountSpecifies the maximum number of events to cache before further action is taken.
LogRotationModeSpecifies the log rotation mode.
MaxASN1BufferLengthSpecifies the maximal allowed length for ASN.1 primitive tag data.
MaxASN1TreeDepthSpecifies the maximal depth for processed ASN.1 trees.
OCSPHashAlgorithmSpecifies the hash algorithm to be used to identify certificates in OCSP requests.
UseOwnDNSResolverSpecifies whether the client classes should use own DNS resolver.
UseSharedSystemStoragesSpecifies whether the validation engine should use a global per-process copy of the system certificate stores.
UseSystemOAEPAndPSSEnforces or disables the use of system-driven RSA OAEP and PSS computations.
UseSystemRandomEnables or disables the use of the OS PRNG.

Copyright (c) 2022 /n software inc. - All rights reserved.
SecureBlackbox 2020 PHP Edition - Version 20.0 [Build 8154]