Click or drag to resize

Transmitter5SetTransmitterCertificate Method

Tell the SwissDecTX Transmitter what certificate to use to sign the transmissions, this is the client's certificate uniquely identifying your software. The server will use your certificate's public key to encrypt the replies sent to your computer and SwissDecTX will use this certificate's private key to decrypt the messages. This call overrides the configured transmitter certificate and can be used to switch programmatically between a test and a production certificate.

Namespace: SwissDecTX
Assembly: SwissDecTX.Transmitter5 (in SwissDecTX.Transmitter5.dll) Version: 5.0.0.0 (5.0.0.0)
Syntax
public void SetTransmitterCertificate(
	string certificateSearchString,
	Transmitter5CertificateSearchMode 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.
Remarks
It is not mandatory to call this method, you can configure the transmitter certificate using the SwissDecTX configuration tool. The certificate to be used here has to be issued by SwissDec and must 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.
Example
Calling Transmitter.SetTransmitterCertificate()
   using SwissDecTX;

// ...

       try {

           var tx = new Transmitter5();

           if (useTestCertificates) {
               tx.SetTransmitterCertificate("SERIALNUMBER=3, CN=Test, O=Swissdec, C=CH", CertificateSearchMode.FindBySubjectDistinguishedName);
           } else {
               tx.SetTransmitterCertificate("C=CH, L=City, O=You Company, CN=Your Product, OID.0.9.2342.19200300.100.1.1=2.1", CertificateSearchMode.FindBySubjectDistinguishedName);
           }

           // TODO: Set the receiver certificate if needed

           // TODO: Use the transmitter...

       } catch (Exception ex) {

           MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

       }
See Also