Transmitter5SetReceiverCertificate Method |
Tell the SwissDecTX Transmitter what certificate to use to crypt the transmissions, this is the server's certificate and the server's public key it contains is used for encrypting outgoing messages. This call overrides the configured receiver certificate and can be used to switch programmatically between a test and a production certificate.
Namespace: SwissDecTXAssembly: SwissDecTX.Transmitter5 (in SwissDecTX.Transmitter5.dll) Version: 5.0.0.0 (5.0.0.0)
Syntaxpublic void SetReceiverCertificate(
string certificateSearchString,
Transmitter5CertificateSearchMode certificateSearchMode
)
Public Sub SetReceiverCertificate (
certificateSearchString As String,
certificateSearchMode As Transmitter5CertificateSearchMode
)
public:
virtual void SetReceiverCertificate(
String^ certificateSearchString,
Transmitter5CertificateSearchMode certificateSearchMode
) sealed
function SetReceiverCertificate(certificateSearchString, certificateSearchMode);
Parameters
- certificateSearchString String
- The string to be used to locate the certificate (depends on the search mode).
- certificateSearchMode Transmitter5CertificateSearchMode
- The search mode to be used to find the certificate, see Transmitter5CertificateSearchMode.
RemarksIt is not mandatory to call this method, you can configure the receiver certificate using the SwissDecTX configuration tool. The certificate to be used here has to be issued by SwissDec and must
not contain a private key. Use the
InstallCertificates(String, String, String, String, Boolean) method to install the certificates you got from SwissDec in the computer. This method call only affects the current transmitter instance.
ExampleCalling Transmitter.SetReceiverCertificate()
using SwissDecTX;
try {
var tx = new Transmitter5();
if (useTestCertificates) {
tx.SetReceiverCertificate("SERIALNUMBER=4, CN=RefApp Receiver, O=Swissdec, C=CH", CertificateSearchMode.FindBySubjectDistinguishedName);
} else {
tx.SetReceiverCertificate("C=CH, O=Swissdec, CN=Distributor", CertificateSearchMode.FindBySubjectDistinguishedName);
}
} catch (Exception ex) {
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
See Also