|
BOOL SetCertificate( |
|
DWORD dwProtocol, |
|
|
LPCTSTR lpszCertStore, |
|
|
LPCTSTR lpszCertName, |
|
|
LPCTSTR lpszPassword |
|
); |
BOOL SetCertificate( |
|
LPCTSTR lpszCertStore, |
|
|
LPCTSTR lpszCertName, |
|
|
LPCTSTR lpszPassword |
|
); |
BOOL SetCertificate( |
|
LPCTSTR lpszCertName, |
|
|
LPCTSTR lpszPassword |
|
); |
Specify the server certificate that should be used with secure
connections.
Parameters
- dwProtocol
- An optional bitmask of supported security protocols. If this
parameter is not specified, then a default set of security protocols
will be automatically selected. This parameter is
constructed by using a bitwise operator with any of the following
values:
Value |
Description |
SECURITY_PROTOCOL_DEFAULT |
The default selection of security protocols will be used when
establishing a connection. The TLS 1.2, TLS 1.1 and TLS 1.0
protocols will be negotiated with the client, in that order of
preference. This option will always request the latest version
of the preferred security protocols and is the recommended
value. |
SECURITY_PROTOCOL_SSL |
Either SSL 2.0 or SSL 3.0 should be used when establishing
a secure connection. The correct protocol is automatically
selected, based on what version of the protocol is supported by
the client. If this is the only protocol specified, TLS will be
excluded from the list of supported protocols. Note that SSL 2.0
has been deprecated and will never be used by default. |
SECURITY_PROTOCOL_TLS |
The TLS 1.0, 1.1 or 1.2 protocol should be used when
establishing a secure connection. The correct protocol is
automatically selected, based on what version of the protocol is
supported by the client. If this is the only protocol specified,
SSL will be excluded from the list of supported protocols. This
may be necessary for some clients that reject any attempt to use
the older SSL protocol and require that only TLS be used. |
- lpszCertStore
- An optional string value that specifies the name of the
certificate store that contains the server certificate. If the
certificate is stored in the registry, this parameter must
specify a valid local certificate store name. If the certificate is
stored in a file, this parameter should specify the full path to the
file that contains the certificate. If this parameter is omitted,
the personal certificate store for the current process will be used.
- lpszCertName
- A string value that specifies the name of the certificate. This
parameter is required and cannot be NULL. Either the common name or
the name assigned to the certificate may be specified. In most
cases, this will be the fully qualified domain name of the host that
the server is running on.
- lpszPassword
- An optional string value that specifies a password associated
with the server certificate. This parameter is usually only required
when the lpszCertStore parameter specifies a certificate
stored in a file. If the server certificate does not have a password
associated with it, this parameter or omitted.
Return Value
If the method succeeds, the return value is non-zero. If the
method fails, the return value is zero. To get extended error
information, call GetLastError.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cswsock11.h
Import Library: cswskv11.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
EnableSecurity,
SetOptions,
Start,
ValidateCertificate
|
|