コード例 #1
0
        public string ProvaServizioCERT()
        {
            string file = Server.MapPath("~") + "\\cert.der";

            OpenWcfChannel();
            CrlVerificationService clr = new CrlVerificationService();

            logger.Debug("Effettuo la verifica certificato");
            CrlVerificationService.EsitoVerifica retval = null;
            try
            {
                byte[] ca = new byte[0];
                //byte[] cer = new System.Text.ASCIIEncoding().GetBytes(Convert.ToBase64String(System.IO.File.ReadAllBytes(file)));
                byte[] cer    = System.IO.File.ReadAllBytes(file);
                string b64Cer = Convert.ToBase64String(System.IO.File.ReadAllBytes(file));
                retval = clr.VerificaCertificato(cer, ca, client);
                logger.Debug("Verifica cerificato effettuato.");
            }
            catch (Exception e)
            {
                logger.Error("Verifica cerificato Errore :" + e.Message + e.StackTrace);
                return(e.Message);
            }


            return(Utils.SerializeObject <CrlVerificationService.EsitoVerifica>(retval));
        }
コード例 #2
0
        public string[] BatchDettaglioCertificato(string[] CertificateBase64)
        {
            List <String> retval = new List <string>();

            OpenWcfChannel();
            string serviceUrl          = ConfigurationManager.AppSettings["SERVICE_URL"];
            CrlVerificationService clr = new CrlVerificationService();

            CrlVerificationService.EsitoVerifica retvalCert = null;

            byte[] CertificateCAPEM = null;
            foreach (string certStr in CertificateBase64)
            {
                //converto il certificato base64 in binario
                byte[] CertificateDer = Convert.FromBase64String(certStr);
                try
                {
                    retvalCert = clr.VerificaCertificato(CertificateDer, CertificateCAPEM, client);
                    logger.Debug("Verifica cerificato effettuato con successo.");
                    retval.Add(Utils.SerializeObject <DocsPaVO.documento.CertificateInfo>(clr.GetCertificateInfoFromEv(retvalCert)));
                }
                catch (Exception e)
                {
                    logger.Error("Verifica cerificato Errore :" + e.Message + e.StackTrace);
                    //return e.Message;
                }
            }
            return(retval.ToArray());
        }
コード例 #3
0
        private void OpenWcfChannel()
        {
            string serviceUrl = ConfigurationManager.AppSettings["SERVICE_URL"];

            if (client == null)
            {
                logger.Debug("Il canale è null, apro un nuovo canale di comunicazione");
                client = CrlVerificationService.createClient(serviceUrl);
            }

            if (client.State != System.ServiceModel.CommunicationState.Opened)
            {
                logger.Debug("Il canale è chiuso, lo apro nuovamente");
                client = CrlVerificationService.createClient(serviceUrl);
            }
        }
コード例 #4
0
        public string DettaglioCertificato(byte[] CertificateDer, byte[] CertificateCAPEM)
        {
            OpenWcfChannel();
            CrlVerificationService clr = new CrlVerificationService();

            CrlVerificationService.EsitoVerifica retval = null;
            try
            {
                retval = clr.VerificaCertificato(CertificateDer, CertificateCAPEM, client);
                logger.Debug("Verifica cerificato effettuato con successo.");
            }
            catch (Exception e)
            {
                logger.Error("Verifica cerificato Errore :" + e.Message + e.StackTrace);
                return(e.Message);
            }

            return(Utils.SerializeObject <CrlVerificationService.EsitoVerifica>(retval));
        }
コード例 #5
0
 public string VerificaCertificato(byte[] content, DateTime?dataverificaDT, bool ancheFile)
 {
     OpenWcfChannel();
     ActalisConnector.CrlVerificationService cvs = new CrlVerificationService();
     return(cvs.verifica(content, dataverificaDT, ancheFile, client));
 }