AnsweredAssumed Answered

CA-SDM Integration - Webservice R11.2

Question asked by jpgonc on Dec 11, 2015
Latest reply on Jan 6, 2016 by Gutis

Hello everybody. I build up a webservice using vbscript and C# to get information from a specific CHG or Incident. It all worked fine until a new policy came in to squash my work. I used the login constructor to authenticate (User and PW) but now I must use a PKI auth. I know I must use the loginservicemanaged constructor and I have the certificate (.p12) locally for testing. But I am unable to properly authenticate. It gives me the error "invalid login policy encryption".

 

Here it is the main code:

 

private string GetCertificado()

        {

            // Certificados X509 Versão 3

 

            string strPKI = string.Empty;

 

            X509Certificate2 objCertificado = null;

            X509Store localiz_certif = new X509Store(StoreName.Root, StoreLocation.LocalMachine);

            localiz_certif.Open(OpenFlags.ReadOnly);

 

                    //-> strNomeCert="CN=ServiceDesk ZDACPolicy"

            X509Certificate2Collection Resultado =

                    localiz_certif.Certificates.Find(X509FindType.FindByIssuerDistinguishedName, _strNomeCertif, true);

            if (Resultado.Count != 0)

            {

                objCertificado = Resultado[0];

                //strPKI = objCertificado.PrivateKey.ToXmlString(false);

 

                strPKI = Convert.ToBase64String(objCertificado.Export(X509ContentType.Cert), Base64FormattingOptions.None);

                localiz_certif.Close();

            }

            return strPKI;

        }

 

 

 

public int Ligar(string strCertifPKI)

        {

            string strSID;

 

            try

            {

                strSID = objCAWebService.loginServiceManaged ("ZDACPolicy", strCertifPKI);

              

                int intSID = int.Parse(strSID);

                return intSID;

            }

            catch (Exception erro)

            {

                Console.WriteLine(erro);

                return 0;

            }

        }

 

Has anyone implemented code using a PKI with the loginservicemanaged?

Thanks in advance.

Outcomes