000029077 - How to create a C# application using DPM Token Web Services?

Document created by RSA Customer Support Employee on Jun 14, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000029077
Applies ToRSA Data Protection Manager
IssueUsing a Visual Studio C# project you might get the following error:
Caught unexpected exception in singleTokenize().
System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at TokenWS.tokenize(String input, String className, String userData) in C:\Users\myself\TokenWS\TokenWS.cs:line 213
   at tokenws_threaded.Program.singleTokenize(String PAN) in C:\Users\myself\Documents\TokenWS\main.cs:line 369
   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at TokenWS.tokenize(String input, String className, String userData) in C:\Users\myself\Documents\TokenWS\TokenWS.cs:line 213
   at tokenws_threaded.Program.singleTokenize(String PAN) in C:\Users\myself\Documents\TokenWS\main.cs:line 369

 
ResolutionStep 1: Automatically generate the Token client class code:
"C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\Bin\wsdl.exe" https://token.example.com/KMS/services/TokenWS?wsdl

Step 2: Create your main file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography.X509Certificates;
namespace DPMTokenWS
{
    class Program
    {
        static void Main(string[] args)
        {
            TokenWS ws = new TokenWS();
            try
            {
                X509Certificate2 cert = new X509Certificate2();
                string ret = null;
                cert.Import("C:\\my_DPM_Client_certificate.pfx""Password1",X509KeyStorageFlags.UserKeySet);
 
               ws.ClientCertificates.Add(cert);
                ws.Url = "https://dpm.rsa.lab.emc.com/KMS/services/TokenWS";
                ret = ws.tokenize("999999998""9 digits""C# test");
                Console.WriteLine("Received:" + ret);
            }
            catch (Exception exc)
            {
                Console.WriteLine("Caught unexpected exception in Main():\n" + exc.ToString() + "\n" + exc.StackTrace);
            }
            Console.WriteLine("Hit any key to terminate...");
            Console.ReadKey();
            Environment.Exit(0);
        }
    }
}

Step 3: Run..
NOTE:
As of DPM Appliance 3.5.2, you must run this script to enable ciphers used by Windows:
/opt/rsa/setup/sh/enable_IE_support.sh -on -r


If you do not run this command above you will get an error similar to the error above.

Attachments

    Outcomes