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: SwissDecTXAssembly: SwissDecTX.Transmitter5 (in SwissDecTX.Transmitter5.dll) Version: 5.0.0.0 (5.0.0.0)
Syntaxpublic void SetTransmitterCertificate(
string certificateSearchString,
Transmitter5CertificateSearchMode certificateSearchMode
)
Public Sub SetTransmitterCertificate (
certificateSearchString As String,
certificateSearchMode As Transmitter5CertificateSearchMode
)
public:
virtual void SetTransmitterCertificate(
String^ certificateSearchString,
Transmitter5CertificateSearchMode certificateSearchMode
) sealed
function SetTransmitterCertificate(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 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.
ExampleCalling 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);
}
} catch (Exception ex) {
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
See Also